~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/bluetooth/6lowpan.c

Version: ~ [ linux-5.8 ] ~ [ linux-5.7.12 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.55 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.136 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.191 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.232 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.232 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2    Copyright (c) 2013-2014 Intel Corp.
  3 
  4    This program is free software; you can redistribute it and/or modify
  5    it under the terms of the GNU General Public License version 2 and
  6    only version 2 as published by the Free Software Foundation.
  7 
  8    This program is distributed in the hope that it will be useful,
  9    but WITHOUT ANY WARRANTY; without even the implied warranty of
 10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 11    GNU General Public License for more details.
 12 */
 13 
 14 #include <linux/if_arp.h>
 15 #include <linux/netdevice.h>
 16 #include <linux/etherdevice.h>
 17 #include <linux/module.h>
 18 #include <linux/debugfs.h>
 19 
 20 #include <net/ipv6.h>
 21 #include <net/ip6_route.h>
 22 #include <net/addrconf.h>
 23 
 24 #include <net/af_ieee802154.h> /* to get the address type */
 25 
 26 #include <net/bluetooth/bluetooth.h>
 27 #include <net/bluetooth/hci_core.h>
 28 #include <net/bluetooth/l2cap.h>
 29 
 30 #include <net/6lowpan.h> /* for the compression support */
 31 
 32 #define VERSION "0.1"
 33 
 34 static struct dentry *lowpan_psm_debugfs;
 35 static struct dentry *lowpan_control_debugfs;
 36 
 37 #define IFACE_NAME_TEMPLATE "bt%d"
 38 #define EUI64_ADDR_LEN 8
 39 
 40 struct skb_cb {
 41         struct in6_addr addr;
 42         struct in6_addr gw;
 43         struct l2cap_chan *chan;
 44         int status;
 45 };
 46 #define lowpan_cb(skb) ((struct skb_cb *)((skb)->cb))
 47 
 48 /* The devices list contains those devices that we are acting
 49  * as a proxy. The BT 6LoWPAN device is a virtual device that
 50  * connects to the Bluetooth LE device. The real connection to
 51  * BT device is done via l2cap layer. There exists one
 52  * virtual device / one BT 6LoWPAN network (=hciX device).
 53  * The list contains struct lowpan_dev elements.
 54  */
 55 static LIST_HEAD(bt_6lowpan_devices);
 56 static DEFINE_RWLOCK(devices_lock);
 57 
 58 /* If psm is set to 0 (default value), then 6lowpan is disabled.
 59  * Other values are used to indicate a Protocol Service Multiplexer
 60  * value for 6lowpan.
 61  */
 62 static u16 psm_6lowpan;
 63 
 64 /* We are listening incoming connections via this channel
 65  */
 66 static struct l2cap_chan *listen_chan;
 67 
 68 struct lowpan_peer {
 69         struct list_head list;
 70         struct l2cap_chan *chan;
 71 
 72         /* peer addresses in various formats */
 73         unsigned char eui64_addr[EUI64_ADDR_LEN];
 74         struct in6_addr peer_addr;
 75 };
 76 
 77 struct lowpan_dev {
 78         struct list_head list;
 79 
 80         struct hci_dev *hdev;
 81         struct net_device *netdev;
 82         struct list_head peers;
 83         atomic_t peer_count; /* number of items in peers list */
 84 
 85         struct work_struct delete_netdev;
 86         struct delayed_work notify_peers;
 87 };
 88 
 89 static inline struct lowpan_dev *lowpan_dev(const struct net_device *netdev)
 90 {
 91         return netdev_priv(netdev);
 92 }
 93 
 94 static inline void peer_add(struct lowpan_dev *dev, struct lowpan_peer *peer)
 95 {
 96         list_add(&peer->list, &dev->peers);
 97         atomic_inc(&dev->peer_count);
 98 }
 99 
100 static inline bool peer_del(struct lowpan_dev *dev, struct lowpan_peer *peer)
101 {
102         list_del(&peer->list);
103 
104         module_put(THIS_MODULE);
105 
106         if (atomic_dec_and_test(&dev->peer_count)) {
107                 BT_DBG("last peer");
108                 return true;
109         }
110 
111         return false;
112 }
113 
114 static inline struct lowpan_peer *peer_lookup_ba(struct lowpan_dev *dev,
115                                                  bdaddr_t *ba, __u8 type)
116 {
117         struct lowpan_peer *peer, *tmp;
118 
119         BT_DBG("peers %d addr %pMR type %d", atomic_read(&dev->peer_count),
120                ba, type);
121 
122         list_for_each_entry_safe(peer, tmp, &dev->peers, list) {
123                 BT_DBG("dst addr %pMR dst type %d",
124                        &peer->chan->dst, peer->chan->dst_type);
125 
126                 if (bacmp(&peer->chan->dst, ba))
127                         continue;
128 
129                 if (type == peer->chan->dst_type)
130                         return peer;
131         }
132 
133         return NULL;
134 }
135 
136 static inline struct lowpan_peer *peer_lookup_chan(struct lowpan_dev *dev,
137                                                    struct l2cap_chan *chan)
138 {
139         struct lowpan_peer *peer, *tmp;
140 
141         list_for_each_entry_safe(peer, tmp, &dev->peers, list) {
142                 if (peer->chan == chan)
143                         return peer;
144         }
145 
146         return NULL;
147 }
148 
149 static inline struct lowpan_peer *peer_lookup_conn(struct lowpan_dev *dev,
150                                                    struct l2cap_conn *conn)
151 {
152         struct lowpan_peer *peer, *tmp;
153 
154         list_for_each_entry_safe(peer, tmp, &dev->peers, list) {
155                 if (peer->chan->conn == conn)
156                         return peer;
157         }
158 
159         return NULL;
160 }
161 
162 static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_dev *dev,
163                                                   struct in6_addr *daddr,
164                                                   struct sk_buff *skb)
165 {
166         struct lowpan_peer *peer, *tmp;
167         struct in6_addr *nexthop;
168         struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
169         int count = atomic_read(&dev->peer_count);
170 
171         BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
172 
173         /* If we have multiple 6lowpan peers, then check where we should
174          * send the packet. If only one peer exists, then we can send the
175          * packet right away.
176          */
177         if (count == 1)
178                 return list_first_entry(&dev->peers, struct lowpan_peer,
179                                         list);
180 
181         if (!rt) {
182                 nexthop = &lowpan_cb(skb)->gw;
183 
184                 if (ipv6_addr_any(nexthop))
185                         return NULL;
186         } else {
187                 nexthop = rt6_nexthop(rt);
188 
189                 /* We need to remember the address because it is needed
190                  * by bt_xmit() when sending the packet. In bt_xmit(), the
191                  * destination routing info is not set.
192                  */
193                 memcpy(&lowpan_cb(skb)->gw, nexthop, sizeof(struct in6_addr));
194         }
195 
196         BT_DBG("gw %pI6c", nexthop);
197 
198         list_for_each_entry_safe(peer, tmp, &dev->peers, list) {
199                 BT_DBG("dst addr %pMR dst type %d ip %pI6c",
200                        &peer->chan->dst, peer->chan->dst_type,
201                        &peer->peer_addr);
202 
203                 if (!ipv6_addr_cmp(&peer->peer_addr, nexthop))
204                         return peer;
205         }
206 
207         return NULL;
208 }
209 
210 static struct lowpan_peer *lookup_peer(struct l2cap_conn *conn)
211 {
212         struct lowpan_dev *entry, *tmp;
213         struct lowpan_peer *peer = NULL;
214         unsigned long flags;
215 
216         read_lock_irqsave(&devices_lock, flags);
217 
218         list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices, list) {
219                 peer = peer_lookup_conn(entry, conn);
220                 if (peer)
221                         break;
222         }
223 
224         read_unlock_irqrestore(&devices_lock, flags);
225 
226         return peer;
227 }
228 
229 static struct lowpan_dev *lookup_dev(struct l2cap_conn *conn)
230 {
231         struct lowpan_dev *entry, *tmp;
232         struct lowpan_dev *dev = NULL;
233         unsigned long flags;
234 
235         read_lock_irqsave(&devices_lock, flags);
236 
237         list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices, list) {
238                 if (conn->hcon->hdev == entry->hdev) {
239                         dev = entry;
240                         break;
241                 }
242         }
243 
244         read_unlock_irqrestore(&devices_lock, flags);
245 
246         return dev;
247 }
248 
249 static int give_skb_to_upper(struct sk_buff *skb, struct net_device *dev)
250 {
251         struct sk_buff *skb_cp;
252         int ret;
253 
254         skb_cp = skb_copy(skb, GFP_ATOMIC);
255         if (!skb_cp)
256                 return -ENOMEM;
257 
258         ret = netif_rx(skb_cp);
259         if (ret < 0) {
260                 BT_DBG("receive skb %d", ret);
261                 return NET_RX_DROP;
262         }
263 
264         return ret;
265 }
266 
267 static int process_data(struct sk_buff *skb, struct net_device *netdev,
268                         struct l2cap_chan *chan)
269 {
270         const u8 *saddr, *daddr;
271         u8 iphc0, iphc1;
272         struct lowpan_dev *dev;
273         struct lowpan_peer *peer;
274         unsigned long flags;
275 
276         dev = lowpan_dev(netdev);
277 
278         read_lock_irqsave(&devices_lock, flags);
279         peer = peer_lookup_chan(dev, chan);
280         read_unlock_irqrestore(&devices_lock, flags);
281         if (!peer)
282                 goto drop;
283 
284         saddr = peer->eui64_addr;
285         daddr = dev->netdev->dev_addr;
286 
287         /* at least two bytes will be used for the encoding */
288         if (skb->len < 2)
289                 goto drop;
290 
291         if (lowpan_fetch_skb_u8(skb, &iphc0))
292                 goto drop;
293 
294         if (lowpan_fetch_skb_u8(skb, &iphc1))
295                 goto drop;
296 
297         return lowpan_process_data(skb, netdev,
298                                    saddr, IEEE802154_ADDR_LONG, EUI64_ADDR_LEN,
299                                    daddr, IEEE802154_ADDR_LONG, EUI64_ADDR_LEN,
300                                    iphc0, iphc1, give_skb_to_upper);
301 
302 drop:
303         kfree_skb(skb);
304         return -EINVAL;
305 }
306 
307 static int recv_pkt(struct sk_buff *skb, struct net_device *dev,
308                     struct l2cap_chan *chan)
309 {
310         struct sk_buff *local_skb;
311         int ret;
312 
313         if (!netif_running(dev))
314                 goto drop;
315 
316         if (dev->type != ARPHRD_6LOWPAN)
317                 goto drop;
318 
319         /* check that it's our buffer */
320         if (skb->data[0] == LOWPAN_DISPATCH_IPV6) {
321                 /* Copy the packet so that the IPv6 header is
322                  * properly aligned.
323                  */
324                 local_skb = skb_copy_expand(skb, NET_SKB_PAD - 1,
325                                             skb_tailroom(skb), GFP_ATOMIC);
326                 if (!local_skb)
327                         goto drop;
328 
329                 local_skb->protocol = htons(ETH_P_IPV6);
330                 local_skb->pkt_type = PACKET_HOST;
331 
332                 skb_reset_network_header(local_skb);
333                 skb_set_transport_header(local_skb, sizeof(struct ipv6hdr));
334 
335                 if (give_skb_to_upper(local_skb, dev) != NET_RX_SUCCESS) {
336                         kfree_skb(local_skb);
337                         goto drop;
338                 }
339 
340                 dev->stats.rx_bytes += skb->len;
341                 dev->stats.rx_packets++;
342 
343                 kfree_skb(local_skb);
344                 kfree_skb(skb);
345         } else {
346                 switch (skb->data[0] & 0xe0) {
347                 case LOWPAN_DISPATCH_IPHC:      /* ipv6 datagram */
348                         local_skb = skb_clone(skb, GFP_ATOMIC);
349                         if (!local_skb)
350                                 goto drop;
351 
352                         ret = process_data(local_skb, dev, chan);
353                         if (ret != NET_RX_SUCCESS)
354                                 goto drop;
355 
356                         dev->stats.rx_bytes += skb->len;
357                         dev->stats.rx_packets++;
358 
359                         kfree_skb(skb);
360                         break;
361                 default:
362                         break;
363                 }
364         }
365 
366         return NET_RX_SUCCESS;
367 
368 drop:
369         dev->stats.rx_dropped++;
370         kfree_skb(skb);
371         return NET_RX_DROP;
372 }
373 
374 /* Packet from BT LE device */
375 static int chan_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
376 {
377         struct lowpan_dev *dev;
378         struct lowpan_peer *peer;
379         int err;
380 
381         peer = lookup_peer(chan->conn);
382         if (!peer)
383                 return -ENOENT;
384 
385         dev = lookup_dev(chan->conn);
386         if (!dev || !dev->netdev)
387                 return -ENOENT;
388 
389         err = recv_pkt(skb, dev->netdev, chan);
390         if (err) {
391                 BT_DBG("recv pkt %d", err);
392                 err = -EAGAIN;
393         }
394 
395         return err;
396 }
397 
398 static u8 get_addr_type_from_eui64(u8 byte)
399 {
400         /* Is universal(0) or local(1) bit */
401         return ((byte & 0x02) ? BDADDR_LE_RANDOM : BDADDR_LE_PUBLIC);
402 }
403 
404 static void copy_to_bdaddr(struct in6_addr *ip6_daddr, bdaddr_t *addr)
405 {
406         u8 *eui64 = ip6_daddr->s6_addr + 8;
407 
408         addr->b[0] = eui64[7];
409         addr->b[1] = eui64[6];
410         addr->b[2] = eui64[5];
411         addr->b[3] = eui64[2];
412         addr->b[4] = eui64[1];
413         addr->b[5] = eui64[0];
414 }
415 
416 static void convert_dest_bdaddr(struct in6_addr *ip6_daddr,
417                                 bdaddr_t *addr, u8 *addr_type)
418 {
419         copy_to_bdaddr(ip6_daddr, addr);
420 
421         /* We need to toggle the U/L bit that we got from IPv6 address
422          * so that we get the proper address and type of the BD address.
423          */
424         addr->b[5] ^= 0x02;
425 
426         *addr_type = get_addr_type_from_eui64(addr->b[5]);
427 }
428 
429 static int header_create(struct sk_buff *skb, struct net_device *netdev,
430                          unsigned short type, const void *_daddr,
431                          const void *_saddr, unsigned int len)
432 {
433         struct ipv6hdr *hdr;
434         struct lowpan_dev *dev;
435         struct lowpan_peer *peer;
436         bdaddr_t addr, *any = BDADDR_ANY;
437         u8 *saddr, *daddr = any->b;
438         u8 addr_type;
439 
440         if (type != ETH_P_IPV6)
441                 return -EINVAL;
442 
443         hdr = ipv6_hdr(skb);
444 
445         dev = lowpan_dev(netdev);
446 
447         if (ipv6_addr_is_multicast(&hdr->daddr)) {
448                 memcpy(&lowpan_cb(skb)->addr, &hdr->daddr,
449                        sizeof(struct in6_addr));
450                 lowpan_cb(skb)->chan = NULL;
451         } else {
452                 unsigned long flags;
453 
454                 /* Get destination BT device from skb.
455                  * If there is no such peer then discard the packet.
456                  */
457                 convert_dest_bdaddr(&hdr->daddr, &addr, &addr_type);
458 
459                 BT_DBG("dest addr %pMR type %d IP %pI6c", &addr,
460                        addr_type, &hdr->daddr);
461 
462                 read_lock_irqsave(&devices_lock, flags);
463                 peer = peer_lookup_ba(dev, &addr, addr_type);
464                 read_unlock_irqrestore(&devices_lock, flags);
465 
466                 if (!peer) {
467                         /* The packet might be sent to 6lowpan interface
468                          * because of routing (either via default route
469                          * or user set route) so get peer according to
470                          * the destination address.
471                          */
472                         read_lock_irqsave(&devices_lock, flags);
473                         peer = peer_lookup_dst(dev, &hdr->daddr, skb);
474                         read_unlock_irqrestore(&devices_lock, flags);
475                         if (!peer) {
476                                 BT_DBG("no such peer %pMR found", &addr);
477                                 return -ENOENT;
478                         }
479                 }
480 
481                 daddr = peer->eui64_addr;
482 
483                 memcpy(&lowpan_cb(skb)->addr, &hdr->daddr,
484                        sizeof(struct in6_addr));
485                 lowpan_cb(skb)->chan = peer->chan;
486         }
487 
488         saddr = dev->netdev->dev_addr;
489 
490         return lowpan_header_compress(skb, netdev, type, daddr, saddr, len);
491 }
492 
493 /* Packet to BT LE device */
494 static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,
495                     struct net_device *netdev)
496 {
497         struct msghdr msg;
498         struct kvec iv;
499         int err;
500 
501         /* Remember the skb so that we can send EAGAIN to the caller if
502          * we run out of credits.
503          */
504         chan->data = skb;
505 
506         memset(&msg, 0, sizeof(msg));
507         msg.msg_iov = (struct iovec *) &iv;
508         msg.msg_iovlen = 1;
509         iv.iov_base = skb->data;
510         iv.iov_len = skb->len;
511 
512         err = l2cap_chan_send(chan, &msg, skb->len);
513         if (err > 0) {
514                 netdev->stats.tx_bytes += err;
515                 netdev->stats.tx_packets++;
516                 return 0;
517         }
518 
519         if (!err)
520                 err = lowpan_cb(skb)->status;
521 
522         if (err < 0) {
523                 if (err == -EAGAIN)
524                         netdev->stats.tx_dropped++;
525                 else
526                         netdev->stats.tx_errors++;
527         }
528 
529         return err;
530 }
531 
532 static void send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
533 {
534         struct sk_buff *local_skb;
535         struct lowpan_dev *entry, *tmp;
536         unsigned long flags;
537 
538         read_lock_irqsave(&devices_lock, flags);
539 
540         list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices, list) {
541                 struct lowpan_peer *pentry, *ptmp;
542                 struct lowpan_dev *dev;
543 
544                 if (entry->netdev != netdev)
545                         continue;
546 
547                 dev = lowpan_dev(entry->netdev);
548 
549                 list_for_each_entry_safe(pentry, ptmp, &dev->peers, list) {
550                         local_skb = skb_clone(skb, GFP_ATOMIC);
551 
552                         send_pkt(pentry->chan, local_skb, netdev);
553 
554                         kfree_skb(local_skb);
555                 }
556         }
557 
558         read_unlock_irqrestore(&devices_lock, flags);
559 }
560 
561 static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
562 {
563         int err = 0;
564         struct lowpan_dev *dev;
565         struct lowpan_peer *peer;
566         bdaddr_t addr;
567         u8 addr_type;
568 
569         if (ipv6_addr_is_multicast(&lowpan_cb(skb)->addr)) {
570                 /* We need to send the packet to every device
571                  * behind this interface.
572                  */
573                 send_mcast_pkt(skb, netdev);
574         } else {
575                 unsigned long flags;
576 
577                 convert_dest_bdaddr(&lowpan_cb(skb)->addr, &addr, &addr_type);
578                 dev = lowpan_dev(netdev);
579 
580                 read_lock_irqsave(&devices_lock, flags);
581                 peer = peer_lookup_ba(dev, &addr, addr_type);
582                 if (!peer)
583                         peer = peer_lookup_dst(dev, &lowpan_cb(skb)->addr, skb);
584                 read_unlock_irqrestore(&devices_lock, flags);
585 
586                 BT_DBG("xmit %s to %pMR type %d IP %pI6c peer %p",
587                        netdev->name, &addr, addr_type,
588                        &lowpan_cb(skb)->addr, peer);
589 
590                 if (peer && peer->chan)
591                         err = send_pkt(peer->chan, skb, netdev);
592                 else
593                         err = -ENOENT;
594         }
595         dev_kfree_skb(skb);
596 
597         if (err)
598                 BT_DBG("ERROR: xmit failed (%d)", err);
599 
600         return (err < 0) ? NET_XMIT_DROP : err;
601 }
602 
603 static const struct net_device_ops netdev_ops = {
604         .ndo_start_xmit         = bt_xmit,
605 };
606 
607 static struct header_ops header_ops = {
608         .create = header_create,
609 };
610 
611 static void netdev_setup(struct net_device *dev)
612 {
613         dev->addr_len           = EUI64_ADDR_LEN;
614         dev->type               = ARPHRD_6LOWPAN;
615 
616         dev->hard_header_len    = 0;
617         dev->needed_tailroom    = 0;
618         dev->mtu                = IPV6_MIN_MTU;
619         dev->tx_queue_len       = 0;
620         dev->flags              = IFF_RUNNING | IFF_POINTOPOINT;
621         dev->watchdog_timeo     = 0;
622 
623         dev->netdev_ops         = &netdev_ops;
624         dev->header_ops         = &header_ops;
625         dev->destructor         = free_netdev;
626 }
627 
628 static struct device_type bt_type = {
629         .name   = "bluetooth",
630 };
631 
632 static void set_addr(u8 *eui, u8 *addr, u8 addr_type)
633 {
634         /* addr is the BT address in little-endian format */
635         eui[0] = addr[5];
636         eui[1] = addr[4];
637         eui[2] = addr[3];
638         eui[3] = 0xFF;
639         eui[4] = 0xFE;
640         eui[5] = addr[2];
641         eui[6] = addr[1];
642         eui[7] = addr[0];
643 
644         /* Universal/local bit set, BT 6lowpan draft ch. 3.2.1 */
645         if (addr_type == BDADDR_LE_PUBLIC)
646                 eui[0] &= ~0x02;
647         else
648                 eui[0] |= 0x02;
649 
650         BT_DBG("type %d addr %*phC", addr_type, 8, eui);
651 }
652 
653 static void set_dev_addr(struct net_device *netdev, bdaddr_t *addr,
654                          u8 addr_type)
655 {
656         netdev->addr_assign_type = NET_ADDR_PERM;
657         set_addr(netdev->dev_addr, addr->b, addr_type);
658 }
659 
660 static void ifup(struct net_device *netdev)
661 {
662         int err;
663 
664         rtnl_lock();
665         err = dev_open(netdev);
666         if (err < 0)
667                 BT_INFO("iface %s cannot be opened (%d)", netdev->name, err);
668         rtnl_unlock();
669 }
670 
671 static void ifdown(struct net_device *netdev)
672 {
673         int err;
674 
675         rtnl_lock();
676         err = dev_close(netdev);
677         if (err < 0)
678                 BT_INFO("iface %s cannot be closed (%d)", netdev->name, err);
679         rtnl_unlock();
680 }
681 
682 static void do_notify_peers(struct work_struct *work)
683 {
684         struct lowpan_dev *dev = container_of(work, struct lowpan_dev,
685                                               notify_peers.work);
686 
687         netdev_notify_peers(dev->netdev); /* send neighbour adv at startup */
688 }
689 
690 static bool is_bt_6lowpan(struct hci_conn *hcon)
691 {
692         if (hcon->type != LE_LINK)
693                 return false;
694 
695         if (!psm_6lowpan)
696                 return false;
697 
698         return true;
699 }
700 
701 static struct l2cap_chan *chan_create(void)
702 {
703         struct l2cap_chan *chan;
704 
705         chan = l2cap_chan_create();
706         if (!chan)
707                 return NULL;
708 
709         l2cap_chan_set_defaults(chan);
710 
711         chan->chan_type = L2CAP_CHAN_CONN_ORIENTED;
712         chan->mode = L2CAP_MODE_LE_FLOWCTL;
713         chan->omtu = 65535;
714         chan->imtu = chan->omtu;
715 
716         return chan;
717 }
718 
719 static struct l2cap_chan *chan_open(struct l2cap_chan *pchan)
720 {
721         struct l2cap_chan *chan;
722 
723         chan = chan_create();
724         if (!chan)
725                 return NULL;
726 
727         chan->remote_mps = chan->omtu;
728         chan->mps = chan->omtu;
729 
730         chan->state = BT_CONNECTED;
731 
732         return chan;
733 }
734 
735 static void set_ip_addr_bits(u8 addr_type, u8 *addr)
736 {
737         if (addr_type == BDADDR_LE_PUBLIC)
738                 *addr |= 0x02;
739         else
740                 *addr &= ~0x02;
741 }
742 
743 static struct l2cap_chan *add_peer_chan(struct l2cap_chan *chan,
744                                         struct lowpan_dev *dev)
745 {
746         struct lowpan_peer *peer;
747         unsigned long flags;
748 
749         peer = kzalloc(sizeof(*peer), GFP_ATOMIC);
750         if (!peer)
751                 return NULL;
752 
753         peer->chan = chan;
754         memset(&peer->peer_addr, 0, sizeof(struct in6_addr));
755 
756         /* RFC 2464 ch. 5 */
757         peer->peer_addr.s6_addr[0] = 0xFE;
758         peer->peer_addr.s6_addr[1] = 0x80;
759         set_addr((u8 *)&peer->peer_addr.s6_addr + 8, chan->dst.b,
760                  chan->dst_type);
761 
762         memcpy(&peer->eui64_addr, (u8 *)&peer->peer_addr.s6_addr + 8,
763                EUI64_ADDR_LEN);
764 
765         /* IPv6 address needs to have the U/L bit set properly so toggle
766          * it back here.
767          */
768         set_ip_addr_bits(chan->dst_type, (u8 *)&peer->peer_addr.s6_addr + 8);
769 
770         write_lock_irqsave(&devices_lock, flags);
771         INIT_LIST_HEAD(&peer->list);
772         peer_add(dev, peer);
773         write_unlock_irqrestore(&devices_lock, flags);
774 
775         /* Notifying peers about us needs to be done without locks held */
776         INIT_DELAYED_WORK(&dev->notify_peers, do_notify_peers);
777         schedule_delayed_work(&dev->notify_peers, msecs_to_jiffies(100));
778 
779         return peer->chan;
780 }
781 
782 static int setup_netdev(struct l2cap_chan *chan, struct lowpan_dev **dev)
783 {
784         struct net_device *netdev;
785         int err = 0;
786         unsigned long flags;
787 
788         netdev = alloc_netdev(sizeof(struct lowpan_dev), IFACE_NAME_TEMPLATE,
789                               NET_NAME_UNKNOWN, netdev_setup);
790         if (!netdev)
791                 return -ENOMEM;
792 
793         set_dev_addr(netdev, &chan->src, chan->src_type);
794 
795         netdev->netdev_ops = &netdev_ops;
796         SET_NETDEV_DEV(netdev, &chan->conn->hcon->dev);
797         SET_NETDEV_DEVTYPE(netdev, &bt_type);
798 
799         err = register_netdev(netdev);
800         if (err < 0) {
801                 BT_INFO("register_netdev failed %d", err);
802                 free_netdev(netdev);
803                 goto out;
804         }
805 
806         BT_DBG("ifindex %d peer bdaddr %pMR type %d my addr %pMR type %d",
807                netdev->ifindex, &chan->dst, chan->dst_type,
808                &chan->src, chan->src_type);
809         set_bit(__LINK_STATE_PRESENT, &netdev->state);
810 
811         *dev = netdev_priv(netdev);
812         (*dev)->netdev = netdev;
813         (*dev)->hdev = chan->conn->hcon->hdev;
814         INIT_LIST_HEAD(&(*dev)->peers);
815 
816         write_lock_irqsave(&devices_lock, flags);
817         INIT_LIST_HEAD(&(*dev)->list);
818         list_add(&(*dev)->list, &bt_6lowpan_devices);
819         write_unlock_irqrestore(&devices_lock, flags);
820 
821         return 0;
822 
823 out:
824         return err;
825 }
826 
827 static inline void chan_ready_cb(struct l2cap_chan *chan)
828 {
829         struct lowpan_dev *dev;
830 
831         dev = lookup_dev(chan->conn);
832 
833         BT_DBG("chan %p conn %p dev %p", chan, chan->conn, dev);
834 
835         if (!dev) {
836                 if (setup_netdev(chan, &dev) < 0) {
837                         l2cap_chan_del(chan, -ENOENT);
838                         return;
839                 }
840         }
841 
842         if (!try_module_get(THIS_MODULE))
843                 return;
844 
845         add_peer_chan(chan, dev);
846         ifup(dev->netdev);
847 }
848 
849 static inline struct l2cap_chan *chan_new_conn_cb(struct l2cap_chan *chan)
850 {
851         struct l2cap_chan *pchan;
852 
853         pchan = chan_open(chan);
854         pchan->ops = chan->ops;
855 
856         BT_DBG("chan %p pchan %p", chan, pchan);
857 
858         return pchan;
859 }
860 
861 static void delete_netdev(struct work_struct *work)
862 {
863         struct lowpan_dev *entry = container_of(work, struct lowpan_dev,
864                                                 delete_netdev);
865 
866         unregister_netdev(entry->netdev);
867 
868         /* The entry pointer is deleted in device_event() */
869 }
870 
871 static void chan_close_cb(struct l2cap_chan *chan)
872 {
873         struct lowpan_dev *entry, *tmp;
874         struct lowpan_dev *dev = NULL;
875         struct lowpan_peer *peer;
876         int err = -ENOENT;
877         unsigned long flags;
878         bool last = false, removed = true;
879 
880         BT_DBG("chan %p conn %p", chan, chan->conn);
881 
882         if (chan->conn && chan->conn->hcon) {
883                 if (!is_bt_6lowpan(chan->conn->hcon))
884                         return;
885 
886                 /* If conn is set, then the netdev is also there and we should
887                  * not remove it.
888                  */
889                 removed = false;
890         }
891 
892         write_lock_irqsave(&devices_lock, flags);
893 
894         list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices, list) {
895                 dev = lowpan_dev(entry->netdev);
896                 peer = peer_lookup_chan(dev, chan);
897                 if (peer) {
898                         last = peer_del(dev, peer);
899                         err = 0;
900 
901                         BT_DBG("dev %p removing %speer %p", dev,
902                                last ? "last " : "1 ", peer);
903                         BT_DBG("chan %p orig refcnt %d", chan,
904                                atomic_read(&chan->kref.refcount));
905 
906                         l2cap_chan_put(chan);
907                         kfree(peer);
908                         break;
909                 }
910         }
911 
912         if (!err && last && dev && !atomic_read(&dev->peer_count)) {
913                 write_unlock_irqrestore(&devices_lock, flags);
914 
915                 cancel_delayed_work_sync(&dev->notify_peers);
916 
917                 ifdown(dev->netdev);
918 
919                 if (!removed) {
920                         INIT_WORK(&entry->delete_netdev, delete_netdev);
921                         schedule_work(&entry->delete_netdev);
922                 }
923         } else {
924                 write_unlock_irqrestore(&devices_lock, flags);
925         }
926 
927         return;
928 }
929 
930 static void chan_state_change_cb(struct l2cap_chan *chan, int state, int err)
931 {
932         BT_DBG("chan %p conn %p state %s err %d", chan, chan->conn,
933                state_to_string(state), err);
934 }
935 
936 static struct sk_buff *chan_alloc_skb_cb(struct l2cap_chan *chan,
937                                          unsigned long hdr_len,
938                                          unsigned long len, int nb)
939 {
940         /* Note that we must allocate using GFP_ATOMIC here as
941          * this function is called originally from netdev hard xmit
942          * function in atomic context.
943          */
944         return bt_skb_alloc(hdr_len + len, GFP_ATOMIC);
945 }
946 
947 static void chan_suspend_cb(struct l2cap_chan *chan)
948 {
949         struct sk_buff *skb = chan->data;
950 
951         BT_DBG("chan %p conn %p skb %p", chan, chan->conn, skb);
952 
953         lowpan_cb(skb)->status = -EAGAIN;
954 }
955 
956 static void chan_resume_cb(struct l2cap_chan *chan)
957 {
958         struct sk_buff *skb = chan->data;
959 
960         BT_DBG("chan %p conn %p skb %p", chan, chan->conn, skb);
961 
962         lowpan_cb(skb)->status = 0;
963 }
964 
965 static long chan_get_sndtimeo_cb(struct l2cap_chan *chan)
966 {
967         return L2CAP_CONN_TIMEOUT;
968 }
969 
970 static const struct l2cap_ops bt_6lowpan_chan_ops = {
971         .name                   = "L2CAP 6LoWPAN channel",
972         .new_connection         = chan_new_conn_cb,
973         .recv                   = chan_recv_cb,
974         .close                  = chan_close_cb,
975         .state_change           = chan_state_change_cb,
976         .ready                  = chan_ready_cb,
977         .resume                 = chan_resume_cb,
978         .suspend                = chan_suspend_cb,
979         .get_sndtimeo           = chan_get_sndtimeo_cb,
980         .alloc_skb              = chan_alloc_skb_cb,
981         .memcpy_fromiovec       = l2cap_chan_no_memcpy_fromiovec,
982 
983         .teardown               = l2cap_chan_no_teardown,
984         .defer                  = l2cap_chan_no_defer,
985         .set_shutdown           = l2cap_chan_no_set_shutdown,
986 };
987 
988 static inline __u8 bdaddr_type(__u8 type)
989 {
990         if (type == ADDR_LE_DEV_PUBLIC)
991                 return BDADDR_LE_PUBLIC;
992         else
993                 return BDADDR_LE_RANDOM;
994 }
995 
996 static struct l2cap_chan *chan_get(void)
997 {
998         struct l2cap_chan *pchan;
999 
1000         pchan = chan_create();
1001         if (!pchan)
1002                 return NULL;
1003 
1004         pchan->ops = &bt_6lowpan_chan_ops;
1005 
1006         return pchan;
1007 }
1008 
1009 static int bt_6lowpan_connect(bdaddr_t *addr, u8 dst_type)
1010 {
1011         struct l2cap_chan *pchan;
1012         int err;
1013 
1014         pchan = chan_get();
1015         if (!pchan)
1016                 return -EINVAL;
1017 
1018         err = l2cap_chan_connect(pchan, cpu_to_le16(psm_6lowpan), 0,
1019                                  addr, dst_type);
1020 
1021         BT_DBG("chan %p err %d", pchan, err);
1022         if (err < 0)
1023                 l2cap_chan_put(pchan);
1024 
1025         return err;
1026 }
1027 
1028 static int bt_6lowpan_disconnect(struct l2cap_conn *conn, u8 dst_type)
1029 {
1030         struct lowpan_peer *peer;
1031 
1032         BT_DBG("conn %p dst type %d", conn, dst_type);
1033 
1034         peer = lookup_peer(conn);
1035         if (!peer)
1036                 return -ENOENT;
1037 
1038         BT_DBG("peer %p chan %p", peer, peer->chan);
1039 
1040         l2cap_chan_close(peer->chan, ENOENT);
1041 
1042         return 0;
1043 }
1044 
1045 static struct l2cap_chan *bt_6lowpan_listen(void)
1046 {
1047         bdaddr_t *addr = BDADDR_ANY;
1048         struct l2cap_chan *pchan;
1049         int err;
1050 
1051         if (psm_6lowpan == 0)
1052                 return NULL;
1053 
1054         pchan = chan_get();
1055         if (!pchan)
1056                 return NULL;
1057 
1058         pchan->state = BT_LISTEN;
1059         pchan->src_type = BDADDR_LE_PUBLIC;
1060 
1061         BT_DBG("psm 0x%04x chan %p src type %d", psm_6lowpan, pchan,
1062                pchan->src_type);
1063 
1064         err = l2cap_add_psm(pchan, addr, cpu_to_le16(psm_6lowpan));
1065         if (err) {
1066                 l2cap_chan_put(pchan);
1067                 BT_ERR("psm cannot be added err %d", err);
1068                 return NULL;
1069         }
1070 
1071         return pchan;
1072 }
1073 
1074 static int get_l2cap_conn(char *buf, bdaddr_t *addr, u8 *addr_type,
1075                           struct l2cap_conn **conn)
1076 {
1077         struct hci_conn *hcon;
1078         struct hci_dev *hdev;
1079         bdaddr_t *src = BDADDR_ANY;
1080         int n;
1081 
1082         n = sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx %hhu",
1083                    &addr->b[5], &addr->b[4], &addr->b[3],
1084                    &addr->b[2], &addr->b[1], &addr->b[0],
1085                    addr_type);
1086 
1087         if (n < 7)
1088                 return -EINVAL;
1089 
1090         hdev = hci_get_route(addr, src);
1091         if (!hdev)
1092                 return -ENOENT;
1093 
1094         hci_dev_lock(hdev);
1095         hcon = hci_conn_hash_lookup_ba(hdev, LE_LINK, addr);
1096         hci_dev_unlock(hdev);
1097 
1098         if (!hcon)
1099                 return -ENOENT;
1100 
1101         *conn = (struct l2cap_conn *)hcon->l2cap_data;
1102 
1103         BT_DBG("conn %p dst %pMR type %d", *conn, &hcon->dst, hcon->dst_type);
1104 
1105         return 0;
1106 }
1107 
1108 static void disconnect_all_peers(void)
1109 {
1110         struct lowpan_dev *entry, *tmp_dev;
1111         struct lowpan_peer *peer, *tmp_peer, *new_peer;
1112         struct list_head peers;
1113         unsigned long flags;
1114 
1115         INIT_LIST_HEAD(&peers);
1116 
1117         /* We make a separate list of peers as the close_cb() will
1118          * modify the device peers list so it is better not to mess
1119          * with the same list at the same time.
1120          */
1121 
1122         read_lock_irqsave(&devices_lock, flags);
1123 
1124         list_for_each_entry_safe(entry, tmp_dev, &bt_6lowpan_devices, list) {
1125                 list_for_each_entry_safe(peer, tmp_peer, &entry->peers, list) {
1126                         new_peer = kmalloc(sizeof(*new_peer), GFP_ATOMIC);
1127                         if (!new_peer)
1128                                 break;
1129 
1130                         new_peer->chan = peer->chan;
1131                         INIT_LIST_HEAD(&new_peer->list);
1132 
1133                         list_add(&new_peer->list, &peers);
1134                 }
1135         }
1136 
1137         read_unlock_irqrestore(&devices_lock, flags);
1138 
1139         list_for_each_entry_safe(peer, tmp_peer, &peers, list) {
1140                 l2cap_chan_close(peer->chan, ENOENT);
1141                 kfree(peer);
1142         }
1143 }
1144 
1145 static int lowpan_psm_set(void *data, u64 val)
1146 {
1147         u16 psm;
1148 
1149         psm = val;
1150         if (psm == 0 || psm_6lowpan != psm)
1151                 /* Disconnect existing connections if 6lowpan is
1152                  * disabled (psm = 0), or if psm changes.
1153                  */
1154                 disconnect_all_peers();
1155 
1156         psm_6lowpan = psm;
1157 
1158         if (listen_chan) {
1159                 l2cap_chan_close(listen_chan, 0);
1160                 l2cap_chan_put(listen_chan);
1161         }
1162 
1163         listen_chan = bt_6lowpan_listen();
1164 
1165         return 0;
1166 }
1167 
1168 static int lowpan_psm_get(void *data, u64 *val)
1169 {
1170         *val = psm_6lowpan;
1171         return 0;
1172 }
1173 
1174 DEFINE_SIMPLE_ATTRIBUTE(lowpan_psm_fops, lowpan_psm_get,
1175                         lowpan_psm_set, "%llu\n");
1176 
1177 static ssize_t lowpan_control_write(struct file *fp,
1178                                     const char __user *user_buffer,
1179                                     size_t count,
1180                                     loff_t *position)
1181 {
1182         char buf[32];
1183         size_t buf_size = min(count, sizeof(buf) - 1);
1184         int ret;
1185         bdaddr_t addr;
1186         u8 addr_type;
1187         struct l2cap_conn *conn = NULL;
1188 
1189         if (copy_from_user(buf, user_buffer, buf_size))
1190                 return -EFAULT;
1191 
1192         buf[buf_size] = '\0';
1193 
1194         if (memcmp(buf, "connect ", 8) == 0) {
1195                 ret = get_l2cap_conn(&buf[8], &addr, &addr_type, &conn);
1196                 if (ret == -EINVAL)
1197                         return ret;
1198 
1199                 if (listen_chan) {
1200                         l2cap_chan_close(listen_chan, 0);
1201                         l2cap_chan_put(listen_chan);
1202                         listen_chan = NULL;
1203                 }
1204 
1205                 if (conn) {
1206                         struct lowpan_peer *peer;
1207 
1208                         if (!is_bt_6lowpan(conn->hcon))
1209                                 return -EINVAL;
1210 
1211                         peer = lookup_peer(conn);
1212                         if (peer) {
1213                                 BT_DBG("6LoWPAN connection already exists");
1214                                 return -EALREADY;
1215                         }
1216 
1217                         BT_DBG("conn %p dst %pMR type %d user %d", conn,
1218                                &conn->hcon->dst, conn->hcon->dst_type,
1219                                addr_type);
1220                 }
1221 
1222                 ret = bt_6lowpan_connect(&addr, addr_type);
1223                 if (ret < 0)
1224                         return ret;
1225 
1226                 return count;
1227         }
1228 
1229         if (memcmp(buf, "disconnect ", 11) == 0) {
1230                 ret = get_l2cap_conn(&buf[11], &addr, &addr_type, &conn);
1231                 if (ret < 0)
1232                         return ret;
1233 
1234                 ret = bt_6lowpan_disconnect(conn, addr_type);
1235                 if (ret < 0)
1236                         return ret;
1237 
1238                 return count;
1239         }
1240 
1241         return count;
1242 }
1243 
1244 static int lowpan_control_show(struct seq_file *f, void *ptr)
1245 {
1246         struct lowpan_dev *entry, *tmp_dev;
1247         struct lowpan_peer *peer, *tmp_peer;
1248         unsigned long flags;
1249 
1250         read_lock_irqsave(&devices_lock, flags);
1251 
1252         list_for_each_entry_safe(entry, tmp_dev, &bt_6lowpan_devices, list) {
1253                 list_for_each_entry_safe(peer, tmp_peer, &entry->peers, list)
1254                         seq_printf(f, "%pMR (type %u)\n",
1255                                    &peer->chan->dst, peer->chan->dst_type);
1256         }
1257 
1258         read_unlock_irqrestore(&devices_lock, flags);
1259 
1260         return 0;
1261 }
1262 
1263 static int lowpan_control_open(struct inode *inode, struct file *file)
1264 {
1265         return single_open(file, lowpan_control_show, inode->i_private);
1266 }
1267 
1268 static const struct file_operations lowpan_control_fops = {
1269         .open           = lowpan_control_open,
1270         .read           = seq_read,
1271         .write          = lowpan_control_write,
1272         .llseek         = seq_lseek,
1273         .release        = single_release,
1274 };
1275 
1276 static void disconnect_devices(void)
1277 {
1278         struct lowpan_dev *entry, *tmp, *new_dev;
1279         struct list_head devices;
1280         unsigned long flags;
1281 
1282         INIT_LIST_HEAD(&devices);
1283 
1284         /* We make a separate list of devices because the unregister_netdev()
1285          * will call device_event() which will also want to modify the same
1286          * devices list.
1287          */
1288 
1289         read_lock_irqsave(&devices_lock, flags);
1290 
1291         list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices, list) {
1292                 new_dev = kmalloc(sizeof(*new_dev), GFP_ATOMIC);
1293                 if (!new_dev)
1294                         break;
1295 
1296                 new_dev->netdev = entry->netdev;
1297                 INIT_LIST_HEAD(&new_dev->list);
1298 
1299                 list_add(&new_dev->list, &devices);
1300         }
1301 
1302         read_unlock_irqrestore(&devices_lock, flags);
1303 
1304         list_for_each_entry_safe(entry, tmp, &devices, list) {
1305                 ifdown(entry->netdev);
1306                 BT_DBG("Unregistering netdev %s %p",
1307                        entry->netdev->name, entry->netdev);
1308                 unregister_netdev(entry->netdev);
1309                 kfree(entry);
1310         }
1311 }
1312 
1313 static int device_event(struct notifier_block *unused,
1314                         unsigned long event, void *ptr)
1315 {
1316         struct net_device *netdev = netdev_notifier_info_to_dev(ptr);
1317         struct lowpan_dev *entry, *tmp;
1318         unsigned long flags;
1319 
1320         if (netdev->type != ARPHRD_6LOWPAN)
1321                 return NOTIFY_DONE;
1322 
1323         switch (event) {
1324         case NETDEV_UNREGISTER:
1325                 write_lock_irqsave(&devices_lock, flags);
1326                 list_for_each_entry_safe(entry, tmp, &bt_6lowpan_devices,
1327                                          list) {
1328                         if (entry->netdev == netdev) {
1329                                 BT_DBG("Unregistered netdev %s %p",
1330                                        netdev->name, netdev);
1331                                 list_del(&entry->list);
1332                                 kfree(entry);
1333                                 break;
1334                         }
1335                 }
1336                 write_unlock_irqrestore(&devices_lock, flags);
1337                 break;
1338         }
1339 
1340         return NOTIFY_DONE;
1341 }
1342 
1343 static struct notifier_block bt_6lowpan_dev_notifier = {
1344         .notifier_call = device_event,
1345 };
1346 
1347 static int __init bt_6lowpan_init(void)
1348 {
1349         lowpan_psm_debugfs = debugfs_create_file("6lowpan_psm", 0644,
1350                                                  bt_debugfs, NULL,
1351                                                  &lowpan_psm_fops);
1352         lowpan_control_debugfs = debugfs_create_file("6lowpan_control", 0644,
1353                                                      bt_debugfs, NULL,
1354                                                      &lowpan_control_fops);
1355 
1356         return register_netdevice_notifier(&bt_6lowpan_dev_notifier);
1357 }
1358 
1359 static void __exit bt_6lowpan_exit(void)
1360 {
1361         debugfs_remove(lowpan_psm_debugfs);
1362         debugfs_remove(lowpan_control_debugfs);
1363 
1364         if (listen_chan) {
1365                 l2cap_chan_close(listen_chan, 0);
1366                 l2cap_chan_put(listen_chan);
1367         }
1368 
1369         disconnect_devices();
1370 
1371         unregister_netdevice_notifier(&bt_6lowpan_dev_notifier);
1372 }
1373 
1374 module_init(bt_6lowpan_init);
1375 module_exit(bt_6lowpan_exit);
1376 
1377 MODULE_AUTHOR("Jukka Rissanen <jukka.rissanen@linux.intel.com>");
1378 MODULE_DESCRIPTION("Bluetooth 6LoWPAN");
1379 MODULE_VERSION(VERSION);
1380 MODULE_LICENSE("GPL");
1381 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp