rtnetlink.c (af65bdfce98d7965fbe93a48b8128444a2eea024) | rtnetlink.c (1c2d670f3660e9103fdcdca702f6dbf8ea7d6afb) |
---|---|
1/* 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. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 845 unchanged lines hidden (view full) --- 854 855static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 856{ 857 rtnl_doit_func doit; 858 int sz_idx, kind; 859 int min_len; 860 int family; 861 int type; | 1/* 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. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 845 unchanged lines hidden (view full) --- 854 855static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 856{ 857 rtnl_doit_func doit; 858 int sz_idx, kind; 859 int min_len; 860 int family; 861 int type; |
862 int err; |
|
862 863 type = nlh->nlmsg_type; 864 if (type > RTM_MAX) 865 return -EOPNOTSUPP; 866 867 type -= RTM_BASE; 868 869 /* All the messages must have at least 1 byte length */ --- 12 unchanged lines hidden (view full) --- 882 883 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) { 884 rtnl_dumpit_func dumpit; 885 886 dumpit = rtnl_get_dumpit(family, type); 887 if (dumpit == NULL) 888 return -EOPNOTSUPP; 889 | 863 864 type = nlh->nlmsg_type; 865 if (type > RTM_MAX) 866 return -EOPNOTSUPP; 867 868 type -= RTM_BASE; 869 870 /* All the messages must have at least 1 byte length */ --- 12 unchanged lines hidden (view full) --- 883 884 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) { 885 rtnl_dumpit_func dumpit; 886 887 dumpit = rtnl_get_dumpit(family, type); 888 if (dumpit == NULL) 889 return -EOPNOTSUPP; 890 |
890 return netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); | 891 __rtnl_unlock(); 892 err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); 893 rtnl_lock(); 894 return err; |
891 } 892 893 memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); 894 895 min_len = rtm_min[sz_idx]; 896 if (nlh->nlmsg_len < min_len) 897 return -EINVAL; 898 --- 68 unchanged lines hidden (view full) --- 967 for (i = 0; i < ARRAY_SIZE(rta_max); i++) 968 if (rta_max[i] > rtattr_max) 969 rtattr_max = rta_max[i]; 970 rta_buf = kmalloc(rtattr_max * sizeof(struct rtattr *), GFP_KERNEL); 971 if (!rta_buf) 972 panic("rtnetlink_init: cannot allocate rta_buf\n"); 973 974 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, | 895 } 896 897 memset(rta_buf, 0, (rtattr_max * sizeof(struct rtattr *))); 898 899 min_len = rtm_min[sz_idx]; 900 if (nlh->nlmsg_len < min_len) 901 return -EINVAL; 902 --- 68 unchanged lines hidden (view full) --- 971 for (i = 0; i < ARRAY_SIZE(rta_max); i++) 972 if (rta_max[i] > rtattr_max) 973 rtattr_max = rta_max[i]; 974 rta_buf = kmalloc(rtattr_max * sizeof(struct rtattr *), GFP_KERNEL); 975 if (!rta_buf) 976 panic("rtnetlink_init: cannot allocate rta_buf\n"); 977 978 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv, |
975 NULL, THIS_MODULE); | 979 &rtnl_mutex, THIS_MODULE); |
976 if (rtnl == NULL) 977 panic("rtnetlink_init: cannot initialize rtnetlink\n"); 978 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); 979 register_netdevice_notifier(&rtnetlink_dev_notifier); 980 981 rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, rtnl_dump_ifinfo); 982 rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL); 983 --- 14 unchanged lines hidden --- | 980 if (rtnl == NULL) 981 panic("rtnetlink_init: cannot initialize rtnetlink\n"); 982 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); 983 register_netdevice_notifier(&rtnetlink_dev_notifier); 984 985 rtnl_register(PF_UNSPEC, RTM_GETLINK, rtnl_getlink, rtnl_dump_ifinfo); 986 rtnl_register(PF_UNSPEC, RTM_SETLINK, rtnl_setlink, NULL); 987 --- 14 unchanged lines hidden --- |