Skip to content

Commit 97a7a37

Browse files
Chenbo Fengdavem330
authored andcommitted
ipv6: Initial skb->dev and skb->protocol in ip6_output
Move the initialization of skb->dev and skb->protocol from ip6_finish_output2 to ip6_output. This can make the skb->dev and skb->protocol information avalaible to the CGROUP eBPF filter. Signed-off-by: Chenbo Feng <fengc@google.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d86cc04 commit 97a7a37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/ipv6/ip6_output.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
6767
struct in6_addr *nexthop;
6868
int ret;
6969

70-
skb->protocol = htons(ETH_P_IPV6);
71-
skb->dev = dev;
72-
7370
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
7471
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
7572

@@ -154,6 +151,9 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb)
154151
struct net_device *dev = skb_dst(skb)->dev;
155152
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
156153

154+
skb->protocol = htons(ETH_P_IPV6);
155+
skb->dev = dev;
156+
157157
if (unlikely(idev->cnf.disable_ipv6)) {
158158
IP6_INC_STATS(net, idev, IPSTATS_MIB_OUTDISCARDS);
159159
kfree_skb(skb);

0 commit comments

Comments
 (0)