2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Routing netlink socket interface: protocol independent part.
8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
16 * Vitaly E. Lavrov RTA_OK arithmetics was wrong.
19 #include <linux/errno.h>
20 #include <linux/module.h>
21 #include <linux/types.h>
22 #include <linux/socket.h>
23 #include <linux/kernel.h>
24 #include <linux/sched.h>
25 #include <linux/timer.h>
26 #include <linux/string.h>
27 #include <linux/sockios.h>
28 #include <linux/net.h>
29 #include <linux/fcntl.h>
31 #include <linux/slab.h>
32 #include <linux/interrupt.h>
33 #include <linux/capability.h>
34 #include <linux/skbuff.h>
35 #include <linux/init.h>
36 #include <linux/security.h>
37 #include <linux/mutex.h>
38 #include <linux/if_addr.h>
40 #include <asm/uaccess.h>
41 #include <asm/system.h>
42 #include <asm/string.h>
44 #include <linux/inet.h>
45 #include <linux/netdevice.h>
47 #include <net/protocol.h>
49 #include <net/route.h>
52 #include <net/pkt_sched.h>
53 #include <net/fib_rules.h>
54 #include <net/netlink.h>
55 #ifdef CONFIG_NET_WIRELESS_RTNETLINK
56 #include <linux/wireless.h>
57 #include <net/iw_handler.h>
58 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
60 static DEFINE_MUTEX(rtnl_mutex);
64 mutex_lock(&rtnl_mutex);
67 void __rtnl_unlock(void)
69 mutex_unlock(&rtnl_mutex);
72 void rtnl_unlock(void)
74 mutex_unlock(&rtnl_mutex);
75 if (rtnl && rtnl->sk_receive_queue.qlen)
76 rtnl->sk_data_ready(rtnl, 0);
80 int rtnl_trylock(void)
82 return mutex_trylock(&rtnl_mutex);
85 int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
87 memset(tb, 0, sizeof(struct rtattr*)*maxattr);
89 while (RTA_OK(rta, len)) {
90 unsigned flavor = rta->rta_type;
91 if (flavor && flavor <= maxattr)
93 rta = RTA_NEXT(rta, len);
100 struct rtnetlink_link * rtnetlink_links[NPROTO];
102 static const int rtm_min[RTM_NR_FAMILIES] =
104 [RTM_FAM(RTM_NEWLINK)] = NLMSG_LENGTH(sizeof(struct ifinfomsg)),
105 [RTM_FAM(RTM_NEWADDR)] = NLMSG_LENGTH(sizeof(struct ifaddrmsg)),
106 [RTM_FAM(RTM_NEWROUTE)] = NLMSG_LENGTH(sizeof(struct rtmsg)),
107 [RTM_FAM(RTM_NEWNEIGH)] = NLMSG_LENGTH(sizeof(struct ndmsg)),
108 [RTM_FAM(RTM_NEWRULE)] = NLMSG_LENGTH(sizeof(struct fib_rule_hdr)),
109 [RTM_FAM(RTM_NEWQDISC)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
110 [RTM_FAM(RTM_NEWTCLASS)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
111 [RTM_FAM(RTM_NEWTFILTER)] = NLMSG_LENGTH(sizeof(struct tcmsg)),
112 [RTM_FAM(RTM_NEWACTION)] = NLMSG_LENGTH(sizeof(struct tcamsg)),
113 [RTM_FAM(RTM_NEWPREFIX)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
114 [RTM_FAM(RTM_GETMULTICAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
115 [RTM_FAM(RTM_GETANYCAST)] = NLMSG_LENGTH(sizeof(struct rtgenmsg)),
116 [RTM_FAM(RTM_NEWNEIGHTBL)] = NLMSG_LENGTH(sizeof(struct ndtmsg)),
119 static const int rta_max[RTM_NR_FAMILIES] =
121 [RTM_FAM(RTM_NEWLINK)] = IFLA_MAX,
122 [RTM_FAM(RTM_NEWADDR)] = IFA_MAX,
123 [RTM_FAM(RTM_NEWROUTE)] = RTA_MAX,
124 [RTM_FAM(RTM_NEWNEIGH)] = NDA_MAX,
125 [RTM_FAM(RTM_NEWRULE)] = FRA_MAX,
126 [RTM_FAM(RTM_NEWQDISC)] = TCA_MAX,
127 [RTM_FAM(RTM_NEWTCLASS)] = TCA_MAX,
128 [RTM_FAM(RTM_NEWTFILTER)] = TCA_MAX,
129 [RTM_FAM(RTM_NEWACTION)] = TCAA_MAX,
130 [RTM_FAM(RTM_NEWNEIGHTBL)] = NDTA_MAX,
133 void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data)
136 int size = RTA_LENGTH(attrlen);
138 rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
139 rta->rta_type = attrtype;
141 memcpy(RTA_DATA(rta), data, attrlen);
142 memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
145 size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
147 size_t ret = RTA_PAYLOAD(rta);
148 char *src = RTA_DATA(rta);
150 if (ret > 0 && src[ret - 1] == '\0')
153 size_t len = (ret >= size) ? size - 1 : ret;
154 memset(dest, 0, size);
155 memcpy(dest, src, len);
160 int rtnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
164 NETLINK_CB(skb).dst_group = group;
166 atomic_inc(&skb->users);
167 netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
169 err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
173 int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics)
175 struct rtattr *mx = (struct rtattr*)skb->tail;
178 RTA_PUT(skb, RTA_METRICS, 0, NULL);
179 for (i=0; i<RTAX_MAX; i++) {
181 RTA_PUT(skb, i+1, sizeof(u32), metrics+i);
183 mx->rta_len = skb->tail - (u8*)mx;
184 if (mx->rta_len == RTA_LENGTH(0))
185 skb_trim(skb, (u8*)mx - skb->data);
189 skb_trim(skb, (u8*)mx - skb->data);
194 static void set_operstate(struct net_device *dev, unsigned char transition)
196 unsigned char operstate = dev->operstate;
200 if ((operstate == IF_OPER_DORMANT ||
201 operstate == IF_OPER_UNKNOWN) &&
203 operstate = IF_OPER_UP;
206 case IF_OPER_DORMANT:
207 if (operstate == IF_OPER_UP ||
208 operstate == IF_OPER_UNKNOWN)
209 operstate = IF_OPER_DORMANT;
213 if (dev->operstate != operstate) {
214 write_lock_bh(&dev_base_lock);
215 dev->operstate = operstate;
216 write_unlock_bh(&dev_base_lock);
217 netdev_state_change(dev);
221 static int rtnetlink_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
222 int type, u32 pid, u32 seq, u32 change,
226 struct nlmsghdr *nlh;
227 unsigned char *b = skb->tail;
229 nlh = NLMSG_NEW(skb, pid, seq, type, sizeof(*r), flags);
231 r->ifi_family = AF_UNSPEC;
233 r->ifi_type = dev->type;
234 r->ifi_index = dev->ifindex;
235 r->ifi_flags = dev_get_flags(dev);
236 r->ifi_change = change;
238 RTA_PUT(skb, IFLA_IFNAME, strlen(dev->name)+1, dev->name);
241 u32 txqlen = dev->tx_queue_len;
242 RTA_PUT(skb, IFLA_TXQLEN, sizeof(txqlen), &txqlen);
246 u32 weight = dev->weight;
247 RTA_PUT(skb, IFLA_WEIGHT, sizeof(weight), &weight);
251 u8 operstate = netif_running(dev)?dev->operstate:IF_OPER_DOWN;
252 u8 link_mode = dev->link_mode;
253 RTA_PUT(skb, IFLA_OPERSTATE, sizeof(operstate), &operstate);
254 RTA_PUT(skb, IFLA_LINKMODE, sizeof(link_mode), &link_mode);
258 struct rtnl_link_ifmap map = {
259 .mem_start = dev->mem_start,
260 .mem_end = dev->mem_end,
261 .base_addr = dev->base_addr,
264 .port = dev->if_port,
266 RTA_PUT(skb, IFLA_MAP, sizeof(map), &map);
270 RTA_PUT(skb, IFLA_ADDRESS, dev->addr_len, dev->dev_addr);
271 RTA_PUT(skb, IFLA_BROADCAST, dev->addr_len, dev->broadcast);
276 RTA_PUT(skb, IFLA_MTU, sizeof(mtu), &mtu);
279 if (dev->ifindex != dev->iflink) {
280 u32 iflink = dev->iflink;
281 RTA_PUT(skb, IFLA_LINK, sizeof(iflink), &iflink);
284 if (dev->qdisc_sleeping)
285 RTA_PUT(skb, IFLA_QDISC,
286 strlen(dev->qdisc_sleeping->ops->id) + 1,
287 dev->qdisc_sleeping->ops->id);
290 u32 master = dev->master->ifindex;
291 RTA_PUT(skb, IFLA_MASTER, sizeof(master), &master);
294 if (dev->get_stats) {
295 unsigned long *stats = (unsigned long*)dev->get_stats(dev);
300 int n = sizeof(struct rtnl_link_stats)/4;
302 a = __RTA_PUT(skb, IFLA_STATS, n*4);
308 nlh->nlmsg_len = skb->tail - b;
313 skb_trim(skb, b - skb->data);
317 static int rtnetlink_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
320 int s_idx = cb->args[0];
321 struct net_device *dev;
323 read_lock(&dev_base_lock);
324 for (dev=dev_base, idx=0; dev; dev = dev->next, idx++) {
327 if (rtnetlink_fill_ifinfo(skb, dev, RTM_NEWLINK,
328 NETLINK_CB(cb->skb).pid,
329 cb->nlh->nlmsg_seq, 0,
333 read_unlock(&dev_base_lock);
339 static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = {
340 [IFLA_IFNAME] = { .type = NLA_STRING },
341 [IFLA_MAP] = { .minlen = sizeof(struct rtnl_link_ifmap) },
342 [IFLA_MTU] = { .type = NLA_U32 },
343 [IFLA_TXQLEN] = { .type = NLA_U32 },
344 [IFLA_WEIGHT] = { .type = NLA_U32 },
345 [IFLA_OPERSTATE] = { .type = NLA_U8 },
346 [IFLA_LINKMODE] = { .type = NLA_U8 },
349 static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
351 struct ifinfomsg *ifm;
352 struct net_device *dev;
353 int err, send_addr_notify = 0, modified = 0;
354 struct nlattr *tb[IFLA_MAX+1];
355 char ifname[IFNAMSIZ];
357 err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
361 if (tb[IFLA_IFNAME] &&
362 nla_strlcpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ) >= IFNAMSIZ)
366 ifm = nlmsg_data(nlh);
367 if (ifm->ifi_index >= 0)
368 dev = dev_get_by_index(ifm->ifi_index);
369 else if (tb[IFLA_IFNAME])
370 dev = dev_get_by_name(ifname);
379 if (tb[IFLA_ADDRESS] &&
380 nla_len(tb[IFLA_ADDRESS]) < dev->addr_len)
383 if (tb[IFLA_BROADCAST] &&
384 nla_len(tb[IFLA_BROADCAST]) < dev->addr_len)
388 struct rtnl_link_ifmap *u_map;
391 if (!dev->set_config) {
396 if (!netif_device_present(dev)) {
401 u_map = nla_data(tb[IFLA_MAP]);
402 k_map.mem_start = (unsigned long) u_map->mem_start;
403 k_map.mem_end = (unsigned long) u_map->mem_end;
404 k_map.base_addr = (unsigned short) u_map->base_addr;
405 k_map.irq = (unsigned char) u_map->irq;
406 k_map.dma = (unsigned char) u_map->dma;
407 k_map.port = (unsigned char) u_map->port;
409 err = dev->set_config(dev, &k_map);
416 if (tb[IFLA_ADDRESS]) {
420 if (!dev->set_mac_address) {
425 if (!netif_device_present(dev)) {
430 len = sizeof(sa_family_t) + dev->addr_len;
431 sa = kmalloc(len, GFP_KERNEL);
436 sa->sa_family = dev->type;
437 memcpy(sa->sa_data, nla_data(tb[IFLA_ADDRESS]),
439 err = dev->set_mac_address(dev, sa);
443 send_addr_notify = 1;
448 err = dev_set_mtu(dev, nla_get_u32(tb[IFLA_MTU]));
455 * Interface selected by interface index but interface
456 * name provided implies that a name change has been
459 if (ifm->ifi_index >= 0 && ifname[0]) {
460 err = dev_change_name(dev, ifname);
466 #ifdef CONFIG_NET_WIRELESS_RTNETLINK
467 if (tb[IFLA_WIRELESS]) {
468 /* Call Wireless Extensions.
469 * Various stuff checked in there... */
470 err = wireless_rtnetlink_set(dev, nla_data(tb[IFLA_WIRELESS]),
471 nla_len(tb[IFLA_WIRELESS]));
475 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
477 if (tb[IFLA_BROADCAST]) {
478 nla_memcpy(dev->broadcast, tb[IFLA_BROADCAST], dev->addr_len);
479 send_addr_notify = 1;
484 dev_change_flags(dev, ifm->ifi_flags);
487 dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
490 dev->weight = nla_get_u32(tb[IFLA_WEIGHT]);
492 if (tb[IFLA_OPERSTATE])
493 set_operstate(dev, nla_get_u8(tb[IFLA_OPERSTATE]));
495 if (tb[IFLA_LINKMODE]) {
496 write_lock_bh(&dev_base_lock);
497 dev->link_mode = nla_get_u8(tb[IFLA_LINKMODE]);
498 write_unlock_bh(&dev_base_lock);
504 if (err < 0 && modified && net_ratelimit())
505 printk(KERN_WARNING "A link change request failed with "
506 "some changes comitted already. Interface %s may "
507 "have been left with an inconsistent configuration, "
508 "please check.\n", dev->name);
510 if (send_addr_notify)
511 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
518 #ifdef CONFIG_NET_WIRELESS_RTNETLINK
519 static int do_getlink(struct sk_buff *in_skb, struct nlmsghdr* in_nlh, void *arg)
521 struct ifinfomsg *ifm = NLMSG_DATA(in_nlh);
522 struct rtattr **ida = arg;
523 struct net_device *dev;
525 struct nlmsghdr *nlh;
532 if (ifm->ifi_index >= 0)
533 dev = dev_get_by_index(ifm->ifi_index);
539 #ifdef CONFIG_NET_WIRELESS_RTNETLINK
540 if (ida[IFLA_WIRELESS - 1]) {
542 /* Call Wireless Extensions. We need to know the size before
543 * we can alloc. Various stuff checked in there... */
544 err = wireless_rtnetlink_get(dev, RTA_DATA(ida[IFLA_WIRELESS - 1]), ida[IFLA_WIRELESS - 1]->rta_len, &iw_buf, &iw_buf_len);
548 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
550 /* Create a skb big enough to include all the data.
551 * Some requests are way bigger than 4k... Jean II */
552 skb = alloc_skb((NLMSG_LENGTH(sizeof(*r))) + (RTA_SPACE(iw_buf_len)),
558 /* Put in the message the usual good stuff */
559 nlh = NLMSG_PUT(skb, NETLINK_CB(in_skb).pid, in_nlh->nlmsg_seq,
560 RTM_NEWLINK, sizeof(*r));
562 r->ifi_family = AF_UNSPEC;
564 r->ifi_type = dev->type;
565 r->ifi_index = dev->ifindex;
566 r->ifi_flags = dev->flags;
569 /* Put the wireless payload if it exist */
571 RTA_PUT(skb, IFLA_WIRELESS, iw_buf_len,
572 iw_buf + IW_EV_POINT_OFF);
574 nlh->nlmsg_len = skb->tail - b;
577 NETLINK_CB(skb).dst_pid = NETLINK_CB(in_skb).pid;
579 err = netlink_unicast(rtnl, skb, NETLINK_CB(in_skb).pid, MSG_DONTWAIT);
593 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
595 static int rtnetlink_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
598 int s_idx = cb->family;
602 for (idx=1; idx<NPROTO; idx++) {
603 int type = cb->nlh->nlmsg_type-RTM_BASE;
604 if (idx < s_idx || idx == PF_PACKET)
606 if (rtnetlink_links[idx] == NULL ||
607 rtnetlink_links[idx][type].dumpit == NULL)
610 memset(&cb->args[0], 0, sizeof(cb->args));
611 if (rtnetlink_links[idx][type].dumpit(skb, cb))
619 void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
622 int size = NLMSG_SPACE(sizeof(struct ifinfomsg) +
623 sizeof(struct rtnl_link_ifmap) +
624 sizeof(struct rtnl_link_stats) + 128);
626 skb = alloc_skb(size, GFP_KERNEL);
630 if (rtnetlink_fill_ifinfo(skb, dev, type, 0, 0, change, 0) < 0) {
634 NETLINK_CB(skb).dst_group = RTNLGRP_LINK;
635 netlink_broadcast(rtnl, skb, 0, RTNLGRP_LINK, GFP_KERNEL);
638 /* Protected by RTNL sempahore. */
639 static struct rtattr **rta_buf;
640 static int rtattr_max;
642 /* Process one rtnetlink message. */
644 static __inline__ int
645 rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
647 struct rtnetlink_link *link;
648 struct rtnetlink_link *link_tab;
655 /* Only requests are handled by kernel now */
656 if (!(nlh->nlmsg_flags&NLM_F_REQUEST))
659 type = nlh->nlmsg_type;
661 /* A control message: ignore them */
665 /* Unknown message: reply with EINVAL */
671 /* All the messages must have at least 1 byte length */
672 if (nlh->nlmsg_len < NLMSG_LENGTH(sizeof(struct rtgenmsg)))
675 family = ((struct rtgenmsg*)NLMSG_DATA(nlh))->rtgen_family;
676 if (family >= NPROTO) {
677 *errp = -EAFNOSUPPORT;
681 link_tab = rtnetlink_links[family];
682 if (link_tab == NULL)
683 link_tab = rtnetlink_links[PF_UNSPEC];
684 link = &link_tab[type];
689 if (kind != 2 && security_netlink_recv(skb, CAP_NET_ADMIN)) {
694 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
695 if (link->dumpit == NULL)
696 link = &(rtnetlink_links[PF_UNSPEC][type]);
698 if (link->dumpit == NULL)
701 if ((*errp = netlink_dump_start(rtnl, skb, nlh,
702 link->dumpit, NULL)) != 0) {
706 netlink_queue_skip(nlh, skb);
710 memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *)));
712 min_len = rtm_min[sz_idx];
713 if (nlh->nlmsg_len < min_len)
716 if (nlh->nlmsg_len > min_len) {
717 int attrlen = nlh->nlmsg_len - NLMSG_ALIGN(min_len);
718 struct rtattr *attr = (void*)nlh + NLMSG_ALIGN(min_len);
720 while (RTA_OK(attr, attrlen)) {
721 unsigned flavor = attr->rta_type;
723 if (flavor > rta_max[sz_idx])
725 rta_buf[flavor-1] = attr;
727 attr = RTA_NEXT(attr, attrlen);
731 if (link->doit == NULL)
732 link = &(rtnetlink_links[PF_UNSPEC][type]);
733 if (link->doit == NULL)
735 err = link->doit(skb, nlh, (void *)&rta_buf[0]);
745 static void rtnetlink_rcv(struct sock *sk, int len)
747 unsigned int qlen = 0;
750 mutex_lock(&rtnl_mutex);
751 netlink_run_queue(sk, &qlen, &rtnetlink_rcv_msg);
752 mutex_unlock(&rtnl_mutex);
758 static struct rtnetlink_link link_rtnetlink_table[RTM_NR_MSGTYPES] =
760 [RTM_GETLINK - RTM_BASE] = {
761 #ifdef CONFIG_NET_WIRELESS_RTNETLINK
763 #endif /* CONFIG_NET_WIRELESS_RTNETLINK */
764 .dumpit = rtnetlink_dump_ifinfo },
765 [RTM_SETLINK - RTM_BASE] = { .doit = rtnl_setlink },
766 [RTM_GETADDR - RTM_BASE] = { .dumpit = rtnetlink_dump_all },
767 [RTM_GETROUTE - RTM_BASE] = { .dumpit = rtnetlink_dump_all },
768 [RTM_NEWNEIGH - RTM_BASE] = { .doit = neigh_add },
769 [RTM_DELNEIGH - RTM_BASE] = { .doit = neigh_delete },
770 [RTM_GETNEIGH - RTM_BASE] = { .dumpit = neigh_dump_info },
771 #ifdef CONFIG_FIB_RULES
772 [RTM_NEWRULE - RTM_BASE] = { .doit = fib_nl_newrule },
773 [RTM_DELRULE - RTM_BASE] = { .doit = fib_nl_delrule },
775 [RTM_GETRULE - RTM_BASE] = { .dumpit = rtnetlink_dump_all },
776 [RTM_GETNEIGHTBL - RTM_BASE] = { .dumpit = neightbl_dump_info },
777 [RTM_SETNEIGHTBL - RTM_BASE] = { .doit = neightbl_set },
780 static int rtnetlink_event(struct notifier_block *this, unsigned long event, void *ptr)
782 struct net_device *dev = ptr;
784 case NETDEV_UNREGISTER:
785 rtmsg_ifinfo(RTM_DELLINK, dev, ~0U);
787 case NETDEV_REGISTER:
788 rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
792 rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
795 case NETDEV_GOING_DOWN:
798 rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
804 static struct notifier_block rtnetlink_dev_notifier = {
805 .notifier_call = rtnetlink_event,
808 void __init rtnetlink_init(void)
813 for (i = 0; i < ARRAY_SIZE(rta_max); i++)
814 if (rta_max[i] > rtattr_max)
815 rtattr_max = rta_max[i];
816 rta_buf = kmalloc(rtattr_max * sizeof(struct rtattr *), GFP_KERNEL);
818 panic("rtnetlink_init: cannot allocate rta_buf\n");
820 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv,
823 panic("rtnetlink_init: cannot initialize rtnetlink\n");
824 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
825 register_netdevice_notifier(&rtnetlink_dev_notifier);
826 rtnetlink_links[PF_UNSPEC] = link_rtnetlink_table;
827 rtnetlink_links[PF_PACKET] = link_rtnetlink_table;
830 EXPORT_SYMBOL(__rta_fill);
831 EXPORT_SYMBOL(rtattr_strlcpy);
832 EXPORT_SYMBOL(rtattr_parse);
833 EXPORT_SYMBOL(rtnetlink_links);
834 EXPORT_SYMBOL(rtnetlink_put_metrics);
836 EXPORT_SYMBOL(rtnl_lock);
837 EXPORT_SYMBOL(rtnl_trylock);
838 EXPORT_SYMBOL(rtnl_unlock);