rtnetlink.c (d585a021c0b10b0477d6b608c53e1feb8cde0507) rtnetlink.c (30ffee8480c13fbcf8ab6c28e31f79dfff683117)
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>

--- 21 unchanged lines hidden (view full) ---

30#include <linux/slab.h>
31#include <linux/interrupt.h>
32#include <linux/capability.h>
33#include <linux/skbuff.h>
34#include <linux/init.h>
35#include <linux/security.h>
36#include <linux/mutex.h>
37#include <linux/if_addr.h>
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>

--- 21 unchanged lines hidden (view full) ---

30#include <linux/slab.h>
31#include <linux/interrupt.h>
32#include <linux/capability.h>
33#include <linux/skbuff.h>
34#include <linux/init.h>
35#include <linux/security.h>
36#include <linux/mutex.h>
37#include <linux/if_addr.h>
38#include <linux/nsproxy.h>
39
40#include <asm/uaccess.h>
41#include <asm/system.h>
42#include <asm/string.h>
43
44#include <linux/inet.h>
45#include <linux/netdevice.h>
46#include <net/ip.h>
47#include <net/protocol.h>
48#include <net/arp.h>
49#include <net/route.h>
50#include <net/udp.h>
51#include <net/sock.h>
52#include <net/pkt_sched.h>
53#include <net/fib_rules.h>
54#include <net/rtnetlink.h>
38
39#include <asm/uaccess.h>
40#include <asm/system.h>
41#include <asm/string.h>
42
43#include <linux/inet.h>
44#include <linux/netdevice.h>
45#include <net/ip.h>
46#include <net/protocol.h>
47#include <net/arp.h>
48#include <net/route.h>
49#include <net/udp.h>
50#include <net/sock.h>
51#include <net/pkt_sched.h>
52#include <net/fib_rules.h>
53#include <net/rtnetlink.h>
54#include <net/net_namespace.h>
55
56struct rtnl_link
57{
58 rtnl_doit_func doit;
59 rtnl_dumpit_func dumpit;
60};
61
62static DEFINE_MUTEX(rtnl_mutex);

--- 657 unchanged lines hidden (view full) ---

720 [IFLA_IFALIAS] = { .type = NLA_STRING, .len = IFALIASZ-1 },
721};
722
723static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
724 [IFLA_INFO_KIND] = { .type = NLA_STRING },
725 [IFLA_INFO_DATA] = { .type = NLA_NESTED },
726};
727
55
56struct rtnl_link
57{
58 rtnl_doit_func doit;
59 rtnl_dumpit_func dumpit;
60};
61
62static DEFINE_MUTEX(rtnl_mutex);

--- 657 unchanged lines hidden (view full) ---

720 [IFLA_IFALIAS] = { .type = NLA_STRING, .len = IFALIASZ-1 },
721};
722
723static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {
724 [IFLA_INFO_KIND] = { .type = NLA_STRING },
725 [IFLA_INFO_DATA] = { .type = NLA_NESTED },
726};
727
728static struct net *get_net_ns_by_pid(pid_t pid)
729{
730 struct task_struct *tsk;
731 struct net *net;
732
733 /* Lookup the network namespace */
734 net = ERR_PTR(-ESRCH);
735 rcu_read_lock();
736 tsk = find_task_by_vpid(pid);
737 if (tsk) {
738 struct nsproxy *nsproxy;
739 nsproxy = task_nsproxy(tsk);
740 if (nsproxy)
741 net = get_net(nsproxy->net_ns);
742 }
743 rcu_read_unlock();
744 return net;
745}
746
747static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
748{
749 if (dev) {
750 if (tb[IFLA_ADDRESS] &&
751 nla_len(tb[IFLA_ADDRESS]) < dev->addr_len)
752 return -EINVAL;
753
754 if (tb[IFLA_BROADCAST] &&

--- 677 unchanged lines hidden ---
728static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
729{
730 if (dev) {
731 if (tb[IFLA_ADDRESS] &&
732 nla_len(tb[IFLA_ADDRESS]) < dev->addr_len)
733 return -EINVAL;
734
735 if (tb[IFLA_BROADCAST] &&

--- 677 unchanged lines hidden ---