netfilter: Pass socket pointer down through okfn().
On the output paths in particular, we have to sometimes deal with two socket contexts. First, and usually skb->sk, is the local socket that generated the frame. And second, is potentially the socket used to control a tunneling socket, such as one the encapsulates using UDP. We do not want to disassociate skb->sk when encapsulating in order to fix this, because that would break socket memory accounting. The most extreme case where this can cause huge problems is an AF_PACKET socket transmitting over a vxlan device. We hit code paths doing checks that assume they are dealing with an ipv4 socket, but are actually operating upon the AF_PACKET one. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
1c984f8a5d
commit
7026b1ddb6
@@ -2165,8 +2165,12 @@ int dev_open(struct net_device *dev);
|
||||
int dev_close(struct net_device *dev);
|
||||
int dev_close_many(struct list_head *head, bool unlink);
|
||||
void dev_disable_lro(struct net_device *dev);
|
||||
int dev_loopback_xmit(struct sk_buff *newskb);
|
||||
int dev_queue_xmit(struct sk_buff *skb);
|
||||
int dev_loopback_xmit(struct sock *sk, struct sk_buff *newskb);
|
||||
int dev_queue_xmit_sk(struct sock *sk, struct sk_buff *skb);
|
||||
static inline int dev_queue_xmit(struct sk_buff *skb)
|
||||
{
|
||||
return dev_queue_xmit_sk(skb->sk, skb);
|
||||
}
|
||||
int dev_queue_xmit_accel(struct sk_buff *skb, void *accel_priv);
|
||||
int register_netdevice(struct net_device *dev);
|
||||
void unregister_netdevice_queue(struct net_device *dev, struct list_head *head);
|
||||
@@ -2927,7 +2931,11 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
|
||||
|
||||
int netif_rx(struct sk_buff *skb);
|
||||
int netif_rx_ni(struct sk_buff *skb);
|
||||
int netif_receive_skb(struct sk_buff *skb);
|
||||
int netif_receive_skb_sk(struct sock *sk, struct sk_buff *skb);
|
||||
static inline int netif_receive_skb(struct sk_buff *skb)
|
||||
{
|
||||
return netif_receive_skb_sk(skb->sk, skb);
|
||||
}
|
||||
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
|
||||
void napi_gro_flush(struct napi_struct *napi, bool flush_old);
|
||||
struct sk_buff *napi_get_frags(struct napi_struct *napi);
|
||||
|
Reference in New Issue
Block a user