2 * IEEE802154.4 socket interface
4 * Copyright 2007, 2008 Siemens AG
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 * Sergey Lapin <slapin@ossfans.org>
17 * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
20 #include <linux/net.h>
21 #include <linux/capability.h>
22 #include <linux/module.h>
23 #include <linux/if_arp.h>
25 #include <linux/termios.h> /* For TIOCOUTQ/INQ */
26 #include <linux/list.h>
27 #include <linux/slab.h>
28 #include <net/datalink.h>
29 #include <net/psnap.h>
31 #include <net/tcp_states.h>
32 #include <net/route.h>
34 #include <net/af_ieee802154.h>
35 #include <net/ieee802154_netdev.h>
37 /* Utility function for families */
38 static struct net_device*
39 ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr)
41 struct net_device *dev = NULL;
42 struct net_device *tmp;
43 __le16 pan_id, short_addr;
44 u8 hwaddr[IEEE802154_ADDR_LEN];
47 case IEEE802154_ADDR_LONG:
48 ieee802154_devaddr_to_raw(hwaddr, addr->extended_addr);
50 dev = dev_getbyhwaddr_rcu(net, ARPHRD_IEEE802154, hwaddr);
55 case IEEE802154_ADDR_SHORT:
56 if (addr->pan_id == cpu_to_le16(IEEE802154_PANID_BROADCAST) ||
57 addr->short_addr == cpu_to_le16(IEEE802154_ADDR_UNDEF) ||
58 addr->short_addr == cpu_to_le16(IEEE802154_ADDR_BROADCAST))
63 for_each_netdev(net, tmp) {
64 if (tmp->type != ARPHRD_IEEE802154)
67 pan_id = tmp->ieee802154_ptr->pan_id;
68 short_addr = tmp->ieee802154_ptr->short_addr;
69 if (pan_id == addr->pan_id &&
70 short_addr == addr->short_addr) {
80 pr_warn("Unsupported ieee802154 address type: %d\n",
88 static int ieee802154_sock_release(struct socket *sock)
90 struct sock *sk = sock->sk;
94 sk->sk_prot->close(sk, 0);
99 static int ieee802154_sock_sendmsg(struct socket *sock, struct msghdr *msg,
102 struct sock *sk = sock->sk;
104 return sk->sk_prot->sendmsg(sk, msg, len);
107 static int ieee802154_sock_bind(struct socket *sock, struct sockaddr *uaddr,
110 struct sock *sk = sock->sk;
112 if (sk->sk_prot->bind)
113 return sk->sk_prot->bind(sk, uaddr, addr_len);
115 return sock_no_bind(sock, uaddr, addr_len);
118 static int ieee802154_sock_connect(struct socket *sock, struct sockaddr *uaddr,
119 int addr_len, int flags)
121 struct sock *sk = sock->sk;
123 if (addr_len < sizeof(uaddr->sa_family))
126 if (uaddr->sa_family == AF_UNSPEC)
127 return sk->sk_prot->disconnect(sk, flags);
129 return sk->sk_prot->connect(sk, uaddr, addr_len);
132 static int ieee802154_dev_ioctl(struct sock *sk, struct ifreq __user *arg,
136 int ret = -ENOIOCTLCMD;
137 struct net_device *dev;
139 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
142 ifr.ifr_name[IFNAMSIZ-1] = 0;
144 dev_load(sock_net(sk), ifr.ifr_name);
145 dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
150 if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl)
151 ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
153 if (!ret && copy_to_user(arg, &ifr, sizeof(struct ifreq)))
160 static int ieee802154_sock_ioctl(struct socket *sock, unsigned int cmd,
163 struct sock *sk = sock->sk;
167 return sock_get_timestamp(sk, (struct timeval __user *)arg);
169 return sock_get_timestampns(sk, (struct timespec __user *)arg);
172 return ieee802154_dev_ioctl(sk, (struct ifreq __user *)arg,
175 if (!sk->sk_prot->ioctl)
177 return sk->sk_prot->ioctl(sk, cmd, arg);
181 /* RAW Sockets (802.15.4 created in userspace) */
182 static HLIST_HEAD(raw_head);
183 static DEFINE_RWLOCK(raw_lock);
185 static int raw_hash(struct sock *sk)
187 write_lock_bh(&raw_lock);
188 sk_add_node(sk, &raw_head);
189 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
190 write_unlock_bh(&raw_lock);
195 static void raw_unhash(struct sock *sk)
197 write_lock_bh(&raw_lock);
198 if (sk_del_node_init(sk))
199 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
200 write_unlock_bh(&raw_lock);
203 static void raw_close(struct sock *sk, long timeout)
205 sk_common_release(sk);
208 static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len)
210 struct ieee802154_addr addr;
211 struct sockaddr_ieee802154 *uaddr = (struct sockaddr_ieee802154 *)_uaddr;
213 struct net_device *dev = NULL;
215 if (len < sizeof(*uaddr))
218 uaddr = (struct sockaddr_ieee802154 *)_uaddr;
219 if (uaddr->family != AF_IEEE802154)
224 ieee802154_addr_from_sa(&addr, &uaddr->addr);
225 dev = ieee802154_get_dev(sock_net(sk), &addr);
231 sk->sk_bound_dev_if = dev->ifindex;
241 static int raw_connect(struct sock *sk, struct sockaddr *uaddr,
247 static int raw_disconnect(struct sock *sk, int flags)
252 static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
254 struct net_device *dev;
260 if (msg->msg_flags & MSG_OOB) {
261 pr_debug("msg->msg_flags = 0x%x\n", msg->msg_flags);
266 if (!sk->sk_bound_dev_if)
267 dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154);
269 dev = dev_get_by_index(sock_net(sk), sk->sk_bound_dev_if);
273 pr_debug("no dev\n");
278 mtu = IEEE802154_MTU;
279 pr_debug("name = %s, mtu = %u\n", dev->name, mtu);
282 pr_debug("size = %Zu, mtu = %u\n", size, mtu);
287 hlen = LL_RESERVED_SPACE(dev);
288 tlen = dev->needed_tailroom;
289 skb = sock_alloc_send_skb(sk, hlen + tlen + size,
290 msg->msg_flags & MSG_DONTWAIT, &err);
294 skb_reserve(skb, hlen);
296 skb_reset_mac_header(skb);
297 skb_reset_network_header(skb);
299 err = memcpy_from_msg(skb_put(skb, size), msg, size);
305 skb->protocol = htons(ETH_P_IEEE802154);
309 err = dev_queue_xmit(skb);
311 err = net_xmit_errno(err);
323 static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
324 int noblock, int flags, int *addr_len)
327 int err = -EOPNOTSUPP;
330 skb = skb_recv_datagram(sk, flags, noblock, &err);
336 msg->msg_flags |= MSG_TRUNC;
340 err = skb_copy_datagram_msg(skb, 0, msg, copied);
344 sock_recv_ts_and_drops(msg, sk, skb);
346 if (flags & MSG_TRUNC)
349 skb_free_datagram(sk, skb);
356 static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb)
358 skb = skb_share_check(skb, GFP_ATOMIC);
362 if (sock_queue_rcv_skb(sk, skb) < 0) {
367 return NET_RX_SUCCESS;
370 static void ieee802154_raw_deliver(struct net_device *dev, struct sk_buff *skb)
374 read_lock(&raw_lock);
375 sk_for_each(sk, &raw_head) {
377 if (!sk->sk_bound_dev_if ||
378 sk->sk_bound_dev_if == dev->ifindex) {
379 struct sk_buff *clone;
381 clone = skb_clone(skb, GFP_ATOMIC);
383 raw_rcv_skb(sk, clone);
387 read_unlock(&raw_lock);
390 static int raw_getsockopt(struct sock *sk, int level, int optname,
391 char __user *optval, int __user *optlen)
396 static int raw_setsockopt(struct sock *sk, int level, int optname,
397 char __user *optval, unsigned int optlen)
402 static struct proto ieee802154_raw_prot = {
403 .name = "IEEE-802.15.4-RAW",
404 .owner = THIS_MODULE,
405 .obj_size = sizeof(struct sock),
408 .sendmsg = raw_sendmsg,
409 .recvmsg = raw_recvmsg,
411 .unhash = raw_unhash,
412 .connect = raw_connect,
413 .disconnect = raw_disconnect,
414 .getsockopt = raw_getsockopt,
415 .setsockopt = raw_setsockopt,
418 static const struct proto_ops ieee802154_raw_ops = {
419 .family = PF_IEEE802154,
420 .owner = THIS_MODULE,
421 .release = ieee802154_sock_release,
422 .bind = ieee802154_sock_bind,
423 .connect = ieee802154_sock_connect,
424 .socketpair = sock_no_socketpair,
425 .accept = sock_no_accept,
426 .getname = sock_no_getname,
427 .poll = datagram_poll,
428 .ioctl = ieee802154_sock_ioctl,
429 .listen = sock_no_listen,
430 .shutdown = sock_no_shutdown,
431 .setsockopt = sock_common_setsockopt,
432 .getsockopt = sock_common_getsockopt,
433 .sendmsg = ieee802154_sock_sendmsg,
434 .recvmsg = sock_common_recvmsg,
435 .mmap = sock_no_mmap,
436 .sendpage = sock_no_sendpage,
438 .compat_setsockopt = compat_sock_common_setsockopt,
439 .compat_getsockopt = compat_sock_common_getsockopt,
443 /* DGRAM Sockets (802.15.4 dataframes) */
444 static HLIST_HEAD(dgram_head);
445 static DEFINE_RWLOCK(dgram_lock);
450 struct ieee802154_addr src_addr;
451 struct ieee802154_addr dst_addr;
453 unsigned int bound:1;
454 unsigned int connected:1;
455 unsigned int want_ack:1;
456 unsigned int secen:1;
457 unsigned int secen_override:1;
458 unsigned int seclevel:3;
459 unsigned int seclevel_override:1;
462 static inline struct dgram_sock *dgram_sk(const struct sock *sk)
464 return container_of(sk, struct dgram_sock, sk);
467 static int dgram_hash(struct sock *sk)
469 write_lock_bh(&dgram_lock);
470 sk_add_node(sk, &dgram_head);
471 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1);
472 write_unlock_bh(&dgram_lock);
477 static void dgram_unhash(struct sock *sk)
479 write_lock_bh(&dgram_lock);
480 if (sk_del_node_init(sk))
481 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
482 write_unlock_bh(&dgram_lock);
485 static int dgram_init(struct sock *sk)
487 struct dgram_sock *ro = dgram_sk(sk);
493 static void dgram_close(struct sock *sk, long timeout)
495 sk_common_release(sk);
498 static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
500 struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr;
501 struct ieee802154_addr haddr;
502 struct dgram_sock *ro = dgram_sk(sk);
504 struct net_device *dev;
510 if (len < sizeof(*addr))
513 if (addr->family != AF_IEEE802154)
516 ieee802154_addr_from_sa(&haddr, &addr->addr);
517 dev = ieee802154_get_dev(sock_net(sk), &haddr);
523 if (dev->type != ARPHRD_IEEE802154) {
528 ro->src_addr = haddr;
540 static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg)
545 int amount = sk_wmem_alloc_get(sk);
547 return put_user(amount, (int __user *)arg);
553 unsigned long amount;
556 spin_lock_bh(&sk->sk_receive_queue.lock);
557 skb = skb_peek(&sk->sk_receive_queue);
559 /* We will only return the amount
560 * of this packet since that is all
563 amount = skb->len - ieee802154_hdr_length(skb);
565 spin_unlock_bh(&sk->sk_receive_queue.lock);
566 return put_user(amount, (int __user *)arg);
573 /* FIXME: autobind */
574 static int dgram_connect(struct sock *sk, struct sockaddr *uaddr,
577 struct sockaddr_ieee802154 *addr = (struct sockaddr_ieee802154 *)uaddr;
578 struct dgram_sock *ro = dgram_sk(sk);
581 if (len < sizeof(*addr))
584 if (addr->family != AF_IEEE802154)
594 ieee802154_addr_from_sa(&ro->dst_addr, &addr->addr);
602 static int dgram_disconnect(struct sock *sk, int flags)
604 struct dgram_sock *ro = dgram_sk(sk);
613 static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
615 struct net_device *dev;
618 struct ieee802154_mac_cb *cb;
619 struct dgram_sock *ro = dgram_sk(sk);
620 struct ieee802154_addr dst_addr;
624 if (msg->msg_flags & MSG_OOB) {
625 pr_debug("msg->msg_flags = 0x%x\n", msg->msg_flags);
629 if (!ro->connected && !msg->msg_name)
630 return -EDESTADDRREQ;
631 else if (ro->connected && msg->msg_name)
635 dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154);
637 dev = ieee802154_get_dev(sock_net(sk), &ro->src_addr);
640 pr_debug("no dev\n");
644 mtu = IEEE802154_MTU;
645 pr_debug("name = %s, mtu = %u\n", dev->name, mtu);
648 pr_debug("size = %Zu, mtu = %u\n", size, mtu);
653 hlen = LL_RESERVED_SPACE(dev);
654 tlen = dev->needed_tailroom;
655 skb = sock_alloc_send_skb(sk, hlen + tlen + size,
656 msg->msg_flags & MSG_DONTWAIT,
661 skb_reserve(skb, hlen);
663 skb_reset_network_header(skb);
665 cb = mac_cb_init(skb);
666 cb->type = IEEE802154_FC_TYPE_DATA;
667 cb->ackreq = ro->want_ack;
670 DECLARE_SOCKADDR(struct sockaddr_ieee802154*,
671 daddr, msg->msg_name);
673 ieee802154_addr_from_sa(&dst_addr, &daddr->addr);
675 dst_addr = ro->dst_addr;
678 cb->secen = ro->secen;
679 cb->secen_override = ro->secen_override;
680 cb->seclevel = ro->seclevel;
681 cb->seclevel_override = ro->seclevel_override;
683 err = wpan_dev_hard_header(skb, dev, &dst_addr,
684 ro->bound ? &ro->src_addr : NULL, size);
688 err = memcpy_from_msg(skb_put(skb, size), msg, size);
694 skb->protocol = htons(ETH_P_IEEE802154);
698 err = dev_queue_xmit(skb);
700 err = net_xmit_errno(err);
712 static int dgram_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
713 int noblock, int flags, int *addr_len)
716 int err = -EOPNOTSUPP;
718 DECLARE_SOCKADDR(struct sockaddr_ieee802154 *, saddr, msg->msg_name);
720 skb = skb_recv_datagram(sk, flags, noblock, &err);
726 msg->msg_flags |= MSG_TRUNC;
730 /* FIXME: skip headers if necessary ?! */
731 err = skb_copy_datagram_msg(skb, 0, msg, copied);
735 sock_recv_ts_and_drops(msg, sk, skb);
738 /* Clear the implicit padding in struct sockaddr_ieee802154
739 * (16 bits between 'family' and 'addr') and in struct
740 * ieee802154_addr_sa (16 bits at the end of the structure).
742 memset(saddr, 0, sizeof(*saddr));
744 saddr->family = AF_IEEE802154;
745 ieee802154_addr_to_sa(&saddr->addr, &mac_cb(skb)->source);
746 *addr_len = sizeof(*saddr);
749 if (flags & MSG_TRUNC)
752 skb_free_datagram(sk, skb);
759 static int dgram_rcv_skb(struct sock *sk, struct sk_buff *skb)
761 skb = skb_share_check(skb, GFP_ATOMIC);
765 if (sock_queue_rcv_skb(sk, skb) < 0) {
770 return NET_RX_SUCCESS;
774 ieee802154_match_sock(__le64 hw_addr, __le16 pan_id, __le16 short_addr,
775 struct dgram_sock *ro)
780 if (ro->src_addr.mode == IEEE802154_ADDR_LONG &&
781 hw_addr == ro->src_addr.extended_addr)
784 if (ro->src_addr.mode == IEEE802154_ADDR_SHORT &&
785 pan_id == ro->src_addr.pan_id &&
786 short_addr == ro->src_addr.short_addr)
792 static int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
794 struct sock *sk, *prev = NULL;
795 int ret = NET_RX_SUCCESS;
796 __le16 pan_id, short_addr;
799 /* Data frame processing */
800 BUG_ON(dev->type != ARPHRD_IEEE802154);
802 pan_id = dev->ieee802154_ptr->pan_id;
803 short_addr = dev->ieee802154_ptr->short_addr;
804 hw_addr = dev->ieee802154_ptr->extended_addr;
806 read_lock(&dgram_lock);
807 sk_for_each(sk, &dgram_head) {
808 if (ieee802154_match_sock(hw_addr, pan_id, short_addr,
811 struct sk_buff *clone;
813 clone = skb_clone(skb, GFP_ATOMIC);
815 dgram_rcv_skb(prev, clone);
823 dgram_rcv_skb(prev, skb);
828 read_unlock(&dgram_lock);
833 static int dgram_getsockopt(struct sock *sk, int level, int optname,
834 char __user *optval, int __user *optlen)
836 struct dgram_sock *ro = dgram_sk(sk);
840 if (level != SOL_IEEE802154)
843 if (get_user(len, optlen))
846 len = min_t(unsigned int, len, sizeof(int));
853 if (!ro->secen_override)
854 val = WPAN_SECURITY_DEFAULT;
856 val = WPAN_SECURITY_ON;
858 val = WPAN_SECURITY_OFF;
860 case WPAN_SECURITY_LEVEL:
861 if (!ro->seclevel_override)
862 val = WPAN_SECURITY_LEVEL_DEFAULT;
870 if (put_user(len, optlen))
872 if (copy_to_user(optval, &val, len))
877 static int dgram_setsockopt(struct sock *sk, int level, int optname,
878 char __user *optval, unsigned int optlen)
880 struct dgram_sock *ro = dgram_sk(sk);
881 struct net *net = sock_net(sk);
885 if (optlen < sizeof(int))
888 if (get_user(val, (int __user *)optval))
895 ro->want_ack = !!val;
898 if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
899 !ns_capable(net->user_ns, CAP_NET_RAW)) {
905 case WPAN_SECURITY_DEFAULT:
906 ro->secen_override = 0;
908 case WPAN_SECURITY_ON:
909 ro->secen_override = 1;
912 case WPAN_SECURITY_OFF:
913 ro->secen_override = 1;
921 case WPAN_SECURITY_LEVEL:
922 if (!ns_capable(net->user_ns, CAP_NET_ADMIN) &&
923 !ns_capable(net->user_ns, CAP_NET_RAW)) {
928 if (val < WPAN_SECURITY_LEVEL_DEFAULT ||
929 val > IEEE802154_SCF_SECLEVEL_ENC_MIC128) {
931 } else if (val == WPAN_SECURITY_LEVEL_DEFAULT) {
932 ro->seclevel_override = 0;
934 ro->seclevel_override = 1;
947 static struct proto ieee802154_dgram_prot = {
948 .name = "IEEE-802.15.4-MAC",
949 .owner = THIS_MODULE,
950 .obj_size = sizeof(struct dgram_sock),
952 .close = dgram_close,
954 .sendmsg = dgram_sendmsg,
955 .recvmsg = dgram_recvmsg,
957 .unhash = dgram_unhash,
958 .connect = dgram_connect,
959 .disconnect = dgram_disconnect,
960 .ioctl = dgram_ioctl,
961 .getsockopt = dgram_getsockopt,
962 .setsockopt = dgram_setsockopt,
965 static const struct proto_ops ieee802154_dgram_ops = {
966 .family = PF_IEEE802154,
967 .owner = THIS_MODULE,
968 .release = ieee802154_sock_release,
969 .bind = ieee802154_sock_bind,
970 .connect = ieee802154_sock_connect,
971 .socketpair = sock_no_socketpair,
972 .accept = sock_no_accept,
973 .getname = sock_no_getname,
974 .poll = datagram_poll,
975 .ioctl = ieee802154_sock_ioctl,
976 .listen = sock_no_listen,
977 .shutdown = sock_no_shutdown,
978 .setsockopt = sock_common_setsockopt,
979 .getsockopt = sock_common_getsockopt,
980 .sendmsg = ieee802154_sock_sendmsg,
981 .recvmsg = sock_common_recvmsg,
982 .mmap = sock_no_mmap,
983 .sendpage = sock_no_sendpage,
985 .compat_setsockopt = compat_sock_common_setsockopt,
986 .compat_getsockopt = compat_sock_common_getsockopt,
990 /* Create a socket. Initialise the socket, blank the addresses
993 static int ieee802154_create(struct net *net, struct socket *sock,
994 int protocol, int kern)
999 const struct proto_ops *ops;
1001 if (!net_eq(net, &init_net))
1002 return -EAFNOSUPPORT;
1004 switch (sock->type) {
1006 proto = &ieee802154_raw_prot;
1007 ops = &ieee802154_raw_ops;
1010 proto = &ieee802154_dgram_prot;
1011 ops = &ieee802154_dgram_ops;
1014 rc = -ESOCKTNOSUPPORT;
1019 sk = sk_alloc(net, PF_IEEE802154, GFP_KERNEL, proto, kern);
1026 sock_init_data(sock, sk);
1027 /* FIXME: sk->sk_destruct */
1028 sk->sk_family = PF_IEEE802154;
1030 /* Checksums on by default */
1031 sock_set_flag(sk, SOCK_ZAPPED);
1033 if (sk->sk_prot->hash) {
1034 rc = sk->sk_prot->hash(sk);
1036 sk_common_release(sk);
1041 if (sk->sk_prot->init) {
1042 rc = sk->sk_prot->init(sk);
1044 sk_common_release(sk);
1050 static const struct net_proto_family ieee802154_family_ops = {
1051 .family = PF_IEEE802154,
1052 .create = ieee802154_create,
1053 .owner = THIS_MODULE,
1056 static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev,
1057 struct packet_type *pt, struct net_device *orig_dev)
1059 if (!netif_running(dev))
1061 pr_debug("got frame, type %d, dev %p\n", dev->type, dev);
1063 print_hex_dump_bytes("ieee802154_rcv ",
1064 DUMP_PREFIX_NONE, skb->data, skb->len);
1067 if (!net_eq(dev_net(dev), &init_net))
1070 ieee802154_raw_deliver(dev, skb);
1072 if (dev->type != ARPHRD_IEEE802154)
1075 if (skb->pkt_type != PACKET_OTHERHOST)
1076 return ieee802154_dgram_deliver(dev, skb);
1083 static struct packet_type ieee802154_packet_type = {
1084 .type = htons(ETH_P_IEEE802154),
1085 .func = ieee802154_rcv,
1088 static int __init af_ieee802154_init(void)
1092 rc = proto_register(&ieee802154_raw_prot, 1);
1096 rc = proto_register(&ieee802154_dgram_prot, 1);
1100 /* Tell SOCKET that we are alive */
1101 rc = sock_register(&ieee802154_family_ops);
1104 dev_add_pack(&ieee802154_packet_type);
1110 proto_unregister(&ieee802154_dgram_prot);
1112 proto_unregister(&ieee802154_raw_prot);
1117 static void __exit af_ieee802154_remove(void)
1119 dev_remove_pack(&ieee802154_packet_type);
1120 sock_unregister(PF_IEEE802154);
1121 proto_unregister(&ieee802154_dgram_prot);
1122 proto_unregister(&ieee802154_raw_prot);
1125 module_init(af_ieee802154_init);
1126 module_exit(af_ieee802154_remove);
1128 MODULE_LICENSE("GPL");
1129 MODULE_ALIAS_NETPROTO(PF_IEEE802154);