netns: ipmr: store netns in struct mfc_cache
This patch stores into struct mfc_cache the network namespace each mfc_cache belongs to. The new member is mfc_net. mfc_net is assigned at cache allocation and doesn't change during the rest of the cache entry life. A new net parameter is added to ipmr_cache_alloc/ipmr_cache_alloc_unres. This will help to retrieve the current netns around the IPv4 multicast routing code. At the moment, all mfc_cache are allocated in init_net. Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
cf958ae377
commit
5c0a66f5f3
@@ -193,6 +193,9 @@ struct vif_device
|
||||
struct mfc_cache
|
||||
{
|
||||
struct mfc_cache *next; /* Next entry on cache line */
|
||||
#ifdef CONFIG_NET_NS
|
||||
struct net *mfc_net;
|
||||
#endif
|
||||
__be32 mfc_mcastgrp; /* Group the entry belongs to */
|
||||
__be32 mfc_origin; /* Source of packet */
|
||||
vifi_t mfc_parent; /* Source interface */
|
||||
@@ -215,6 +218,18 @@ struct mfc_cache
|
||||
} mfc_un;
|
||||
};
|
||||
|
||||
static inline
|
||||
struct net *mfc_net(const struct mfc_cache *mfc)
|
||||
{
|
||||
return read_pnet(&mfc->mfc_net);
|
||||
}
|
||||
|
||||
static inline
|
||||
void mfc_net_set(struct mfc_cache *mfc, struct net *net)
|
||||
{
|
||||
write_pnet(&mfc->mfc_net, hold_net(net));
|
||||
}
|
||||
|
||||
#define MFC_STATIC 1
|
||||
#define MFC_NOTIFY 2
|
||||
|
||||
|
Reference in New Issue
Block a user