Skip to content
  • Jason A. Donenfeld's avatar
    46d6c5ae
    netfilter: use actual socket sk rather than skb sk when routing harder · 46d6c5ae
    Jason A. Donenfeld authored
    If netfilter changes the packet mark when mangling, the packet is
    rerouted using the route_me_harder set of functions. Prior to this
    commit, there's one big difference between route_me_harder and the
    ordinary initial routing functions, described in the comment above
    __ip_queue_xmit():
    
       /* Note: skb->sk can be different from sk, in case of tunnels */
       int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
    
    That function goes on to correctly make use of sk->sk_bound_dev_if,
    rather than skb->sk->sk_bound_dev_if. And indeed the comment is true: a
    tunnel will receive a packet in ndo_start_xmit with an initial skb->sk.
    It will make some transformations to that packet, and then it will send
    the encapsulated packet out of a *new* socket. That new socket will
    basically always have a different sk_bound_dev_if (otherwise there'd be
    a routing loop). So for the purposes of routing the encapsulated packet,
    the routing infor...
    46d6c5ae
    netfilter: use actual socket sk rather than skb sk when routing harder
    Jason A. Donenfeld authored
    If netfilter changes the packet mark when mangling, the packet is
    rerouted using the route_me_harder set of functions. Prior to this
    commit, there's one big difference between route_me_harder and the
    ordinary initial routing functions, described in the comment above
    __ip_queue_xmit():
    
       /* Note: skb->sk can be different from sk, in case of tunnels */
       int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
    
    That function goes on to correctly make use of sk->sk_bound_dev_if,
    rather than skb->sk->sk_bound_dev_if. And indeed the comment is true: a
    tunnel will receive a packet in ndo_start_xmit with an initial skb->sk.
    It will make some transformations to that packet, and then it will send
    the encapsulated packet out of a *new* socket. That new socket will
    basically always have a different sk_bound_dev_if (otherwise there'd be
    a routing loop). So for the purposes of routing the encapsulated packet,
    the routing infor...
Loading