Skip to content

Commit

Permalink
net: Checks skb_dst to be NULL in inet_iif
Browse files Browse the repository at this point in the history
In inet_iif check if skb_rtable is NULL for the skb and return
skb->skb_iif if it is.

This change allows inet_iif to be called before the dst
information has been set in the skb (e.g. when doing socket based
UDP GRO).

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tom Herbert authored and David S. Miller committed Apr 7, 2016
1 parent 1fbbe1a commit 0340d0b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,11 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable

static inline int inet_iif(const struct sk_buff *skb)
{
int iif = skb_rtable(skb)->rt_iif;
struct rtable *rt = skb_rtable(skb);

if (rt && rt->rt_iif)
return rt->rt_iif;

if (iif)
return iif;
return skb->skb_iif;
}

Expand Down

0 comments on commit 0340d0b

Please sign in to comment.