mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
Merge branch 'net-2.6.26-netns-20080326' of git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev
This commit is contained in:
commit
dfe98e9214
135 changed files with 597 additions and 487 deletions
|
@ -294,7 +294,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr)
|
|||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if ( event != NETDEV_UP && event != NETDEV_DOWN ) return NOTIFY_DONE;
|
||||
|
|
|
@ -115,7 +115,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
|
|||
struct aoe_hdr *h;
|
||||
u32 n;
|
||||
|
||||
if (ifp->nd_net != &init_net)
|
||||
if (dev_net(ifp) != &init_net)
|
||||
goto exit;
|
||||
|
||||
skb = skb_share_check(skb, GFP_ATOMIC);
|
||||
|
|
|
@ -2429,7 +2429,7 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac
|
|||
struct slave *slave = NULL;
|
||||
int ret = NET_RX_DROP;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto out;
|
||||
|
||||
if (!(dev->flags & IFF_MASTER))
|
||||
|
|
|
@ -345,7 +345,7 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct
|
|||
struct arp_pkt *arp = (struct arp_pkt *)skb->data;
|
||||
int res = NET_RX_DROP;
|
||||
|
||||
if (bond_dev->nd_net != &init_net)
|
||||
if (dev_net(bond_dev) != &init_net)
|
||||
goto out;
|
||||
|
||||
if (!(bond_dev->flags & IFF_MASTER))
|
||||
|
|
|
@ -2629,7 +2629,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
|
|||
unsigned char *arp_ptr;
|
||||
__be32 sip, tip;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto out;
|
||||
|
||||
if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER))
|
||||
|
@ -3470,7 +3470,7 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v
|
|||
{
|
||||
struct net_device *event_dev = (struct net_device *)ptr;
|
||||
|
||||
if (event_dev->nd_net != &init_net)
|
||||
if (dev_net(event_dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
dprintk("event_dev: %s, event: %lx\n",
|
||||
|
@ -3508,7 +3508,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event,
|
|||
struct bonding *bond, *bond_next;
|
||||
struct vlan_entry *vlan, *vlan_next;
|
||||
|
||||
if (ifa->ifa_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(ifa->ifa_dev->dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) {
|
||||
|
|
|
@ -172,7 +172,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
|
|||
struct ethhdr *eth;
|
||||
struct bpqdev *bpq;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
|
||||
|
@ -553,7 +553,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi
|
|||
{
|
||||
struct net_device *dev = (struct net_device *)ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (!dev_is_ethdev(dev))
|
||||
|
|
|
@ -258,7 +258,7 @@ static __net_init int loopback_net_init(struct net *net)
|
|||
if (!dev)
|
||||
goto out;
|
||||
|
||||
dev->nd_net = net;
|
||||
dev_net_set(dev, net);
|
||||
err = register_netdev(dev);
|
||||
if (err)
|
||||
goto out_free_netdev;
|
||||
|
|
|
@ -402,7 +402,7 @@ static int macvlan_newlink(struct net_device *dev,
|
|||
if (!tb[IFLA_LINK])
|
||||
return -EINVAL;
|
||||
|
||||
lowerdev = __dev_get_by_index(dev->nd_net, nla_get_u32(tb[IFLA_LINK]));
|
||||
lowerdev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK]));
|
||||
if (lowerdev == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ static int pppoe_device_event(struct notifier_block *this,
|
|||
{
|
||||
struct net_device *dev = (struct net_device *) ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* Only look at sockets that are using this specific device. */
|
||||
|
@ -392,7 +392,7 @@ static int pppoe_rcv(struct sk_buff *skb,
|
|||
if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
|
||||
goto out;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
|
||||
|
@ -424,7 +424,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
|
|||
struct pppoe_hdr *ph;
|
||||
struct pppox_sock *po;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto abort;
|
||||
|
||||
if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
|
||||
|
|
|
@ -375,7 +375,7 @@ static int veth_newlink(struct net_device *dev,
|
|||
else
|
||||
snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d");
|
||||
|
||||
peer = rtnl_create_link(dev->nd_net, ifname, &veth_link_ops, tbp);
|
||||
peer = rtnl_create_link(dev_net(dev), ifname, &veth_link_ops, tbp);
|
||||
if (IS_ERR(peer))
|
||||
return PTR_ERR(peer);
|
||||
|
||||
|
|
|
@ -3464,7 +3464,7 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi
|
|||
struct velocity_info *vptr;
|
||||
unsigned long flags;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
spin_lock_irqsave(&velocity_dev_list_lock, flags);
|
||||
|
|
|
@ -517,7 +517,7 @@ static int dlci_dev_event(struct notifier_block *unused,
|
|||
{
|
||||
struct net_device *dev = (struct net_device *) ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event == NETDEV_UNREGISTER) {
|
||||
|
|
|
@ -68,7 +68,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
{
|
||||
struct hdlc_device *hdlc = dev_to_hdlc(dev);
|
||||
|
||||
if (dev->nd_net != &init_net) {
|
||||
if (dev_net(dev) != &init_net) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
|
|||
unsigned long flags;
|
||||
int on;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->get_stats != hdlc_get_stats)
|
||||
|
|
|
@ -91,7 +91,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
|
|||
int len, err;
|
||||
struct lapbethdev *lapbeth;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
|
||||
|
@ -393,7 +393,7 @@ static int lapbeth_device_event(struct notifier_block *this,
|
|||
struct lapbethdev *lapbeth;
|
||||
struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (!dev_is_ethdev(dev))
|
||||
|
|
|
@ -1444,7 +1444,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
|
|||
|
||||
static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev)
|
||||
{
|
||||
if (dev->nd_net != &init_net) {
|
||||
if (dev_net(dev) != &init_net) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -3250,7 +3250,7 @@ static int qeth_l3_ip_event(struct notifier_block *this,
|
|||
struct qeth_ipaddr *addr;
|
||||
struct qeth_card *card;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
QETH_DBF_TEXT(trace, 3, "ipevent");
|
||||
|
|
|
@ -44,7 +44,9 @@ int seq_open_net(struct inode *ino, struct file *f,
|
|||
put_net(net);
|
||||
return -ENOMEM;
|
||||
}
|
||||
#ifdef CONFIG_NET_NS
|
||||
p->net = net;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(seq_open_net);
|
||||
|
@ -52,12 +54,10 @@ EXPORT_SYMBOL_GPL(seq_open_net);
|
|||
int seq_release_net(struct inode *ino, struct file *f)
|
||||
{
|
||||
struct seq_file *seq;
|
||||
struct seq_net_private *p;
|
||||
|
||||
seq = f->private_data;
|
||||
p = seq->private;
|
||||
|
||||
put_net(p->net);
|
||||
put_net(seq_file_net(seq));
|
||||
seq_release_private(ino, f);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
|
|||
ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
|
||||
|
||||
#define IN_DEV_ANDCONF(in_dev, attr) \
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \
|
||||
(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
|
||||
IN_DEV_CONF_GET((in_dev), attr))
|
||||
#define IN_DEV_ORCONF(in_dev, attr) \
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \
|
||||
(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \
|
||||
IN_DEV_CONF_GET((in_dev), attr))
|
||||
#define IN_DEV_MAXCONF(in_dev, attr) \
|
||||
(max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \
|
||||
(max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
|
||||
IN_DEV_CONF_GET((in_dev), attr)))
|
||||
|
||||
#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
|
||||
|
|
|
@ -481,7 +481,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
|
|||
#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
|
||||
|
||||
#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
|
||||
((__sk)->sk_family == AF_INET6) && \
|
||||
ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
|
||||
|
@ -489,7 +489,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
|
|||
(!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
|
||||
|
||||
#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
(*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
|
||||
((__sk)->sk_family == PF_INET6) && \
|
||||
(ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
|
||||
|
|
|
@ -708,8 +708,10 @@ struct net_device
|
|||
void (*poll_controller)(struct net_device *dev);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
/* Network namespace this network device is inside */
|
||||
struct net *nd_net;
|
||||
#endif
|
||||
|
||||
/* bridge stuff */
|
||||
struct net_bridge_port *br_port;
|
||||
|
@ -737,6 +739,27 @@ struct net_device
|
|||
#define NETDEV_ALIGN 32
|
||||
#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
|
||||
|
||||
/*
|
||||
* Net namespace inlines
|
||||
*/
|
||||
static inline
|
||||
struct net *dev_net(const struct net_device *dev)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return dev->nd_net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
void dev_net_set(struct net_device *dev, const struct net *net)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
dev->nd_dev = net;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* netdev_priv - access network device private data
|
||||
* @dev: network device
|
||||
|
@ -813,7 +836,7 @@ static inline struct net_device *next_net_device(struct net_device *dev)
|
|||
struct list_head *lh;
|
||||
struct net *net;
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
lh = dev->dev_list.next;
|
||||
return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <linux/types.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <net/net_namespace.h>
|
||||
|
||||
struct seq_operations;
|
||||
struct file;
|
||||
|
@ -64,7 +65,9 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head,
|
|||
|
||||
struct net;
|
||||
struct seq_net_private {
|
||||
#ifdef CONFIG_NET_NS
|
||||
struct net *net;
|
||||
#endif
|
||||
};
|
||||
|
||||
int seq_open_net(struct inode *, struct file *,
|
||||
|
@ -72,7 +75,11 @@ int seq_open_net(struct inode *, struct file *,
|
|||
int seq_release_net(struct inode *, struct file *);
|
||||
static inline struct net *seq_file_net(struct seq_file *seq)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return ((struct seq_net_private *)seq->private)->net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -314,25 +314,25 @@ typedef __u64 __bitwise __addrpair;
|
|||
((__force __u64)(__be32)(__saddr)));
|
||||
#endif /* __BIG_ENDIAN */
|
||||
#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
|
||||
((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
|
||||
(!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
|
||||
#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
|
||||
((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
|
||||
(!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
|
||||
#else /* 32-bit arch */
|
||||
#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
|
||||
#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
(inet_sk(__sk)->daddr == (__saddr)) && \
|
||||
(inet_sk(__sk)->rcv_saddr == (__daddr)) && \
|
||||
((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
|
||||
(!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
|
||||
#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
|
||||
(((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \
|
||||
(((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
|
||||
(inet_twsk(__sk)->tw_daddr == (__saddr)) && \
|
||||
(inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
|
||||
((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
|
||||
|
|
|
@ -207,4 +207,22 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
|
|||
const int timeo, const int timewait_len);
|
||||
extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
|
||||
struct inet_timewait_death_row *twdr);
|
||||
|
||||
static inline
|
||||
struct net *twsk_net(const struct inet_timewait_sock *twsk)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return twsk->tw_net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
void twsk_net_set(struct inet_timewait_sock *twsk, const struct net *net)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
twsk->tw_net = net;
|
||||
#endif
|
||||
}
|
||||
#endif /* _INET_TIMEWAIT_SOCK_ */
|
||||
|
|
|
@ -38,7 +38,9 @@ struct neighbour;
|
|||
|
||||
struct neigh_parms
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
struct net *net;
|
||||
#endif
|
||||
struct net_device *dev;
|
||||
struct neigh_parms *next;
|
||||
int (*neigh_setup)(struct neighbour *);
|
||||
|
@ -131,7 +133,9 @@ struct neigh_ops
|
|||
struct pneigh_entry
|
||||
{
|
||||
struct pneigh_entry *next;
|
||||
#ifdef CONFIG_NET_NS
|
||||
struct net *net;
|
||||
#endif
|
||||
struct net_device *dev;
|
||||
u8 flags;
|
||||
u8 key[0];
|
||||
|
@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
|
|||
|
||||
extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
|
||||
extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
|
||||
|
||||
static inline
|
||||
struct net *neigh_parms_net(const struct neigh_parms *parms)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return parms->net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern unsigned long neigh_rand_reach_time(unsigned long base);
|
||||
|
||||
extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
|
||||
|
@ -220,6 +235,16 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
|
|||
extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat);
|
||||
extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev);
|
||||
|
||||
static inline
|
||||
struct net *pneigh_net(const struct pneigh_entry *pneigh)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return pneigh->net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
extern void neigh_app_ns(struct neighbour *n);
|
||||
extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
|
||||
extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
|
||||
|
|
|
@ -118,6 +118,12 @@ static inline void release_net(struct net *net)
|
|||
{
|
||||
atomic_dec(&net->use_count);
|
||||
}
|
||||
|
||||
static inline
|
||||
int net_eq(const struct net *net1, const struct net *net2)
|
||||
{
|
||||
return net1 == net2;
|
||||
}
|
||||
#else
|
||||
static inline struct net *get_net(struct net *net)
|
||||
{
|
||||
|
@ -141,6 +147,12 @@ static inline struct net *maybe_get_net(struct net *net)
|
|||
{
|
||||
return net;
|
||||
}
|
||||
|
||||
static inline
|
||||
int net_eq(const struct net *net1, const struct net *net2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define for_each_net(VAR) \
|
||||
|
|
|
@ -160,7 +160,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
|
|||
.dport = dport } } };
|
||||
|
||||
int err;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
if (!dst || !src) {
|
||||
err = __ip_route_output_key(net, rp, &fl);
|
||||
if (err)
|
||||
|
@ -188,7 +188,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
|
|||
ip_rt_put(*rp);
|
||||
*rp = NULL;
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0);
|
||||
return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,9 @@ struct sock_common {
|
|||
atomic_t skc_refcnt;
|
||||
unsigned int skc_hash;
|
||||
struct proto *skc_prot;
|
||||
#ifdef CONFIG_NET_NS
|
||||
struct net *skc_net;
|
||||
#endif
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1345,6 +1347,24 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline
|
||||
struct net *sock_net(const struct sock *sk)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
return sk->sk_net;
|
||||
#else
|
||||
return &init_net;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
void sock_net_set(struct sock *sk, const struct net *net)
|
||||
{
|
||||
#ifdef CONFIG_NET_NS
|
||||
sk->sk_net = net;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace.
|
||||
* They should not hold a referrence to a namespace in order to allow
|
||||
|
@ -1353,8 +1373,8 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
|
|||
*/
|
||||
static inline void sk_change_net(struct sock *sk, struct net *net)
|
||||
{
|
||||
put_net(sk->sk_net);
|
||||
sk->sk_net = net;
|
||||
put_net(sock_net(sk));
|
||||
sock_net_set(sk, net);
|
||||
}
|
||||
|
||||
extern void sock_enable_timestamp(struct sock *sk);
|
||||
|
|
|
@ -382,7 +382,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
|
|||
int i, flgs;
|
||||
struct net_device *vlandev;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (!grp)
|
||||
|
|
|
@ -153,7 +153,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
|
|||
struct net_device_stats *stats;
|
||||
unsigned short vlan_TCI;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto err_free;
|
||||
|
||||
skb = skb_share_check(skb, GFP_ATOMIC);
|
||||
|
|
|
@ -333,7 +333,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event,
|
|||
struct net_device *dev = ptr;
|
||||
int ct;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event == NETDEV_DOWN) {
|
||||
|
@ -716,7 +716,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
struct atalk_addr sa, *ma, da;
|
||||
struct atalk_iface *ifa;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto out0;
|
||||
|
||||
/* We only do Ethernet SNAP AARP. */
|
||||
|
|
|
@ -648,7 +648,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event,
|
|||
{
|
||||
struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event == NETDEV_DOWN)
|
||||
|
@ -1405,7 +1405,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
int origlen;
|
||||
__u16 len_hops;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto freeit;
|
||||
|
||||
/* Don't mangle buffer if shared */
|
||||
|
@ -1493,7 +1493,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev,
|
||||
struct packet_type *pt, struct net_device *orig_dev)
|
||||
{
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto freeit;
|
||||
|
||||
/* Expand any short form frames */
|
||||
|
|
|
@ -612,7 +612,7 @@ static int clip_device_event(struct notifier_block *this, unsigned long event,
|
|||
{
|
||||
struct net_device *dev = arg;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event == NETDEV_UNREGISTER) {
|
||||
|
|
|
@ -964,7 +964,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo
|
|||
|
||||
dev = (struct net_device *)dev_ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->name == NULL || strncmp(dev->name, "lec", 3))
|
||||
|
|
|
@ -326,7 +326,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
|
|||
|
||||
lock_sock(sk);
|
||||
|
||||
error = svc_create(sk->sk_net, newsock,0);
|
||||
error = svc_create(sock_net(sk), newsock,0);
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ static int ax25_device_event(struct notifier_block *this, unsigned long event,
|
|||
{
|
||||
struct net_device *dev = (struct net_device *)ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* Reject non AX.25 devices */
|
||||
|
@ -869,7 +869,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
|
|||
struct sock *sk;
|
||||
ax25_cb *ax25, *oax25;
|
||||
|
||||
sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot);
|
||||
sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot);
|
||||
if (sk == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
skb->sk = NULL; /* Initially we don't know who it's for */
|
||||
skb->destructor = NULL; /* Who initializes this, dammit?! */
|
||||
|
||||
if (dev->nd_net != &init_net) {
|
||||
if (dev_net(dev) != &init_net) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1499,7 +1499,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
|
|||
goto response;
|
||||
}
|
||||
|
||||
sk = l2cap_sock_alloc(parent->sk_net, NULL, BTPROTO_L2CAP, GFP_ATOMIC);
|
||||
sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC);
|
||||
if (!sk)
|
||||
goto response;
|
||||
|
||||
|
|
|
@ -868,7 +868,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc *
|
|||
goto done;
|
||||
}
|
||||
|
||||
sk = rfcomm_sock_alloc(parent->sk_net, NULL, BTPROTO_RFCOMM, GFP_ATOMIC);
|
||||
sk = rfcomm_sock_alloc(sock_net(parent), NULL, BTPROTO_RFCOMM, GFP_ATOMIC);
|
||||
if (!sk)
|
||||
goto done;
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ static void sco_conn_ready(struct sco_conn *conn)
|
|||
|
||||
bh_lock_sock(parent);
|
||||
|
||||
sk = sco_sock_alloc(parent->sk_net, NULL, BTPROTO_SCO, GFP_ATOMIC);
|
||||
sk = sco_sock_alloc(sock_net(parent), NULL, BTPROTO_SCO, GFP_ATOMIC);
|
||||
if (!sk) {
|
||||
bh_unlock_sock(parent);
|
||||
goto done;
|
||||
|
|
|
@ -108,7 +108,7 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
|
|||
*/
|
||||
static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct net_device *dev;
|
||||
int idx;
|
||||
|
||||
|
@ -140,7 +140,7 @@ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
*/
|
||||
static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifinfomsg *ifm;
|
||||
struct nlattr *protinfo;
|
||||
struct net_device *dev;
|
||||
|
|
|
@ -37,7 +37,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
|
|||
struct net_bridge_port *p = dev->br_port;
|
||||
struct net_bridge *br;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* not a port of a bridge */
|
||||
|
|
|
@ -142,7 +142,7 @@ int br_stp_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
struct net_bridge *br;
|
||||
const unsigned char *buf;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto err;
|
||||
|
||||
if (!p)
|
||||
|
|
|
@ -599,7 +599,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
struct dev_rcv_lists *d;
|
||||
int matches;
|
||||
|
||||
if (dev->type != ARPHRD_CAN || dev->nd_net != &init_net) {
|
||||
if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) {
|
||||
kfree_skb(skb);
|
||||
return 0;
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
|
|||
struct net_device *dev = (struct net_device *)data;
|
||||
struct dev_rcv_lists *d;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->type != ARPHRD_CAN)
|
||||
|
|
|
@ -1285,7 +1285,7 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
|
|||
struct bcm_op *op;
|
||||
int notify_enodev = 0;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->type != ARPHRD_CAN)
|
||||
|
|
|
@ -210,7 +210,7 @@ static int raw_notifier(struct notifier_block *nb,
|
|||
struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
|
||||
struct sock *sk = &ro->sk;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (dev->type != ARPHRD_CAN)
|
||||
|
|
|
@ -216,7 +216,7 @@ static inline struct hlist_head *dev_index_hash(struct net *net, int ifindex)
|
|||
/* Device list insertion */
|
||||
static int list_netdevice(struct net_device *dev)
|
||||
{
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
||||
|
@ -852,8 +852,8 @@ int dev_alloc_name(struct net_device *dev, const char *name)
|
|||
struct net *net;
|
||||
int ret;
|
||||
|
||||
BUG_ON(!dev->nd_net);
|
||||
net = dev->nd_net;
|
||||
BUG_ON(!dev_net(dev));
|
||||
net = dev_net(dev);
|
||||
ret = __dev_alloc_name(net, name, buf);
|
||||
if (ret >= 0)
|
||||
strlcpy(dev->name, buf, IFNAMSIZ);
|
||||
|
@ -877,9 +877,9 @@ int dev_change_name(struct net_device *dev, char *newname)
|
|||
struct net *net;
|
||||
|
||||
ASSERT_RTNL();
|
||||
BUG_ON(!dev->nd_net);
|
||||
BUG_ON(!dev_net(dev));
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
if (dev->flags & IFF_UP)
|
||||
return -EBUSY;
|
||||
|
||||
|
@ -2615,7 +2615,7 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
|
|||
|
||||
if (v == SEQ_START_TOKEN)
|
||||
seq_puts(seq, "Type Device Function\n");
|
||||
else if (pt->dev == NULL || pt->dev->nd_net == seq_file_net(seq)) {
|
||||
else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) {
|
||||
if (pt->type == htons(ETH_P_ALL))
|
||||
seq_puts(seq, "ALL ");
|
||||
else
|
||||
|
@ -3689,8 +3689,8 @@ int register_netdevice(struct net_device *dev)
|
|||
|
||||
/* When net_device's are persistent, this will be fatal. */
|
||||
BUG_ON(dev->reg_state != NETREG_UNINITIALIZED);
|
||||
BUG_ON(!dev->nd_net);
|
||||
net = dev->nd_net;
|
||||
BUG_ON(!dev_net(dev));
|
||||
net = dev_net(dev);
|
||||
|
||||
spin_lock_init(&dev->queue_lock);
|
||||
spin_lock_init(&dev->_xmit_lock);
|
||||
|
@ -4011,7 +4011,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
|
|||
dev = (struct net_device *)
|
||||
(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
|
||||
dev->padded = (char *)dev - (char *)p;
|
||||
dev->nd_net = &init_net;
|
||||
dev_net_set(dev, &init_net);
|
||||
|
||||
if (sizeof_priv) {
|
||||
dev->priv = ((char *)dev +
|
||||
|
@ -4136,7 +4136,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
|
|||
|
||||
/* Get out if there is nothing todo */
|
||||
err = 0;
|
||||
if (dev->nd_net == net)
|
||||
if (net_eq(dev_net(dev), net))
|
||||
goto out;
|
||||
|
||||
/* Pick the destination device name, and ensure
|
||||
|
@ -4187,7 +4187,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
|
|||
dev_addr_discard(dev);
|
||||
|
||||
/* Actually switch the network namespace */
|
||||
dev->nd_net = net;
|
||||
dev_net_set(dev, net);
|
||||
|
||||
/* Assign the new device name */
|
||||
if (destname != dev->name)
|
||||
|
|
|
@ -279,7 +279,7 @@ static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev,
|
|||
if (!unregister) {
|
||||
dst->input = dst->output = dst_discard;
|
||||
} else {
|
||||
dst->dev = dst->dev->nd_net->loopback_dev;
|
||||
dst->dev = dev_net(dst->dev)->loopback_dev;
|
||||
dev_hold(dst->dev);
|
||||
dev_put(dev);
|
||||
if (dst->neighbour && dst->neighbour->dev == dev) {
|
||||
|
|
|
@ -214,7 +214,7 @@ static int validate_rulemsg(struct fib_rule_hdr *frh, struct nlattr **tb,
|
|||
|
||||
static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
||||
struct fib_rules_ops *ops = NULL;
|
||||
struct fib_rule *rule, *r, *last = NULL;
|
||||
|
@ -352,7 +352,7 @@ static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
|||
|
||||
static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib_rule_hdr *frh = nlmsg_data(nlh);
|
||||
struct fib_rules_ops *ops = NULL;
|
||||
struct fib_rule *rule, *tmp;
|
||||
|
@ -534,7 +534,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
|
|||
|
||||
static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib_rules_ops *ops;
|
||||
int idx = 0, family;
|
||||
|
||||
|
@ -618,7 +618,7 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event,
|
|||
void *ptr)
|
||||
{
|
||||
struct net_device *dev = ptr;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct fib_rules_ops *ops;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
|
|
@ -388,7 +388,7 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net,
|
|||
hash_val = tbl->hash(pkey, NULL);
|
||||
for (n = tbl->hash_buckets[hash_val & tbl->hash_mask]; n; n = n->next) {
|
||||
if (!memcmp(n->primary_key, pkey, key_len) &&
|
||||
(net == n->dev->nd_net)) {
|
||||
net_eq(dev_net(n->dev), net)) {
|
||||
neigh_hold(n);
|
||||
NEIGH_CACHE_STAT_INC(tbl, hits);
|
||||
break;
|
||||
|
@ -483,7 +483,7 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
|
|||
|
||||
for (n = tbl->phash_buckets[hash_val]; n; n = n->next) {
|
||||
if (!memcmp(n->key, pkey, key_len) &&
|
||||
(n->net == net) &&
|
||||
net_eq(pneigh_net(n), net) &&
|
||||
(n->dev == dev || !n->dev)) {
|
||||
read_unlock_bh(&tbl->lock);
|
||||
goto out;
|
||||
|
@ -500,7 +500,9 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
|
|||
if (!n)
|
||||
goto out;
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
n->net = hold_net(net);
|
||||
#endif
|
||||
memcpy(n->key, pkey, key_len);
|
||||
n->dev = dev;
|
||||
if (dev)
|
||||
|
@ -540,14 +542,14 @@ int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey,
|
|||
for (np = &tbl->phash_buckets[hash_val]; (n = *np) != NULL;
|
||||
np = &n->next) {
|
||||
if (!memcmp(n->key, pkey, key_len) && n->dev == dev &&
|
||||
(n->net == net)) {
|
||||
net_eq(pneigh_net(n), net)) {
|
||||
*np = n->next;
|
||||
write_unlock_bh(&tbl->lock);
|
||||
if (tbl->pdestructor)
|
||||
tbl->pdestructor(n);
|
||||
if (n->dev)
|
||||
dev_put(n->dev);
|
||||
release_net(n->net);
|
||||
release_net(pneigh_net(n));
|
||||
kfree(n);
|
||||
return 0;
|
||||
}
|
||||
|
@ -570,7 +572,7 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev)
|
|||
tbl->pdestructor(n);
|
||||
if (n->dev)
|
||||
dev_put(n->dev);
|
||||
release_net(n->net);
|
||||
release_net(pneigh_net(n));
|
||||
kfree(n);
|
||||
continue;
|
||||
}
|
||||
|
@ -1284,7 +1286,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
|
|||
struct neigh_parms *p;
|
||||
|
||||
for (p = &tbl->parms; p; p = p->next) {
|
||||
if ((p->dev && p->dev->ifindex == ifindex && p->net == net) ||
|
||||
if ((p->dev && p->dev->ifindex == ifindex && net_eq(neigh_parms_net(p), net)) ||
|
||||
(!p->dev && !ifindex))
|
||||
return p;
|
||||
}
|
||||
|
@ -1298,7 +1300,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
|
|||
struct neigh_parms *p, *ref;
|
||||
struct net *net;
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
ref = lookup_neigh_params(tbl, net, 0);
|
||||
if (!ref)
|
||||
return NULL;
|
||||
|
@ -1318,7 +1320,9 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
|
|||
|
||||
dev_hold(dev);
|
||||
p->dev = dev;
|
||||
#ifdef CONFIG_NET_NS
|
||||
p->net = hold_net(net);
|
||||
#endif
|
||||
p->sysctl_table = NULL;
|
||||
write_lock_bh(&tbl->lock);
|
||||
p->next = tbl->parms.next;
|
||||
|
@ -1360,7 +1364,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
|
|||
|
||||
static void neigh_parms_destroy(struct neigh_parms *parms)
|
||||
{
|
||||
release_net(parms->net);
|
||||
release_net(neigh_parms_net(parms));
|
||||
kfree(parms);
|
||||
}
|
||||
|
||||
|
@ -1371,7 +1375,9 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
|
|||
unsigned long now = jiffies;
|
||||
unsigned long phsize;
|
||||
|
||||
#ifdef CONFIG_NET_NS
|
||||
tbl->parms.net = &init_net;
|
||||
#endif
|
||||
atomic_set(&tbl->parms.refcnt, 1);
|
||||
INIT_RCU_HEAD(&tbl->parms.rcu_head);
|
||||
tbl->parms.reachable_time =
|
||||
|
@ -1478,7 +1484,7 @@ int neigh_table_clear(struct neigh_table *tbl)
|
|||
|
||||
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ndmsg *ndm;
|
||||
struct nlattr *dst_attr;
|
||||
struct neigh_table *tbl;
|
||||
|
@ -1544,7 +1550,7 @@ static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
|||
|
||||
static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ndmsg *ndm;
|
||||
struct nlattr *tb[NDA_MAX+1];
|
||||
struct neigh_table *tbl;
|
||||
|
@ -1812,7 +1818,7 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
|
|||
|
||||
static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct neigh_table *tbl;
|
||||
struct ndtmsg *ndtmsg;
|
||||
struct nlattr *tb[NDTA_MAX+1];
|
||||
|
@ -1937,7 +1943,7 @@ static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
|||
|
||||
static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int family, tidx, nidx = 0;
|
||||
int tbl_skip = cb->args[0];
|
||||
int neigh_skip = cb->args[1];
|
||||
|
@ -1958,7 +1964,7 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
break;
|
||||
|
||||
for (nidx = 0, p = tbl->parms.next; p; p = p->next) {
|
||||
if (net != p->net)
|
||||
if (!net_eq(neigh_parms_net(p), net))
|
||||
continue;
|
||||
|
||||
if (nidx++ < neigh_skip)
|
||||
|
@ -2037,7 +2043,7 @@ static void neigh_update_notify(struct neighbour *neigh)
|
|||
static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
||||
struct netlink_callback *cb)
|
||||
{
|
||||
struct net * net = skb->sk->sk_net;
|
||||
struct net * net = sock_net(skb->sk);
|
||||
struct neighbour *n;
|
||||
int rc, h, s_h = cb->args[1];
|
||||
int idx, s_idx = idx = cb->args[2];
|
||||
|
@ -2050,7 +2056,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb,
|
|||
s_idx = 0;
|
||||
for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) {
|
||||
int lidx;
|
||||
if (n->dev->nd_net != net)
|
||||
if (dev_net(n->dev) != net)
|
||||
continue;
|
||||
lidx = idx++;
|
||||
if (lidx < s_idx)
|
||||
|
@ -2145,7 +2151,7 @@ EXPORT_SYMBOL(__neigh_for_each_release);
|
|||
static struct neighbour *neigh_get_first(struct seq_file *seq)
|
||||
{
|
||||
struct neigh_seq_state *state = seq->private;
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
struct neigh_table *tbl = state->tbl;
|
||||
struct neighbour *n = NULL;
|
||||
int bucket = state->bucket;
|
||||
|
@ -2155,7 +2161,7 @@ static struct neighbour *neigh_get_first(struct seq_file *seq)
|
|||
n = tbl->hash_buckets[bucket];
|
||||
|
||||
while (n) {
|
||||
if (n->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(n->dev), net))
|
||||
goto next;
|
||||
if (state->neigh_sub_iter) {
|
||||
loff_t fakep = 0;
|
||||
|
@ -2186,7 +2192,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq,
|
|||
loff_t *pos)
|
||||
{
|
||||
struct neigh_seq_state *state = seq->private;
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
struct neigh_table *tbl = state->tbl;
|
||||
|
||||
if (state->neigh_sub_iter) {
|
||||
|
@ -2198,7 +2204,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq,
|
|||
|
||||
while (1) {
|
||||
while (n) {
|
||||
if (n->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(n->dev), net))
|
||||
goto next;
|
||||
if (state->neigh_sub_iter) {
|
||||
void *v = state->neigh_sub_iter(state, n, pos);
|
||||
|
@ -2246,7 +2252,7 @@ static struct neighbour *neigh_get_idx(struct seq_file *seq, loff_t *pos)
|
|||
static struct pneigh_entry *pneigh_get_first(struct seq_file *seq)
|
||||
{
|
||||
struct neigh_seq_state *state = seq->private;
|
||||
struct net * net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
struct neigh_table *tbl = state->tbl;
|
||||
struct pneigh_entry *pn = NULL;
|
||||
int bucket = state->bucket;
|
||||
|
@ -2254,7 +2260,7 @@ static struct pneigh_entry *pneigh_get_first(struct seq_file *seq)
|
|||
state->flags |= NEIGH_SEQ_IS_PNEIGH;
|
||||
for (bucket = 0; bucket <= PNEIGH_HASHMASK; bucket++) {
|
||||
pn = tbl->phash_buckets[bucket];
|
||||
while (pn && (pn->net != net))
|
||||
while (pn && !net_eq(pneigh_net(pn), net))
|
||||
pn = pn->next;
|
||||
if (pn)
|
||||
break;
|
||||
|
@ -2269,7 +2275,7 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
|
|||
loff_t *pos)
|
||||
{
|
||||
struct neigh_seq_state *state = seq->private;
|
||||
struct net * net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
struct neigh_table *tbl = state->tbl;
|
||||
|
||||
pn = pn->next;
|
||||
|
@ -2277,7 +2283,7 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq,
|
|||
if (++state->bucket > PNEIGH_HASHMASK)
|
||||
break;
|
||||
pn = tbl->phash_buckets[state->bucket];
|
||||
while (pn && (pn->net != net))
|
||||
while (pn && !net_eq(pneigh_net(pn), net))
|
||||
pn = pn->next;
|
||||
if (pn)
|
||||
break;
|
||||
|
@ -2482,7 +2488,7 @@ static inline size_t neigh_nlmsg_size(void)
|
|||
|
||||
static void __neigh_notify(struct neighbour *n, int type, int flags)
|
||||
{
|
||||
struct net *net = n->dev->nd_net;
|
||||
struct net *net = dev_net(n->dev);
|
||||
struct sk_buff *skb;
|
||||
int err = -ENOBUFS;
|
||||
|
||||
|
@ -2740,7 +2746,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
|
|||
neigh_path[NEIGH_CTL_PATH_PROTO].ctl_name = p_id;
|
||||
|
||||
t->sysctl_header =
|
||||
register_net_sysctl_table(p->net, neigh_path, t->neigh_vars);
|
||||
register_net_sysctl_table(neigh_parms_net(p), neigh_path, t->neigh_vars);
|
||||
if (!t->sysctl_header)
|
||||
goto free_procname;
|
||||
|
||||
|
|
|
@ -1874,7 +1874,7 @@ static int pktgen_device_event(struct notifier_block *unused,
|
|||
{
|
||||
struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* It is OK that we do not hold the group lock right now,
|
||||
|
|
|
@ -662,7 +662,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
|
|||
|
||||
static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int idx;
|
||||
int s_idx = cb->args[0];
|
||||
struct net_device *dev;
|
||||
|
@ -879,7 +879,7 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
|
|||
|
||||
static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifinfomsg *ifm;
|
||||
struct net_device *dev;
|
||||
int err;
|
||||
|
@ -921,7 +921,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
|||
|
||||
static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
const struct rtnl_link_ops *ops;
|
||||
struct net_device *dev;
|
||||
struct ifinfomsg *ifm;
|
||||
|
@ -972,7 +972,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
|
|||
goto err_free;
|
||||
}
|
||||
|
||||
dev->nd_net = net;
|
||||
dev_net_set(dev, net);
|
||||
dev->rtnl_link_ops = ops;
|
||||
|
||||
if (tb[IFLA_MTU])
|
||||
|
@ -1000,7 +1000,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname,
|
|||
|
||||
static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
const struct rtnl_link_ops *ops;
|
||||
struct net_device *dev;
|
||||
struct ifinfomsg *ifm;
|
||||
|
@ -1132,7 +1132,7 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
|||
|
||||
static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifinfomsg *ifm;
|
||||
struct nlattr *tb[IFLA_MAX+1];
|
||||
struct net_device *dev = NULL;
|
||||
|
@ -1198,7 +1198,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
|
||||
void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
|
||||
{
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct sk_buff *skb;
|
||||
int err = -ENOBUFS;
|
||||
|
||||
|
@ -1227,7 +1227,7 @@ static int rtattr_max;
|
|||
|
||||
static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
rtnl_doit_func doit;
|
||||
int sz_idx, kind;
|
||||
int min_len;
|
||||
|
|
|
@ -372,7 +372,7 @@ static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen)
|
|||
{
|
||||
int ret = -ENOPROTOOPT;
|
||||
#ifdef CONFIG_NETDEVICES
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
char devname[IFNAMSIZ];
|
||||
int index;
|
||||
|
||||
|
@ -958,7 +958,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
|
|||
*/
|
||||
sk->sk_prot = sk->sk_prot_creator = prot;
|
||||
sock_lock_init(sk);
|
||||
sk->sk_net = get_net(net);
|
||||
sock_net_set(sk, get_net(net));
|
||||
}
|
||||
|
||||
return sk;
|
||||
|
@ -983,7 +983,7 @@ void sk_free(struct sock *sk)
|
|||
printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n",
|
||||
__func__, atomic_read(&sk->sk_omem_alloc));
|
||||
|
||||
put_net(sk->sk_net);
|
||||
put_net(sock_net(sk));
|
||||
sk_prot_free(sk->sk_prot_creator, sk);
|
||||
}
|
||||
|
||||
|
@ -1001,7 +1001,7 @@ void sk_release_kernel(struct sock *sk)
|
|||
|
||||
sock_hold(sk);
|
||||
sock_release(sk->sk_socket);
|
||||
sk->sk_net = get_net(&init_net);
|
||||
sock_net_set(sk, get_net(&init_net));
|
||||
sock_put(sk);
|
||||
}
|
||||
EXPORT_SYMBOL(sk_release_kernel);
|
||||
|
@ -1017,7 +1017,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
|
|||
sock_copy(newsk, sk);
|
||||
|
||||
/* SANITY */
|
||||
get_net(newsk->sk_net);
|
||||
get_net(sock_net(newsk));
|
||||
sk_node_init(&newsk->sk_node);
|
||||
sock_lock_init(newsk);
|
||||
bh_lock_sock(newsk);
|
||||
|
|
|
@ -1094,7 +1094,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags)
|
|||
|
||||
cb = DN_SKB_CB(skb);
|
||||
sk->sk_ack_backlog--;
|
||||
newsk = dn_alloc_sock(sk->sk_net, newsock, sk->sk_allocation);
|
||||
newsk = dn_alloc_sock(sock_net(sk), newsock, sk->sk_allocation);
|
||||
if (newsk == NULL) {
|
||||
release_sock(sk);
|
||||
kfree_skb(skb);
|
||||
|
@ -2089,7 +2089,7 @@ static int dn_device_event(struct notifier_block *this, unsigned long event,
|
|||
{
|
||||
struct net_device *dev = (struct net_device *)ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
switch(event) {
|
||||
|
|
|
@ -625,7 +625,7 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {
|
|||
|
||||
static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct dn_dev *dn_db;
|
||||
struct ifaddrmsg *ifm;
|
||||
|
@ -663,7 +663,7 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
|||
|
||||
static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct net_device *dev;
|
||||
struct dn_dev *dn_db;
|
||||
|
@ -779,7 +779,7 @@ static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)
|
|||
|
||||
static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int idx, dn_idx = 0, skip_ndevs, skip_naddr;
|
||||
struct net_device *dev;
|
||||
struct dn_dev *dn_db;
|
||||
|
|
|
@ -504,7 +504,7 @@ static int dn_fib_check_attr(struct rtmsg *r, struct rtattr **rta)
|
|||
|
||||
static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct dn_fib_table *tb;
|
||||
struct rtattr **rta = arg;
|
||||
struct rtmsg *r = NLMSG_DATA(nlh);
|
||||
|
@ -524,7 +524,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *
|
|||
|
||||
static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct dn_fib_table *tb;
|
||||
struct rtattr **rta = arg;
|
||||
struct rtmsg *r = NLMSG_DATA(nlh);
|
||||
|
|
|
@ -580,7 +580,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
|
|||
struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr;
|
||||
unsigned char padlen = 0;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto dump_it;
|
||||
|
||||
if (dn == NULL)
|
||||
|
@ -1512,7 +1512,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq,
|
|||
*/
|
||||
static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = in_skb->sk->sk_net;
|
||||
struct net *net = sock_net(in_skb->sk);
|
||||
struct rtattr **rta = arg;
|
||||
struct rtmsg *rtm = NLMSG_DATA(nlh);
|
||||
struct dn_route *rt = NULL;
|
||||
|
@ -1601,7 +1601,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
|
|||
*/
|
||||
int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct dn_route *rt;
|
||||
int h, s_h;
|
||||
int idx, s_idx;
|
||||
|
|
|
@ -463,7 +463,7 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb,
|
|||
|
||||
int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
unsigned int h, s_h;
|
||||
unsigned int e = 0, s_e;
|
||||
struct dn_fib_table *tb;
|
||||
|
|
|
@ -1064,7 +1064,7 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
|
|||
struct sock *sk;
|
||||
struct ec_device *edev = dev->ec_ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
if (skb->pkt_type == PACKET_OTHERHOST)
|
||||
|
@ -1121,7 +1121,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void
|
|||
struct net_device *dev = (struct net_device *)data;
|
||||
struct ec_device *edev;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
switch (msg) {
|
||||
|
|
|
@ -464,7 +464,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
|||
if (addr_len < sizeof(struct sockaddr_in))
|
||||
goto out;
|
||||
|
||||
chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr);
|
||||
chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
|
||||
|
||||
/* Not specified by any standard per-se, however it breaks too
|
||||
* many applications when removed. It is unfortunate since
|
||||
|
@ -802,7 +802,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
|||
{
|
||||
struct sock *sk = sock->sk;
|
||||
int err = 0;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGSTAMP:
|
||||
|
@ -1132,7 +1132,7 @@ int inet_sk_rebuild_header(struct sock *sk)
|
|||
};
|
||||
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0);
|
||||
err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0);
|
||||
}
|
||||
if (!err)
|
||||
sk_setup_caps(sk, &rt->u.dst);
|
||||
|
|
|
@ -242,7 +242,7 @@ static int arp_constructor(struct neighbour *neigh)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
neigh->type = inet_addr_type(dev->nd_net, addr);
|
||||
neigh->type = inet_addr_type(dev_net(dev), addr);
|
||||
|
||||
parms = in_dev->arp_parms;
|
||||
__neigh_parms_put(neigh->parms);
|
||||
|
@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
|
|||
switch (IN_DEV_ARP_ANNOUNCE(in_dev)) {
|
||||
default:
|
||||
case 0: /* By default announce any local IP */
|
||||
if (skb && inet_addr_type(dev->nd_net, ip_hdr(skb)->saddr) == RTN_LOCAL)
|
||||
if (skb && inet_addr_type(dev_net(dev), ip_hdr(skb)->saddr) == RTN_LOCAL)
|
||||
saddr = ip_hdr(skb)->saddr;
|
||||
break;
|
||||
case 1: /* Restrict announcements of saddr in same subnet */
|
||||
if (!skb)
|
||||
break;
|
||||
saddr = ip_hdr(skb)->saddr;
|
||||
if (inet_addr_type(dev->nd_net, saddr) == RTN_LOCAL) {
|
||||
if (inet_addr_type(dev_net(dev), saddr) == RTN_LOCAL) {
|
||||
/* saddr should be known to target */
|
||||
if (inet_addr_onlink(in_dev, target, saddr))
|
||||
break;
|
||||
|
@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
|
|||
int flag = 0;
|
||||
/*unsigned long now; */
|
||||
|
||||
if (ip_route_output_key(dev->nd_net, &rt, &fl) < 0)
|
||||
if (ip_route_output_key(dev_net(dev), &rt, &fl) < 0)
|
||||
return 1;
|
||||
if (rt->u.dst.dev != dev) {
|
||||
NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
|
||||
|
@ -477,7 +477,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
|
|||
|
||||
paddr = skb->rtable->rt_gateway;
|
||||
|
||||
if (arp_set_predefined(inet_addr_type(dev->nd_net, paddr), haddr, paddr, dev))
|
||||
if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev))
|
||||
return 0;
|
||||
|
||||
n = __neigh_lookup(&arp_tbl, &paddr, dev, 1);
|
||||
|
@ -709,7 +709,7 @@ static int arp_process(struct sk_buff *skb)
|
|||
u16 dev_type = dev->type;
|
||||
int addr_type;
|
||||
struct neighbour *n;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
|
||||
/* arp_rcv below verifies the ARP header and verifies the device
|
||||
* is ARP'able.
|
||||
|
@ -858,7 +858,7 @@ static int arp_process(struct sk_buff *skb)
|
|||
|
||||
n = __neigh_lookup(&arp_tbl, &sip, dev, 0);
|
||||
|
||||
if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) {
|
||||
if (IPV4_DEVCONF_ALL(dev_net(dev), ARP_ACCEPT)) {
|
||||
/* Unsolicited ARP is not accepted by default.
|
||||
It is possible, that this option should be enabled for some
|
||||
devices (strip is candidate)
|
||||
|
|
|
@ -165,7 +165,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
|
|||
if (!in_dev)
|
||||
goto out;
|
||||
INIT_RCU_HEAD(&in_dev->rcu_head);
|
||||
memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt,
|
||||
memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt,
|
||||
sizeof(in_dev->cnf));
|
||||
in_dev->cnf.sysctl = NULL;
|
||||
in_dev->dev = dev;
|
||||
|
@ -437,7 +437,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
|
|||
|
||||
static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct in_device *in_dev;
|
||||
struct ifaddrmsg *ifm;
|
||||
|
@ -552,7 +552,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh)
|
|||
|
||||
static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct in_ifaddr *ifa;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
@ -872,7 +872,7 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope)
|
|||
{
|
||||
__be32 addr = 0;
|
||||
struct in_device *in_dev;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
|
||||
rcu_read_lock();
|
||||
in_dev = __in_dev_get_rcu(dev);
|
||||
|
@ -974,7 +974,7 @@ __be32 inet_confirm_addr(struct in_device *in_dev,
|
|||
if (scope != RT_SCOPE_LINK)
|
||||
return confirm_addr_indev(in_dev, dst, local, scope);
|
||||
|
||||
net = in_dev->dev->nd_net;
|
||||
net = dev_net(in_dev->dev);
|
||||
read_lock(&dev_base_lock);
|
||||
rcu_read_lock();
|
||||
for_each_netdev(net, dev) {
|
||||
|
@ -1158,7 +1158,7 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
|
|||
|
||||
static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int idx, ip_idx;
|
||||
struct net_device *dev;
|
||||
struct in_device *in_dev;
|
||||
|
@ -1203,7 +1203,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,
|
|||
int err = -ENOBUFS;
|
||||
struct net *net;
|
||||
|
||||
net = ifa->ifa_dev->dev->nd_net;
|
||||
net = dev_net(ifa->ifa_dev->dev);
|
||||
skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL);
|
||||
if (skb == NULL)
|
||||
goto errout;
|
||||
|
@ -1517,7 +1517,7 @@ static void devinet_sysctl_register(struct in_device *idev)
|
|||
{
|
||||
neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4,
|
||||
NET_IPV4_NEIGH, "ipv4", NULL, NULL);
|
||||
__devinet_sysctl_register(idev->dev->nd_net, idev->dev->name,
|
||||
__devinet_sysctl_register(dev_net(idev->dev), idev->dev->name,
|
||||
idev->dev->ifindex, &idev->cnf);
|
||||
}
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
|||
if (in_dev == NULL)
|
||||
goto e_inval;
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
if (fib_lookup(net, &fl, &res))
|
||||
goto last_resort;
|
||||
if (res.type != RTN_UNICAST)
|
||||
|
@ -583,7 +583,7 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
|
|||
|
||||
static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib_config cfg;
|
||||
struct fib_table *tb;
|
||||
int err;
|
||||
|
@ -605,7 +605,7 @@ static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
|
|||
|
||||
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib_config cfg;
|
||||
struct fib_table *tb;
|
||||
int err;
|
||||
|
@ -627,7 +627,7 @@ static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *ar
|
|||
|
||||
static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
unsigned int h, s_h;
|
||||
unsigned int e = 0, s_e;
|
||||
struct fib_table *tb;
|
||||
|
@ -674,7 +674,7 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
|
||||
static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa)
|
||||
{
|
||||
struct net *net = ifa->ifa_dev->dev->nd_net;
|
||||
struct net *net = dev_net(ifa->ifa_dev->dev);
|
||||
struct fib_table *tb;
|
||||
struct fib_config cfg = {
|
||||
.fc_protocol = RTPROT_KERNEL,
|
||||
|
@ -801,15 +801,15 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa)
|
|||
fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim);
|
||||
|
||||
/* Check, that this local address finally disappeared. */
|
||||
if (inet_addr_type(dev->nd_net, ifa->ifa_local) != RTN_LOCAL) {
|
||||
if (inet_addr_type(dev_net(dev), ifa->ifa_local) != RTN_LOCAL) {
|
||||
/* And the last, but not the least thing.
|
||||
We must flush stray FIB entries.
|
||||
|
||||
First of all, we scan fib_info list searching
|
||||
for stray nexthop entries, then ignite fib_flush.
|
||||
*/
|
||||
if (fib_sync_down_addr(dev->nd_net, ifa->ifa_local))
|
||||
fib_flush(dev->nd_net);
|
||||
if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local))
|
||||
fib_flush(dev_net(dev));
|
||||
}
|
||||
}
|
||||
#undef LOCAL_OK
|
||||
|
@ -857,7 +857,7 @@ static void nl_fib_input(struct sk_buff *skb)
|
|||
struct fib_table *tb;
|
||||
u32 pid;
|
||||
|
||||
net = skb->sk->sk_net;
|
||||
net = sock_net(skb->sk);
|
||||
nlh = nlmsg_hdr(skb);
|
||||
if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len ||
|
||||
nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn)))
|
||||
|
@ -899,7 +899,7 @@ static void nl_fib_lookup_exit(struct net *net)
|
|||
static void fib_disable_ip(struct net_device *dev, int force)
|
||||
{
|
||||
if (fib_sync_down_dev(dev, force))
|
||||
fib_flush(dev->nd_net);
|
||||
fib_flush(dev_net(dev));
|
||||
rt_cache_flush(0);
|
||||
arp_ifdown(dev);
|
||||
}
|
||||
|
|
|
@ -821,7 +821,7 @@ static struct fib_alias *fib_get_first(struct seq_file *seq)
|
|||
struct fib_table *main_table;
|
||||
struct fn_hash *table;
|
||||
|
||||
main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN);
|
||||
main_table = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN);
|
||||
table = (struct fn_hash *)main_table->tb_data;
|
||||
|
||||
iter->bucket = 0;
|
||||
|
@ -959,11 +959,10 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos)
|
|||
static void *fib_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
__acquires(fib_hash_lock)
|
||||
{
|
||||
struct fib_iter_state *iter = seq->private;
|
||||
void *v = NULL;
|
||||
|
||||
read_lock(&fib_hash_lock);
|
||||
if (fib_get_table(iter->p.net, RT_TABLE_MAIN))
|
||||
if (fib_get_table(seq_file_net(seq), RT_TABLE_MAIN))
|
||||
v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
|
||||
return v;
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
|
|||
struct nlmsghdr *nlh, struct fib_rule_hdr *frh,
|
||||
struct nlattr **tb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int err = -EINVAL;
|
||||
struct fib4_rule *rule4 = (struct fib4_rule *) rule;
|
||||
|
||||
|
|
|
@ -2279,9 +2279,10 @@ static const struct file_operations fib_triestat_fops = {
|
|||
.release = fib_triestat_seq_release,
|
||||
};
|
||||
|
||||
static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos)
|
||||
static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos)
|
||||
{
|
||||
struct net *net = iter->p.net;
|
||||
struct fib_trie_iter *iter = seq->private;
|
||||
struct net *net = seq_file_net(seq);
|
||||
loff_t idx = 0;
|
||||
unsigned int h;
|
||||
|
||||
|
@ -2309,16 +2310,14 @@ static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos)
|
|||
static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
__acquires(RCU)
|
||||
{
|
||||
struct fib_trie_iter *iter = seq->private;
|
||||
|
||||
rcu_read_lock();
|
||||
return fib_trie_get_idx(iter, *pos);
|
||||
return fib_trie_get_idx(seq, *pos);
|
||||
}
|
||||
|
||||
static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
{
|
||||
struct fib_trie_iter *iter = seq->private;
|
||||
struct net *net = iter->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
struct fib_table *tb = iter->tb;
|
||||
struct hlist_node *tb_node;
|
||||
unsigned int h;
|
||||
|
@ -2513,7 +2512,7 @@ static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos)
|
|||
struct fib_table *tb;
|
||||
|
||||
rcu_read_lock();
|
||||
tb = fib_get_table(iter->p.net, RT_TABLE_MAIN);
|
||||
tb = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN);
|
||||
if (!tb)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
|
|||
struct sock *sk;
|
||||
struct sk_buff *skb;
|
||||
|
||||
sk = icmp_sk(rt->u.dst.dev->nd_net);
|
||||
sk = icmp_sk(dev_net(rt->u.dst.dev));
|
||||
if (ip_append_data(sk, icmp_glue_bits, icmp_param,
|
||||
icmp_param->data_len+icmp_param->head_len,
|
||||
icmp_param->head_len,
|
||||
|
@ -382,7 +382,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
|
|||
{
|
||||
struct ipcm_cookie ipc;
|
||||
struct rtable *rt = skb->rtable;
|
||||
struct net *net = rt->u.dst.dev->nd_net;
|
||||
struct net *net = dev_net(rt->u.dst.dev);
|
||||
struct sock *sk = icmp_sk(net);
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
__be32 daddr;
|
||||
|
@ -447,7 +447,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
|
|||
|
||||
if (!rt)
|
||||
goto out;
|
||||
net = rt->u.dst.dev->nd_net;
|
||||
net = dev_net(rt->u.dst.dev);
|
||||
sk = icmp_sk(net);
|
||||
|
||||
/*
|
||||
|
@ -677,7 +677,7 @@ static void icmp_unreach(struct sk_buff *skb)
|
|||
u32 info = 0;
|
||||
struct net *net;
|
||||
|
||||
net = skb->dst->dev->nd_net;
|
||||
net = dev_net(skb->dst->dev);
|
||||
|
||||
/*
|
||||
* Incomplete header ?
|
||||
|
|
|
@ -130,12 +130,12 @@
|
|||
*/
|
||||
|
||||
#define IGMP_V1_SEEN(in_dev) \
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \
|
||||
(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 1 || \
|
||||
IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \
|
||||
((in_dev)->mr_v1_seen && \
|
||||
time_before(jiffies, (in_dev)->mr_v1_seen)))
|
||||
#define IGMP_V2_SEEN(in_dev) \
|
||||
(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \
|
||||
(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 2 || \
|
||||
IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \
|
||||
((in_dev)->mr_v2_seen && \
|
||||
time_before(jiffies, (in_dev)->mr_v2_seen)))
|
||||
|
@ -1198,7 +1198,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
|
|||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
for (im=in_dev->mc_list; im; im=im->next) {
|
||||
|
@ -1280,7 +1280,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr)
|
|||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) {
|
||||
|
@ -1310,7 +1310,7 @@ void ip_mc_down(struct in_device *in_dev)
|
|||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
for (i=in_dev->mc_list; i; i=i->next)
|
||||
|
@ -1333,7 +1333,7 @@ void ip_mc_init_dev(struct in_device *in_dev)
|
|||
{
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
in_dev->mc_tomb = NULL;
|
||||
|
@ -1359,7 +1359,7 @@ void ip_mc_up(struct in_device *in_dev)
|
|||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS);
|
||||
|
@ -1378,7 +1378,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
|
|||
|
||||
ASSERT_RTNL();
|
||||
|
||||
if (in_dev->dev->nd_net != &init_net)
|
||||
if (dev_net(in_dev->dev) != &init_net)
|
||||
return;
|
||||
|
||||
/* Deactivate timers */
|
||||
|
@ -1762,7 +1762,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
|
|||
if (!ipv4_is_multicast(addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -1833,7 +1833,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr)
|
|||
u32 ifindex;
|
||||
int ret = -EADDRNOTAVAIL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -1881,7 +1881,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
|
|||
if (!ipv4_is_multicast(addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -2017,7 +2017,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
|
|||
msf->imsf_fmode != MCAST_EXCLUDE)
|
||||
return -EINVAL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -2100,7 +2100,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf,
|
|||
if (!ipv4_is_multicast(addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -2165,7 +2165,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf,
|
|||
if (!ipv4_is_multicast(addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
rtnl_lock();
|
||||
|
@ -2252,7 +2252,7 @@ void ip_mc_drop_socket(struct sock *sk)
|
|||
if (inet->mc_list == NULL)
|
||||
return;
|
||||
|
||||
if (sk->sk_net != &init_net)
|
||||
if (sock_net(sk) != &init_net)
|
||||
return;
|
||||
|
||||
rtnl_lock();
|
||||
|
|
|
@ -85,7 +85,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
|
|||
struct hlist_node *node;
|
||||
struct inet_bind_bucket *tb;
|
||||
int ret;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
local_bh_disable();
|
||||
if (!snum) {
|
||||
|
@ -333,7 +333,7 @@ struct dst_entry* inet_csk_route_req(struct sock *sk,
|
|||
.dport = ireq->rmt_port } } };
|
||||
|
||||
security_req_classify_flow(req, &fl);
|
||||
if (ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0)) {
|
||||
if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0)) {
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ static struct sock *inet_lookup_listener_slow(struct net *net,
|
|||
sk_for_each(sk, node, head) {
|
||||
const struct inet_sock *inet = inet_sk(sk);
|
||||
|
||||
if (sk->sk_net == net && inet->num == hnum &&
|
||||
if (net_eq(sock_net(sk), net) && inet->num == hnum &&
|
||||
!ipv6_only_sock(sk)) {
|
||||
const __be32 rcv_saddr = inet->rcv_saddr;
|
||||
int score = sk->sk_family == PF_INET ? 1 : 0;
|
||||
|
@ -182,7 +182,7 @@ struct sock *__inet_lookup_listener(struct net *net,
|
|||
if (inet->num == hnum && !sk->sk_node.next &&
|
||||
(!inet->rcv_saddr || inet->rcv_saddr == daddr) &&
|
||||
(sk->sk_family == PF_INET || !ipv6_only_sock(sk)) &&
|
||||
!sk->sk_bound_dev_if && sk->sk_net == net)
|
||||
!sk->sk_bound_dev_if && net_eq(sock_net(sk), net))
|
||||
goto sherry_cache;
|
||||
sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
|
|||
struct sock *sk2;
|
||||
const struct hlist_node *node;
|
||||
struct inet_timewait_sock *tw;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
prefetch(head->chain.first);
|
||||
write_lock(lock);
|
||||
|
@ -406,7 +406,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
|
|||
struct inet_bind_hashbucket *head;
|
||||
struct inet_bind_bucket *tb;
|
||||
int ret;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
if (!snum) {
|
||||
int i, remaining, low, high, port;
|
||||
|
|
|
@ -124,7 +124,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat
|
|||
tw->tw_hash = sk->sk_hash;
|
||||
tw->tw_ipv6only = 0;
|
||||
tw->tw_prot = sk->sk_prot_creator;
|
||||
tw->tw_net = sk->sk_net;
|
||||
twsk_net_set(tw, sock_net(sk));
|
||||
atomic_set(&tw->tw_refcnt, 1);
|
||||
inet_twsk_dead_node_init(tw);
|
||||
__module_get(tw->tw_prot->owner);
|
||||
|
|
|
@ -571,7 +571,7 @@ int ip_defrag(struct sk_buff *skb, u32 user)
|
|||
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
|
||||
|
||||
net = skb->dev ? skb->dev->nd_net : skb->dst->dev->nd_net;
|
||||
net = skb->dev ? dev_net(skb->dev) : dev_net(skb->dst->dev);
|
||||
/* Start by cleaning up the memory. */
|
||||
if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh)
|
||||
ip_evictor(net);
|
||||
|
|
|
@ -1190,7 +1190,7 @@ static int ipgre_close(struct net_device *dev)
|
|||
struct ip_tunnel *t = netdev_priv(dev);
|
||||
if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) {
|
||||
struct in_device *in_dev;
|
||||
in_dev = inetdev_by_index(dev->nd_net, t->mlink);
|
||||
in_dev = inetdev_by_index(dev_net(dev), t->mlink);
|
||||
if (in_dev) {
|
||||
ip_mc_dec_group(in_dev, t->parms.iph.daddr);
|
||||
in_dev_put(in_dev);
|
||||
|
|
|
@ -172,7 +172,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
|
|||
if (sk && inet_sk(sk)->num == protocol &&
|
||||
(!sk->sk_bound_dev_if ||
|
||||
sk->sk_bound_dev_if == dev->ifindex) &&
|
||||
sk->sk_net == dev->nd_net) {
|
||||
sock_net(sk) == dev_net(dev)) {
|
||||
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
|
||||
if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
|
||||
read_unlock(&ip_ra_lock);
|
||||
|
@ -199,7 +199,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
|
|||
|
||||
static int ip_local_deliver_finish(struct sk_buff *skb)
|
||||
{
|
||||
struct net *net = skb->dev->nd_net;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
|
||||
__skb_pull(skb, ip_hdrlen(skb));
|
||||
|
||||
|
@ -291,7 +291,7 @@ static inline int ip_rcv_options(struct sk_buff *skb)
|
|||
opt = &(IPCB(skb)->opt);
|
||||
opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
|
||||
|
||||
if (ip_options_compile(dev->nd_net, opt, skb)) {
|
||||
if (ip_options_compile(dev_net(dev), opt, skb)) {
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
|
||||
goto drop;
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb)
|
|||
__be32 addr;
|
||||
|
||||
memcpy(&addr, sptr+soffset-1, 4);
|
||||
if (inet_addr_type(skb->dst->dev->nd_net, addr) != RTN_LOCAL) {
|
||||
if (inet_addr_type(dev_net(skb->dst->dev), addr) != RTN_LOCAL) {
|
||||
dopt->ts_needtime = 1;
|
||||
soffset += 8;
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
|
|||
* itself out.
|
||||
*/
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
if (ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0))
|
||||
if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0))
|
||||
goto no_route;
|
||||
}
|
||||
sk_setup_caps(sk, &rt->u.dst);
|
||||
|
@ -1382,7 +1382,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
|
|||
.dport = tcp_hdr(skb)->source } },
|
||||
.proto = sk->sk_protocol };
|
||||
security_skb_classify_flow(skb, &fl);
|
||||
if (ip_route_output_key(sk->sk_net, &rt, &fl))
|
||||
if (ip_route_output_key(sock_net(sk), &rt, &fl))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
|||
struct ip_options * opt = NULL;
|
||||
if (optlen > 40 || optlen < 0)
|
||||
goto e_inval;
|
||||
err = ip_options_get_from_user(sk->sk_net, &opt,
|
||||
err = ip_options_get_from_user(sock_net(sk), &opt,
|
||||
optval, optlen);
|
||||
if (err)
|
||||
break;
|
||||
|
@ -590,13 +590,13 @@ static int do_ip_setsockopt(struct sock *sk, int level,
|
|||
err = 0;
|
||||
break;
|
||||
}
|
||||
dev = ip_dev_find(sk->sk_net, mreq.imr_address.s_addr);
|
||||
dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr);
|
||||
if (dev) {
|
||||
mreq.imr_ifindex = dev->ifindex;
|
||||
dev_put(dev);
|
||||
}
|
||||
} else
|
||||
dev = __dev_get_by_index(sk->sk_net, mreq.imr_ifindex);
|
||||
dev = __dev_get_by_index(sock_net(sk), mreq.imr_ifindex);
|
||||
|
||||
|
||||
err = -EADDRNOTAVAIL;
|
||||
|
|
|
@ -434,7 +434,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
|
|||
unsigned char *sha, *tha; /* s for "source", t for "target" */
|
||||
struct ic_device *d;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
|
||||
|
@ -854,7 +854,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
|
|||
struct ic_device *d;
|
||||
int len, ext_len;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
goto drop;
|
||||
|
||||
/* Perform verifications before taking the lock. */
|
||||
|
|
|
@ -849,7 +849,7 @@ static void mrtsock_destruct(struct sock *sk)
|
|||
{
|
||||
rtnl_lock();
|
||||
if (sk == mroute_socket) {
|
||||
IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)--;
|
||||
IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)--;
|
||||
|
||||
write_lock_bh(&mrt_lock);
|
||||
mroute_socket=NULL;
|
||||
|
@ -898,7 +898,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt
|
|||
mroute_socket=sk;
|
||||
write_unlock_bh(&mrt_lock);
|
||||
|
||||
IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)++;
|
||||
IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)++;
|
||||
}
|
||||
rtnl_unlock();
|
||||
return ret;
|
||||
|
@ -1089,7 +1089,7 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v
|
|||
struct vif_device *v;
|
||||
int ct;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event != NETDEV_UNREGISTER)
|
||||
|
|
|
@ -1496,11 +1496,11 @@ static int compat_do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user,
|
|||
|
||||
switch (cmd) {
|
||||
case ARPT_SO_SET_REPLACE:
|
||||
ret = compat_do_replace(sk->sk_net, user, len);
|
||||
ret = compat_do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case ARPT_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 1);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1644,10 +1644,10 @@ static int compat_do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user,
|
|||
|
||||
switch (cmd) {
|
||||
case ARPT_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 1);
|
||||
ret = get_info(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
case ARPT_SO_GET_ENTRIES:
|
||||
ret = compat_get_entries(sk->sk_net, user, len);
|
||||
ret = compat_get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
default:
|
||||
ret = do_arpt_get_ctl(sk, cmd, user, len);
|
||||
|
@ -1665,11 +1665,11 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned
|
|||
|
||||
switch (cmd) {
|
||||
case ARPT_SO_SET_REPLACE:
|
||||
ret = do_replace(sk->sk_net, user, len);
|
||||
ret = do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case ARPT_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 0);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1689,11 +1689,11 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len
|
|||
|
||||
switch (cmd) {
|
||||
case ARPT_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 0);
|
||||
ret = get_info(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
case ARPT_SO_GET_ENTRIES:
|
||||
ret = get_entries(sk->sk_net, user, len);
|
||||
ret = get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case ARPT_SO_GET_REVISION_TARGET: {
|
||||
|
|
|
@ -481,7 +481,7 @@ ipq_rcv_dev_event(struct notifier_block *this,
|
|||
{
|
||||
struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* Drop any packets associated with the downed device */
|
||||
|
|
|
@ -1852,11 +1852,11 @@ compat_do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user,
|
|||
|
||||
switch (cmd) {
|
||||
case IPT_SO_SET_REPLACE:
|
||||
ret = compat_do_replace(sk->sk_net, user, len);
|
||||
ret = compat_do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IPT_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 1);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1963,10 +1963,10 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
|
||||
switch (cmd) {
|
||||
case IPT_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 1);
|
||||
ret = get_info(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
case IPT_SO_GET_ENTRIES:
|
||||
ret = compat_get_entries(sk->sk_net, user, len);
|
||||
ret = compat_get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
default:
|
||||
ret = do_ipt_get_ctl(sk, cmd, user, len);
|
||||
|
@ -1985,11 +1985,11 @@ do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
|
|||
|
||||
switch (cmd) {
|
||||
case IPT_SO_SET_REPLACE:
|
||||
ret = do_replace(sk->sk_net, user, len);
|
||||
ret = do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IPT_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 0);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2010,11 +2010,11 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
|
||||
switch (cmd) {
|
||||
case IPT_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 0);
|
||||
ret = get_info(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
case IPT_SO_GET_ENTRIES:
|
||||
ret = get_entries(sk->sk_net, user, len);
|
||||
ret = get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IPT_SO_GET_REVISION_MATCH:
|
||||
|
|
|
@ -120,7 +120,7 @@ static int masq_device_event(struct notifier_block *this,
|
|||
{
|
||||
const struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
if (event == NETDEV_DOWN) {
|
||||
|
|
|
@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
|
|||
sk_for_each_from(sk, node) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
|
||||
if (sk->sk_net == net && inet->num == num &&
|
||||
if (net_eq(sock_net(sk), net) && inet->num == num &&
|
||||
!(inet->daddr && inet->daddr != raddr) &&
|
||||
!(inet->rcv_saddr && inet->rcv_saddr != laddr) &&
|
||||
!(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
|
||||
|
@ -168,7 +168,7 @@ static int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash)
|
|||
if (hlist_empty(head))
|
||||
goto out;
|
||||
|
||||
net = skb->dev->nd_net;
|
||||
net = dev_net(skb->dev);
|
||||
sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol,
|
||||
iph->saddr, iph->daddr,
|
||||
skb->dev->ifindex);
|
||||
|
@ -276,7 +276,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info)
|
|||
raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]);
|
||||
if (raw_sk != NULL) {
|
||||
iph = (struct iphdr *)skb->data;
|
||||
net = skb->dev->nd_net;
|
||||
net = dev_net(skb->dev);
|
||||
|
||||
while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol,
|
||||
iph->daddr, iph->saddr,
|
||||
|
@ -499,7 +499,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|||
ipc.oif = sk->sk_bound_dev_if;
|
||||
|
||||
if (msg->msg_controllen) {
|
||||
err = ip_cmsg_send(sk->sk_net, msg, &ipc);
|
||||
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
||||
if (err)
|
||||
goto out;
|
||||
if (ipc.opt)
|
||||
|
@ -553,7 +553,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|||
}
|
||||
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1);
|
||||
err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
|
||||
}
|
||||
if (err)
|
||||
goto done;
|
||||
|
@ -620,7 +620,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
|
|||
|
||||
if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
|
||||
goto out;
|
||||
chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr);
|
||||
chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
|
||||
ret = -EADDRNOTAVAIL;
|
||||
if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
|
||||
chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
|
||||
|
@ -856,7 +856,7 @@ static struct sock *raw_get_first(struct seq_file *seq)
|
|||
struct hlist_node *node;
|
||||
|
||||
sk_for_each(sk, node, &state->h->ht[state->bucket])
|
||||
if (sk->sk_net == state->p.net)
|
||||
if (sock_net(sk) == seq_file_net(seq))
|
||||
goto found;
|
||||
}
|
||||
sk = NULL;
|
||||
|
@ -872,7 +872,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk)
|
|||
sk = sk_next(sk);
|
||||
try_again:
|
||||
;
|
||||
} while (sk && sk->sk_net != state->p.net);
|
||||
} while (sk && sock_net(sk) != seq_file_net(seq));
|
||||
|
||||
if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
|
||||
sk = sk_head(&state->h->ht[state->bucket]);
|
||||
|
|
|
@ -276,15 +276,16 @@ struct rt_cache_iter_state {
|
|||
int genid;
|
||||
};
|
||||
|
||||
static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
|
||||
static struct rtable *rt_cache_get_first(struct seq_file *seq)
|
||||
{
|
||||
struct rt_cache_iter_state *st = seq->private;
|
||||
struct rtable *r = NULL;
|
||||
|
||||
for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) {
|
||||
rcu_read_lock_bh();
|
||||
r = rcu_dereference(rt_hash_table[st->bucket].chain);
|
||||
while (r) {
|
||||
if (r->u.dst.dev->nd_net == st->p.net &&
|
||||
if (dev_net(r->u.dst.dev) == seq_file_net(seq) &&
|
||||
r->rt_genid == st->genid)
|
||||
return r;
|
||||
r = rcu_dereference(r->u.dst.rt_next);
|
||||
|
@ -294,9 +295,10 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st)
|
|||
return r;
|
||||
}
|
||||
|
||||
static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st,
|
||||
static struct rtable *__rt_cache_get_next(struct seq_file *seq,
|
||||
struct rtable *r)
|
||||
{
|
||||
struct rt_cache_iter_state *st = seq->private;
|
||||
r = r->u.dst.rt_next;
|
||||
while (!r) {
|
||||
rcu_read_unlock_bh();
|
||||
|
@ -308,11 +310,12 @@ static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st,
|
|||
return rcu_dereference(r);
|
||||
}
|
||||
|
||||
static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st,
|
||||
static struct rtable *rt_cache_get_next(struct seq_file *seq,
|
||||
struct rtable *r)
|
||||
{
|
||||
while ((r = __rt_cache_get_next(st, r)) != NULL) {
|
||||
if (r->u.dst.dev->nd_net != st->p.net)
|
||||
struct rt_cache_iter_state *st = seq->private;
|
||||
while ((r = __rt_cache_get_next(seq, r)) != NULL) {
|
||||
if (dev_net(r->u.dst.dev) != seq_file_net(seq))
|
||||
continue;
|
||||
if (r->rt_genid == st->genid)
|
||||
break;
|
||||
|
@ -320,12 +323,12 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st,
|
|||
return r;
|
||||
}
|
||||
|
||||
static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos)
|
||||
static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos)
|
||||
{
|
||||
struct rtable *r = rt_cache_get_first(st);
|
||||
struct rtable *r = rt_cache_get_first(seq);
|
||||
|
||||
if (r)
|
||||
while (pos && (r = rt_cache_get_next(st, r)))
|
||||
while (pos && (r = rt_cache_get_next(seq, r)))
|
||||
--pos;
|
||||
return pos ? NULL : r;
|
||||
}
|
||||
|
@ -333,9 +336,8 @@ static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t po
|
|||
static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
struct rt_cache_iter_state *st = seq->private;
|
||||
|
||||
if (*pos)
|
||||
return rt_cache_get_idx(st, *pos - 1);
|
||||
return rt_cache_get_idx(seq, *pos - 1);
|
||||
st->genid = atomic_read(&rt_genid);
|
||||
return SEQ_START_TOKEN;
|
||||
}
|
||||
|
@ -343,12 +345,11 @@ static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos)
|
|||
static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos)
|
||||
{
|
||||
struct rtable *r;
|
||||
struct rt_cache_iter_state *st = seq->private;
|
||||
|
||||
if (v == SEQ_START_TOKEN)
|
||||
r = rt_cache_get_first(st);
|
||||
r = rt_cache_get_first(seq);
|
||||
else
|
||||
r = rt_cache_get_next(st, v);
|
||||
r = rt_cache_get_next(seq, v);
|
||||
++*pos;
|
||||
return r;
|
||||
}
|
||||
|
@ -680,7 +681,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2)
|
|||
|
||||
static inline int compare_netns(struct rtable *rt1, struct rtable *rt2)
|
||||
{
|
||||
return rt1->u.dst.dev->nd_net == rt2->u.dst.dev->nd_net;
|
||||
return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1164,7 +1165,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
|
|||
if (!in_dev)
|
||||
return;
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev)
|
||||
|| ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw)
|
||||
|| ipv4_is_zeronet(new_gw))
|
||||
|
@ -1195,7 +1196,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw,
|
|||
rth->fl.oif != ikeys[k] ||
|
||||
rth->fl.iif != 0 ||
|
||||
rth->rt_genid != atomic_read(&rt_genid) ||
|
||||
rth->u.dst.dev->nd_net != net) {
|
||||
!net_eq(dev_net(rth->u.dst.dev), net)) {
|
||||
rthp = &rth->u.dst.rt_next;
|
||||
continue;
|
||||
}
|
||||
|
@ -1454,7 +1455,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph,
|
|||
rth->rt_src == iph->saddr &&
|
||||
rth->fl.iif == 0 &&
|
||||
!(dst_metric_locked(&rth->u.dst, RTAX_MTU)) &&
|
||||
rth->u.dst.dev->nd_net == net &&
|
||||
net_eq(dev_net(rth->u.dst.dev), net) &&
|
||||
rth->rt_genid == atomic_read(&rt_genid)) {
|
||||
unsigned short mtu = new_mtu;
|
||||
|
||||
|
@ -1530,9 +1531,9 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
|
|||
{
|
||||
struct rtable *rt = (struct rtable *) dst;
|
||||
struct in_device *idev = rt->idev;
|
||||
if (dev != dev->nd_net->loopback_dev && idev && idev->dev == dev) {
|
||||
if (dev != dev_net(dev)->loopback_dev && idev && idev->dev == dev) {
|
||||
struct in_device *loopback_idev =
|
||||
in_dev_get(dev->nd_net->loopback_dev);
|
||||
in_dev_get(dev_net(dev)->loopback_dev);
|
||||
if (loopback_idev) {
|
||||
rt->idev = loopback_idev;
|
||||
in_dev_put(idev);
|
||||
|
@ -1576,7 +1577,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt)
|
|||
|
||||
if (rt->fl.iif == 0)
|
||||
src = rt->rt_src;
|
||||
else if (fib_lookup(rt->u.dst.dev->nd_net, &rt->fl, &res) == 0) {
|
||||
else if (fib_lookup(dev_net(rt->u.dst.dev), &rt->fl, &res) == 0) {
|
||||
src = FIB_RES_PREFSRC(res);
|
||||
fib_res_put(&res);
|
||||
} else
|
||||
|
@ -1900,7 +1901,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
__be32 spec_dst;
|
||||
int err = -EINVAL;
|
||||
int free_res = 0;
|
||||
struct net * net = dev->nd_net;
|
||||
struct net * net = dev_net(dev);
|
||||
|
||||
/* IP on this device is disabled. */
|
||||
|
||||
|
@ -2071,7 +2072,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
int iif = dev->ifindex;
|
||||
struct net *net;
|
||||
|
||||
net = dev->nd_net;
|
||||
net = dev_net(dev);
|
||||
tos &= IPTOS_RT_MASK;
|
||||
hash = rt_hash(daddr, saddr, iif);
|
||||
|
||||
|
@ -2084,7 +2085,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
|
|||
rth->fl.oif == 0 &&
|
||||
rth->fl.mark == skb->mark &&
|
||||
rth->fl.fl4_tos == tos &&
|
||||
rth->u.dst.dev->nd_net == net &&
|
||||
net_eq(dev_net(rth->u.dst.dev), net) &&
|
||||
rth->rt_genid == atomic_read(&rt_genid)) {
|
||||
dst_use(&rth->u.dst, jiffies);
|
||||
RT_CACHE_STAT_INC(in_hit);
|
||||
|
@ -2486,7 +2487,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp,
|
|||
rth->fl.mark == flp->mark &&
|
||||
!((rth->fl.fl4_tos ^ flp->fl4_tos) &
|
||||
(IPTOS_RT_MASK | RTO_ONLINK)) &&
|
||||
rth->u.dst.dev->nd_net == net &&
|
||||
net_eq(dev_net(rth->u.dst.dev), net) &&
|
||||
rth->rt_genid == atomic_read(&rt_genid)) {
|
||||
dst_use(&rth->u.dst, jiffies);
|
||||
RT_CACHE_STAT_INC(out_hit);
|
||||
|
@ -2689,7 +2690,7 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
|
|||
|
||||
static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = in_skb->sk->sk_net;
|
||||
struct net *net = sock_net(in_skb->sk);
|
||||
struct rtmsg *rtm;
|
||||
struct nlattr *tb[RTA_MAX+1];
|
||||
struct rtable *rt = NULL;
|
||||
|
@ -2785,7 +2786,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
int idx, s_idx;
|
||||
struct net *net;
|
||||
|
||||
net = skb->sk->sk_net;
|
||||
net = sock_net(skb->sk);
|
||||
|
||||
s_h = cb->args[0];
|
||||
if (s_h < 0)
|
||||
|
@ -2795,7 +2796,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
rcu_read_lock_bh();
|
||||
for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
|
||||
rt = rcu_dereference(rt->u.dst.rt_next), idx++) {
|
||||
if (rt->u.dst.dev->nd_net != net || idx < s_idx)
|
||||
if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx)
|
||||
continue;
|
||||
if (rt->rt_genid != atomic_read(&rt_genid))
|
||||
continue;
|
||||
|
|
|
@ -353,7 +353,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
|
|||
return;
|
||||
}
|
||||
|
||||
sk = inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->daddr, th->dest,
|
||||
sk = inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->daddr, th->dest,
|
||||
iph->saddr, th->source, inet_iif(skb));
|
||||
if (!sk) {
|
||||
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
|
||||
|
@ -1486,7 +1486,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
|
|||
if (req)
|
||||
return tcp_check_req(sk, skb, req, prev);
|
||||
|
||||
nsk = inet_lookup_established(sk->sk_net, &tcp_hashinfo, iph->saddr,
|
||||
nsk = inet_lookup_established(sock_net(sk), &tcp_hashinfo, iph->saddr,
|
||||
th->source, iph->daddr, th->dest, inet_iif(skb));
|
||||
|
||||
if (nsk) {
|
||||
|
@ -1644,7 +1644,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
|
|||
TCP_SKB_CB(skb)->flags = iph->tos;
|
||||
TCP_SKB_CB(skb)->sacked = 0;
|
||||
|
||||
sk = __inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->saddr,
|
||||
sk = __inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->saddr,
|
||||
th->source, iph->daddr, th->dest, inet_iif(skb));
|
||||
if (!sk)
|
||||
goto no_tcp_socket;
|
||||
|
@ -1718,7 +1718,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
|
|||
}
|
||||
switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
|
||||
case TCP_TW_SYN: {
|
||||
struct sock *sk2 = inet_lookup_listener(skb->dev->nd_net,
|
||||
struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev),
|
||||
&tcp_hashinfo,
|
||||
iph->daddr, th->dest,
|
||||
inet_iif(skb));
|
||||
|
@ -1974,7 +1974,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
|
|||
while (1) {
|
||||
while (req) {
|
||||
if (req->rsk_ops->family == st->family &&
|
||||
req->sk->sk_net == net) {
|
||||
net_eq(sock_net(req->sk), net)) {
|
||||
cur = req;
|
||||
goto out;
|
||||
}
|
||||
|
@ -1998,7 +1998,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur)
|
|||
}
|
||||
get_sk:
|
||||
sk_for_each_from(sk, node) {
|
||||
if (sk->sk_family == st->family && sk->sk_net == net) {
|
||||
if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
|
||||
cur = sk;
|
||||
goto out;
|
||||
}
|
||||
|
@ -2049,7 +2049,7 @@ static void *established_get_first(struct seq_file *seq)
|
|||
read_lock_bh(lock);
|
||||
sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
|
||||
if (sk->sk_family != st->family ||
|
||||
sk->sk_net != net) {
|
||||
!net_eq(sock_net(sk), net)) {
|
||||
continue;
|
||||
}
|
||||
rc = sk;
|
||||
|
@ -2059,7 +2059,7 @@ static void *established_get_first(struct seq_file *seq)
|
|||
inet_twsk_for_each(tw, node,
|
||||
&tcp_hashinfo.ehash[st->bucket].twchain) {
|
||||
if (tw->tw_family != st->family ||
|
||||
tw->tw_net != net) {
|
||||
!net_eq(twsk_net(tw), net)) {
|
||||
continue;
|
||||
}
|
||||
rc = tw;
|
||||
|
@ -2086,7 +2086,7 @@ static void *established_get_next(struct seq_file *seq, void *cur)
|
|||
tw = cur;
|
||||
tw = tw_next(tw);
|
||||
get_tw:
|
||||
while (tw && (tw->tw_family != st->family || tw->tw_net != net)) {
|
||||
while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
|
||||
tw = tw_next(tw);
|
||||
}
|
||||
if (tw) {
|
||||
|
@ -2107,7 +2107,7 @@ static void *established_get_next(struct seq_file *seq, void *cur)
|
|||
sk = sk_next(sk);
|
||||
|
||||
sk_for_each_from(sk, node) {
|
||||
if (sk->sk_family == st->family && sk->sk_net == net)
|
||||
if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
|
||||
goto found;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ static inline int __udp_lib_lport_inuse(struct net *net, __u16 num,
|
|||
struct hlist_node *node;
|
||||
|
||||
sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)])
|
||||
if (sk->sk_net == net && sk->sk_hash == num)
|
||||
if (net_eq(sock_net(sk), net) && sk->sk_hash == num)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
|
|||
struct hlist_head *head;
|
||||
struct sock *sk2;
|
||||
int error = 1;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
write_lock_bh(&udp_hash_lock);
|
||||
|
||||
|
@ -218,7 +218,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
|
|||
sk_for_each(sk2, node, head)
|
||||
if (sk2->sk_hash == snum &&
|
||||
sk2 != sk &&
|
||||
sk2->sk_net == net &&
|
||||
net_eq(sock_net(sk2), net) &&
|
||||
(!sk2->sk_reuse || !sk->sk_reuse) &&
|
||||
(!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if
|
||||
|| sk2->sk_bound_dev_if == sk->sk_bound_dev_if) &&
|
||||
|
@ -269,7 +269,7 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr,
|
|||
sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
|
||||
if (sk->sk_net == net && sk->sk_hash == hnum &&
|
||||
if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
|
||||
!ipv6_only_sock(sk)) {
|
||||
int score = (sk->sk_family == PF_INET ? 1 : 0);
|
||||
if (inet->rcv_saddr) {
|
||||
|
@ -357,7 +357,7 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[])
|
|||
int harderr;
|
||||
int err;
|
||||
|
||||
sk = __udp4_lib_lookup(skb->dev->nd_net, iph->daddr, uh->dest,
|
||||
sk = __udp4_lib_lookup(dev_net(skb->dev), iph->daddr, uh->dest,
|
||||
iph->saddr, uh->source, skb->dev->ifindex, udptable);
|
||||
if (sk == NULL) {
|
||||
ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
|
||||
|
@ -607,7 +607,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|||
|
||||
ipc.oif = sk->sk_bound_dev_if;
|
||||
if (msg->msg_controllen) {
|
||||
err = ip_cmsg_send(sk->sk_net, msg, &ipc);
|
||||
err = ip_cmsg_send(sock_net(sk), msg, &ipc);
|
||||
if (err)
|
||||
return err;
|
||||
if (ipc.opt)
|
||||
|
@ -656,7 +656,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
|
|||
{ .sport = inet->sport,
|
||||
.dport = dport } } };
|
||||
security_sk_classify_flow(sk, &fl);
|
||||
err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1);
|
||||
err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
|
||||
if (err) {
|
||||
if (err == -ENETUNREACH)
|
||||
IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
|
||||
|
@ -1181,7 +1181,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
|
|||
if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
|
||||
return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable);
|
||||
|
||||
sk = __udp4_lib_lookup(skb->dev->nd_net, saddr, uh->source, daddr,
|
||||
sk = __udp4_lib_lookup(dev_net(skb->dev), saddr, uh->source, daddr,
|
||||
uh->dest, inet_iif(skb), udptable);
|
||||
|
||||
if (sk != NULL) {
|
||||
|
@ -1511,7 +1511,7 @@ static struct sock *udp_get_first(struct seq_file *seq)
|
|||
for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
|
||||
struct hlist_node *node;
|
||||
sk_for_each(sk, node, state->hashtable + state->bucket) {
|
||||
if (sk->sk_net != net)
|
||||
if (!net_eq(sock_net(sk), net))
|
||||
continue;
|
||||
if (sk->sk_family == state->family)
|
||||
goto found;
|
||||
|
@ -1531,7 +1531,7 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
|
|||
sk = sk_next(sk);
|
||||
try_again:
|
||||
;
|
||||
} while (sk && (sk->sk_net != net || sk->sk_family != state->family));
|
||||
} while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
|
||||
|
||||
if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
|
||||
sk = sk_head(state->hashtable + state->bucket);
|
||||
|
|
|
@ -221,7 +221,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
|
|||
xdst = (struct xfrm_dst *)dst;
|
||||
if (xdst->u.rt.idev->dev == dev) {
|
||||
struct in_device *loopback_idev =
|
||||
in_dev_get(dev->nd_net->loopback_dev);
|
||||
in_dev_get(dev_net(dev)->loopback_dev);
|
||||
BUG_ON(!loopback_idev);
|
||||
|
||||
do {
|
||||
|
|
|
@ -335,7 +335,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
|
|||
|
||||
rwlock_init(&ndev->lock);
|
||||
ndev->dev = dev;
|
||||
memcpy(&ndev->cnf, dev->nd_net->ipv6.devconf_dflt, sizeof(ndev->cnf));
|
||||
memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf));
|
||||
ndev->cnf.mtu6 = dev->mtu;
|
||||
ndev->cnf.sysctl = NULL;
|
||||
ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl);
|
||||
|
@ -561,7 +561,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
|
|||
write_lock(&addrconf_hash_lock);
|
||||
|
||||
/* Ignore adding duplicate addresses on an interface */
|
||||
if (ipv6_chk_same_addr(idev->dev->nd_net, addr, idev->dev)) {
|
||||
if (ipv6_chk_same_addr(dev_net(idev->dev), addr, idev->dev)) {
|
||||
ADBG(("ipv6_add_addr: already assigned\n"));
|
||||
err = -EEXIST;
|
||||
goto out;
|
||||
|
@ -751,7 +751,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
|
|||
if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) {
|
||||
struct in6_addr prefix;
|
||||
struct rt6_info *rt;
|
||||
struct net *net = ifp->idev->dev->nd_net;
|
||||
struct net *net = dev_net(ifp->idev->dev);
|
||||
ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
|
||||
rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ int ipv6_dev_get_saddr(struct net_device *dst_dev,
|
|||
{
|
||||
struct ipv6_saddr_score scores[2],
|
||||
*score = &scores[0], *hiscore = &scores[1];
|
||||
struct net *net = dst_dev->nd_net;
|
||||
struct net *net = dev_net(dst_dev);
|
||||
struct ipv6_saddr_dst dst;
|
||||
struct net_device *dev;
|
||||
int dst_type;
|
||||
|
@ -1217,7 +1217,7 @@ int ipv6_chk_addr(struct net *net, struct in6_addr *addr,
|
|||
|
||||
read_lock_bh(&addrconf_hash_lock);
|
||||
for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) {
|
||||
if (ifp->idev->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||
continue;
|
||||
if (ipv6_addr_equal(&ifp->addr, addr) &&
|
||||
!(ifp->flags&IFA_F_TENTATIVE)) {
|
||||
|
@ -1239,7 +1239,7 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
|
|||
u8 hash = ipv6_addr_hash(addr);
|
||||
|
||||
for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) {
|
||||
if (ifp->idev->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||
continue;
|
||||
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
||||
if (dev == NULL || ifp->idev->dev == dev)
|
||||
|
@ -1257,7 +1257,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr,
|
|||
|
||||
read_lock_bh(&addrconf_hash_lock);
|
||||
for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) {
|
||||
if (ifp->idev->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||
continue;
|
||||
if (ipv6_addr_equal(&ifp->addr, addr)) {
|
||||
if (dev == NULL || ifp->idev->dev == dev ||
|
||||
|
@ -1559,7 +1559,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev,
|
|||
.fc_expires = expires,
|
||||
.fc_dst_len = plen,
|
||||
.fc_flags = RTF_UP | flags,
|
||||
.fc_nlinfo.nl_net = dev->nd_net,
|
||||
.fc_nlinfo.nl_net = dev_net(dev),
|
||||
};
|
||||
|
||||
ipv6_addr_copy(&cfg.fc_dst, pfx);
|
||||
|
@ -1586,7 +1586,7 @@ static void addrconf_add_mroute(struct net_device *dev)
|
|||
.fc_ifindex = dev->ifindex,
|
||||
.fc_dst_len = 8,
|
||||
.fc_flags = RTF_UP,
|
||||
.fc_nlinfo.nl_net = dev->nd_net,
|
||||
.fc_nlinfo.nl_net = dev_net(dev),
|
||||
};
|
||||
|
||||
ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0);
|
||||
|
@ -1603,7 +1603,7 @@ static void sit_route_add(struct net_device *dev)
|
|||
.fc_ifindex = dev->ifindex,
|
||||
.fc_dst_len = 96,
|
||||
.fc_flags = RTF_UP | RTF_NONEXTHOP,
|
||||
.fc_nlinfo.nl_net = dev->nd_net,
|
||||
.fc_nlinfo.nl_net = dev_net(dev),
|
||||
};
|
||||
|
||||
/* prefix length - 96 bits "::d.d.d.d" */
|
||||
|
@ -1704,7 +1704,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
|
|||
|
||||
if (pinfo->onlink) {
|
||||
struct rt6_info *rt;
|
||||
rt = rt6_lookup(dev->nd_net, &pinfo->prefix, NULL,
|
||||
rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL,
|
||||
dev->ifindex, 1);
|
||||
|
||||
if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
|
||||
|
@ -1748,7 +1748,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
|
|||
|
||||
ok:
|
||||
|
||||
ifp = ipv6_get_ifaddr(dev->nd_net, &addr, dev, 1);
|
||||
ifp = ipv6_get_ifaddr(dev_net(dev), &addr, dev, 1);
|
||||
|
||||
if (ifp == NULL && valid_lft) {
|
||||
int max_addresses = in6_dev->cnf.max_addresses;
|
||||
|
@ -2071,7 +2071,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
|
|||
struct inet6_ifaddr * ifp;
|
||||
struct in6_addr addr;
|
||||
struct net_device *dev;
|
||||
struct net *net = idev->dev->nd_net;
|
||||
struct net *net = dev_net(idev->dev);
|
||||
int scope;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
@ -2261,7 +2261,7 @@ ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev)
|
|||
static void ip6_tnl_add_linklocal(struct inet6_dev *idev)
|
||||
{
|
||||
struct net_device *link_dev;
|
||||
struct net *net = idev->dev->nd_net;
|
||||
struct net *net = dev_net(idev->dev);
|
||||
|
||||
/* first try to inherit the link-local address from the link device */
|
||||
if (idev->dev->iflink &&
|
||||
|
@ -2442,7 +2442,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
|
|||
{
|
||||
struct inet6_dev *idev;
|
||||
struct inet6_ifaddr *ifa, **bifa;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
int i;
|
||||
|
||||
ASSERT_RTNL();
|
||||
|
@ -2766,12 +2766,12 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq)
|
|||
{
|
||||
struct inet6_ifaddr *ifa = NULL;
|
||||
struct if6_iter_state *state = seq->private;
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
|
||||
for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) {
|
||||
ifa = inet6_addr_lst[state->bucket];
|
||||
|
||||
while (ifa && ifa->idev->dev->nd_net != net)
|
||||
while (ifa && !net_eq(dev_net(ifa->idev->dev), net))
|
||||
ifa = ifa->lst_next;
|
||||
if (ifa)
|
||||
break;
|
||||
|
@ -2782,12 +2782,12 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq)
|
|||
static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa)
|
||||
{
|
||||
struct if6_iter_state *state = seq->private;
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
|
||||
ifa = ifa->lst_next;
|
||||
try_again:
|
||||
if (ifa) {
|
||||
if (ifa->idev->dev->nd_net != net) {
|
||||
if (!net_eq(dev_net(ifa->idev->dev), net)) {
|
||||
ifa = ifa->lst_next;
|
||||
goto try_again;
|
||||
}
|
||||
|
@ -2905,7 +2905,7 @@ int ipv6_chk_home_addr(struct net *net, struct in6_addr *addr)
|
|||
u8 hash = ipv6_addr_hash(addr);
|
||||
read_lock_bh(&addrconf_hash_lock);
|
||||
for (ifp = inet6_addr_lst[hash]; ifp; ifp = ifp->lst_next) {
|
||||
if (ifp->idev->dev->nd_net != net)
|
||||
if (!net_eq(dev_net(ifp->idev->dev), net))
|
||||
continue;
|
||||
if (ipv6_addr_cmp(&ifp->addr, addr) == 0 &&
|
||||
(ifp->flags & IFA_F_HOMEADDRESS)) {
|
||||
|
@ -3054,7 +3054,7 @@ static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
|
|||
static int
|
||||
inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifaddrmsg *ifm;
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct in6_addr *pfx;
|
||||
|
@ -3112,7 +3112,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags,
|
|||
static int
|
||||
inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifaddrmsg *ifm;
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct in6_addr *pfx;
|
||||
|
@ -3322,7 +3322,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
|
|||
struct inet6_ifaddr *ifa;
|
||||
struct ifmcaddr6 *ifmca;
|
||||
struct ifacaddr6 *ifaca;
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
|
||||
s_idx = cb->args[0];
|
||||
s_ip_idx = ip_idx = cb->args[1];
|
||||
|
@ -3418,7 +3418,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
|
||||
void *arg)
|
||||
{
|
||||
struct net *net = in_skb->sk->sk_net;
|
||||
struct net *net = sock_net(in_skb->sk);
|
||||
struct ifaddrmsg *ifm;
|
||||
struct nlattr *tb[IFA_MAX+1];
|
||||
struct in6_addr *addr = NULL;
|
||||
|
@ -3469,7 +3469,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
|
|||
static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct net *net = ifa->idev->dev->nd_net;
|
||||
struct net *net = dev_net(ifa->idev->dev);
|
||||
int err = -ENOBUFS;
|
||||
|
||||
skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC);
|
||||
|
@ -3645,7 +3645,7 @@ static int inet6_fill_ifinfo(struct sk_buff *skb, struct inet6_dev *idev,
|
|||
|
||||
static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
int idx, err;
|
||||
int s_idx = cb->args[0];
|
||||
struct net_device *dev;
|
||||
|
@ -3675,7 +3675,7 @@ static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
|||
void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct net *net = idev->dev->nd_net;
|
||||
struct net *net = dev_net(idev->dev);
|
||||
int err = -ENOBUFS;
|
||||
|
||||
skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC);
|
||||
|
@ -3745,7 +3745,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
|
|||
struct prefix_info *pinfo)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
struct net *net = idev->dev->nd_net;
|
||||
struct net *net = dev_net(idev->dev);
|
||||
int err = -ENOBUFS;
|
||||
|
||||
skb = nlmsg_new(inet6_prefix_nlmsg_size(), GFP_ATOMIC);
|
||||
|
@ -4157,7 +4157,7 @@ static void addrconf_sysctl_register(struct inet6_dev *idev)
|
|||
NET_IPV6_NEIGH, "ipv6",
|
||||
&ndisc_ifinfo_sysctl_change,
|
||||
NULL);
|
||||
__addrconf_sysctl_register(idev->dev->nd_net, idev->dev->name,
|
||||
__addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name,
|
||||
idev->dev->ifindex, idev, &idev->cnf);
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ static const struct nla_policy ifal_policy[IFAL_MAX+1] = {
|
|||
static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ifaddrlblmsg *ifal;
|
||||
struct nlattr *tb[IFAL_MAX+1];
|
||||
struct in6_addr *pfx;
|
||||
|
@ -452,7 +452,7 @@ static int ip6addrlbl_fill(struct sk_buff *skb,
|
|||
|
||||
static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ip6addrlbl_entry *p;
|
||||
struct hlist_node *pos;
|
||||
int idx = 0, s_idx = cb->args[0];
|
||||
|
@ -490,7 +490,7 @@ static inline int ip6addrlbl_msgsize(void)
|
|||
static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh,
|
||||
void *arg)
|
||||
{
|
||||
struct net *net = in_skb->sk->sk_net;
|
||||
struct net *net = sock_net(in_skb->sk);
|
||||
struct ifaddrlblmsg *ifal;
|
||||
struct nlattr *tb[IFAL_MAX+1];
|
||||
struct in6_addr *addr;
|
||||
|
|
|
@ -245,7 +245,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
|
|||
struct sock *sk = sock->sk;
|
||||
struct inet_sock *inet = inet_sk(sk);
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
__be32 v4addr = 0;
|
||||
unsigned short snum;
|
||||
int addr_type = 0;
|
||||
|
@ -438,7 +438,7 @@ EXPORT_SYMBOL(inet6_getname);
|
|||
int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct sock *sk = sock->sk;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
|
|
|
@ -154,7 +154,7 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
|
|||
struct nlattr **tb)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct fib6_rule *rule6 = (struct fib6_rule *) rule;
|
||||
|
||||
if (rule->action == FR_ACT_TO_TBL) {
|
||||
|
|
|
@ -163,7 +163,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
|
|||
struct flowi *fl)
|
||||
{
|
||||
struct dst_entry *dst;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
int res = 0;
|
||||
|
||||
/* Informational messages are not limited. */
|
||||
|
@ -306,7 +306,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {}
|
|||
void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
|
||||
struct net_device *dev)
|
||||
{
|
||||
struct net *net = skb->dev->nd_net;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
struct inet6_dev *idev = NULL;
|
||||
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||
struct sock *sk;
|
||||
|
@ -507,7 +507,7 @@ EXPORT_SYMBOL(icmpv6_send);
|
|||
|
||||
static void icmpv6_echo_reply(struct sk_buff *skb)
|
||||
{
|
||||
struct net *net = skb->dev->nd_net;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
struct sock *sk;
|
||||
struct inet6_dev *idev;
|
||||
struct ipv6_pinfo *np;
|
||||
|
|
|
@ -105,7 +105,7 @@ struct sock *inet6_lookup_listener(struct net *net,
|
|||
|
||||
read_lock(&hashinfo->lhash_lock);
|
||||
sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) {
|
||||
if (sk->sk_net == net && inet_sk(sk)->num == hnum &&
|
||||
if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum &&
|
||||
sk->sk_family == PF_INET6) {
|
||||
const struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
|
||||
|
@ -172,7 +172,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row,
|
|||
struct sock *sk2;
|
||||
const struct hlist_node *node;
|
||||
struct inet_timewait_sock *tw;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
prefetch(head->chain.first);
|
||||
write_lock(lock);
|
||||
|
|
|
@ -346,7 +346,7 @@ static int fib6_dump_table(struct fib6_table *table, struct sk_buff *skb,
|
|||
|
||||
static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
unsigned int h, s_h;
|
||||
unsigned int e = 0, s_e;
|
||||
struct rt6_rtnl_dump_arg arg;
|
||||
|
|
|
@ -402,7 +402,7 @@ int ip6_forward(struct sk_buff *skb)
|
|||
struct dst_entry *dst = skb->dst;
|
||||
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||
struct inet6_skb_parm *opt = IP6CB(skb);
|
||||
struct net *net = dst->dev->nd_net;
|
||||
struct net *net = dev_net(dst->dev);
|
||||
|
||||
if (ipv6_devconf.forwarding == 0)
|
||||
goto error;
|
||||
|
@ -910,7 +910,7 @@ static int ip6_dst_lookup_tail(struct sock *sk,
|
|||
struct dst_entry **dst, struct flowi *fl)
|
||||
{
|
||||
int err;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
if (*dst == NULL)
|
||||
*dst = ip6_route_output(net, sk, fl);
|
||||
|
|
|
@ -107,7 +107,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
|
|||
char __user *optval, int optlen)
|
||||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
int val, valbool;
|
||||
int retv = -ENOPROTOOPT;
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
|
|||
struct net_device *dev = NULL;
|
||||
struct ipv6_mc_socklist *mc_lst;
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
int err;
|
||||
|
||||
if (!ipv6_addr_is_multicast(addr))
|
||||
|
@ -255,7 +255,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr)
|
|||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct ipv6_mc_socklist *mc_lst, **lnk;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
write_lock_bh(&ipv6_sk_mc_lock);
|
||||
for (lnk = &np->ipv6_mc_list; (mc_lst = *lnk) !=NULL ; lnk = &mc_lst->next) {
|
||||
|
@ -327,7 +327,7 @@ void ipv6_sock_mc_close(struct sock *sk)
|
|||
{
|
||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||
struct ipv6_mc_socklist *mc_lst;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
write_lock_bh(&ipv6_sk_mc_lock);
|
||||
while ((mc_lst = np->ipv6_mc_list) != NULL) {
|
||||
|
@ -365,7 +365,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk,
|
|||
struct inet6_dev *idev;
|
||||
struct ipv6_pinfo *inet6 = inet6_sk(sk);
|
||||
struct ip6_sf_socklist *psl;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
int i, j, rv;
|
||||
int leavegroup = 0;
|
||||
int pmclocked = 0;
|
||||
|
@ -505,7 +505,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf)
|
|||
struct inet6_dev *idev;
|
||||
struct ipv6_pinfo *inet6 = inet6_sk(sk);
|
||||
struct ip6_sf_socklist *newpsl, *psl;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
int leavegroup = 0;
|
||||
int i, err;
|
||||
|
||||
|
@ -598,7 +598,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
|
|||
struct net_device *dev;
|
||||
struct ipv6_pinfo *inet6 = inet6_sk(sk);
|
||||
struct ip6_sf_socklist *psl;
|
||||
struct net *net = sk->sk_net;
|
||||
struct net *net = sock_net(sk);
|
||||
|
||||
group = &((struct sockaddr_in6 *)&gsf->gf_group)->sin6_addr;
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted)
|
|||
|
||||
static struct sk_buff *mld_newpack(struct net_device *dev, int size)
|
||||
{
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct sock *sk = net->ipv6.igmp_sk;
|
||||
struct sk_buff *skb;
|
||||
struct mld2_report *pmr;
|
||||
|
@ -1448,7 +1448,7 @@ static void mld_sendpack(struct sk_buff *skb)
|
|||
(struct mld2_report *)skb_transport_header(skb);
|
||||
int payload_len, mldlen;
|
||||
struct inet6_dev *idev = in6_dev_get(skb->dev);
|
||||
struct net *net = skb->dev->nd_net;
|
||||
struct net *net = dev_net(skb->dev);
|
||||
int err;
|
||||
struct flowi fl;
|
||||
|
||||
|
@ -1762,7 +1762,7 @@ static void mld_send_cr(struct inet6_dev *idev)
|
|||
|
||||
static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
|
||||
{
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct sock *sk = net->ipv6.igmp_sk;
|
||||
struct inet6_dev *idev;
|
||||
struct sk_buff *skb;
|
||||
|
@ -2355,7 +2355,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq)
|
|||
{
|
||||
struct ifmcaddr6 *im = NULL;
|
||||
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
|
||||
state->idev = NULL;
|
||||
for_each_netdev(net, state->dev) {
|
||||
|
@ -2486,7 +2486,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq)
|
|||
struct ip6_sf_list *psf = NULL;
|
||||
struct ifmcaddr6 *im = NULL;
|
||||
struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
|
||||
struct net *net = state->p.net;
|
||||
struct net *net = seq_file_net(seq);
|
||||
|
||||
state->idev = NULL;
|
||||
state->im = NULL;
|
||||
|
|
|
@ -447,7 +447,7 @@ static void __ndisc_send(struct net_device *dev,
|
|||
{
|
||||
struct flowi fl;
|
||||
struct dst_entry *dst;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct sock *sk = net->ipv6.ndisc_sk;
|
||||
struct sk_buff *skb;
|
||||
struct icmp6hdr *hdr;
|
||||
|
@ -539,7 +539,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
|
|||
};
|
||||
|
||||
/* for anycast or proxy, solicited_addr != src_addr */
|
||||
ifp = ipv6_get_ifaddr(dev->nd_net, solicited_addr, dev, 1);
|
||||
ifp = ipv6_get_ifaddr(dev_net(dev), solicited_addr, dev, 1);
|
||||
if (ifp) {
|
||||
src_addr = solicited_addr;
|
||||
if (ifp->flags & IFA_F_OPTIMISTIC)
|
||||
|
@ -547,7 +547,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
|
|||
in6_ifa_put(ifp);
|
||||
} else {
|
||||
if (ipv6_dev_get_saddr(dev, daddr,
|
||||
inet6_sk(dev->nd_net->ipv6.ndisc_sk)->srcprefs,
|
||||
inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
|
||||
&tmpaddr))
|
||||
return;
|
||||
src_addr = &tmpaddr;
|
||||
|
@ -601,7 +601,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
|
|||
* suppress the inclusion of the sllao.
|
||||
*/
|
||||
if (send_sllao) {
|
||||
struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev->nd_net, saddr,
|
||||
struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr,
|
||||
dev, 1);
|
||||
if (ifp) {
|
||||
if (ifp->flags & IFA_F_OPTIMISTIC) {
|
||||
|
@ -639,7 +639,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
|
|||
struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
|
||||
int probes = atomic_read(&neigh->probes);
|
||||
|
||||
if (skb && ipv6_chk_addr(dev->nd_net, &ipv6_hdr(skb)->saddr, dev, 1))
|
||||
if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1))
|
||||
saddr = &ipv6_hdr(skb)->saddr;
|
||||
|
||||
if ((probes -= neigh->parms->ucast_probes) < 0) {
|
||||
|
@ -727,7 +727,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
|
|||
|
||||
inc = ipv6_addr_is_multicast(daddr);
|
||||
|
||||
ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1);
|
||||
ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
|
||||
if (ifp) {
|
||||
|
||||
if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) {
|
||||
|
@ -776,7 +776,7 @@ static void ndisc_recv_ns(struct sk_buff *skb)
|
|||
if (ipv6_chk_acast_addr(dev, &msg->target) ||
|
||||
(idev->cnf.forwarding &&
|
||||
(ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) &&
|
||||
(pneigh = pneigh_lookup(&nd_tbl, dev->nd_net,
|
||||
(pneigh = pneigh_lookup(&nd_tbl, dev_net(dev),
|
||||
&msg->target, dev, 0)) != NULL)) {
|
||||
if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) &&
|
||||
skb->pkt_type != PACKET_HOST &&
|
||||
|
@ -886,7 +886,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
|
|||
return;
|
||||
}
|
||||
}
|
||||
ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1);
|
||||
ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1);
|
||||
if (ifp) {
|
||||
if (ifp->flags & IFA_F_TENTATIVE) {
|
||||
addrconf_dad_failure(ifp);
|
||||
|
@ -918,7 +918,7 @@ static void ndisc_recv_na(struct sk_buff *skb)
|
|||
*/
|
||||
if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) &&
|
||||
ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp &&
|
||||
pneigh_lookup(&nd_tbl, dev->nd_net, &msg->target, dev, 0)) {
|
||||
pneigh_lookup(&nd_tbl, dev_net(dev), &msg->target, dev, 0)) {
|
||||
/* XXX: idev->cnf.prixy_ndp */
|
||||
goto out;
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
|
|||
struct sk_buff *skb;
|
||||
struct nlmsghdr *nlh;
|
||||
struct nduseroptmsg *ndmsg;
|
||||
struct net *net = ra->dev->nd_net;
|
||||
struct net *net = dev_net(ra->dev);
|
||||
int err;
|
||||
int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg)
|
||||
+ (opt->nd_opt_len << 3));
|
||||
|
@ -1395,7 +1395,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
|||
struct in6_addr *target)
|
||||
{
|
||||
struct net_device *dev = skb->dev;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
struct sock *sk = net->ipv6.ndisc_sk;
|
||||
int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr);
|
||||
struct sk_buff *buff;
|
||||
|
@ -1597,7 +1597,7 @@ int ndisc_rcv(struct sk_buff *skb)
|
|||
static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
|
||||
{
|
||||
struct net_device *dev = ptr;
|
||||
struct net *net = dev->nd_net;
|
||||
struct net *net = dev_net(dev);
|
||||
|
||||
switch (event) {
|
||||
case NETDEV_CHANGEADDR:
|
||||
|
|
|
@ -484,7 +484,7 @@ ipq_rcv_dev_event(struct notifier_block *this,
|
|||
{
|
||||
struct net_device *dev = ptr;
|
||||
|
||||
if (dev->nd_net != &init_net)
|
||||
if (dev_net(dev) != &init_net)
|
||||
return NOTIFY_DONE;
|
||||
|
||||
/* Drop any packets associated with the downed device */
|
||||
|
|
|
@ -1879,11 +1879,11 @@ compat_do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user,
|
|||
|
||||
switch (cmd) {
|
||||
case IP6T_SO_SET_REPLACE:
|
||||
ret = compat_do_replace(sk->sk_net, user, len);
|
||||
ret = compat_do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IP6T_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 1);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1990,10 +1990,10 @@ compat_do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
|
||||
switch (cmd) {
|
||||
case IP6T_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 1);
|
||||
ret = get_info(sock_net(sk), user, len, 1);
|
||||
break;
|
||||
case IP6T_SO_GET_ENTRIES:
|
||||
ret = compat_get_entries(sk->sk_net, user, len);
|
||||
ret = compat_get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
default:
|
||||
ret = do_ip6t_get_ctl(sk, cmd, user, len);
|
||||
|
@ -2012,11 +2012,11 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)
|
|||
|
||||
switch (cmd) {
|
||||
case IP6T_SO_SET_REPLACE:
|
||||
ret = do_replace(sk->sk_net, user, len);
|
||||
ret = do_replace(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IP6T_SO_SET_ADD_COUNTERS:
|
||||
ret = do_add_counters(sk->sk_net, user, len, 0);
|
||||
ret = do_add_counters(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -2037,11 +2037,11 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
|
|||
|
||||
switch (cmd) {
|
||||
case IP6T_SO_GET_INFO:
|
||||
ret = get_info(sk->sk_net, user, len, 0);
|
||||
ret = get_info(sock_net(sk), user, len, 0);
|
||||
break;
|
||||
|
||||
case IP6T_SO_GET_ENTRIES:
|
||||
ret = get_entries(sk->sk_net, user, len);
|
||||
ret = get_entries(sock_net(sk), user, len);
|
||||
break;
|
||||
|
||||
case IP6T_SO_GET_REVISION_MATCH:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue