[ovs-dev] [PATCH] datapath: set skb->pkt_type to PACKET_OUTGOING when sending encapsulated skb

Isaku Yamahata yamahata at valinux.co.jp
Fri Jul 19 01:47:36 UTC 2013


On Thu, Jul 18, 2013 at 10:02:52AM -0700, Jesse Gross wrote:
> On Tue, Jul 16, 2013 at 8:20 PM, Isaku Yamahata <yamahata at valinux.co.jp> wrote:
> > diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
> > index c74f5fc..604fe94 100644
> > --- a/datapath/vport-gre.c
> > +++ b/datapath/vport-gre.c
> > @@ -175,6 +175,7 @@ static int __send(struct vport *vport, struct sk_buff *skb,
> >
> >         skb->local_df = 1;
> >
> > +       skb->pkt_type = PACKET_OUTGOING;
> >         return iptunnel_xmit(net, rt, skb, saddr,
> >                              OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE,
> >                              OVS_CB(skb)->tun_key->ipv4_tos,
> 
> This is supposed to be OVS-specific code for GRE encapsulation but I
> don't see a reason that it wouldn't also apply to GRE tunnels that are
> Linux devices. Is there a reason that this doesn't belong in the
> upstream kernel instead?

Like this?
Pravin, do you have any comments? If you're fine with this patch,
I'll prepare it.

thanks,

---
 include/net/ip6_tunnel.h  |    1 +
 net/ipv4/ip_tunnel_core.c |    1 +
 2 files changed, 2 insertions(+)

diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h
index 4da5de1..e11e3e7 100644
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -75,6 +75,7 @@ static inline void ip6tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
 	int pkt_len, err;
 
 	nf_reset(skb);
+	skb->pkt_type = PACKET_OUTGOING;
 	pkt_len = skb->len;
 	err = ip6_local_out(skb);
 
diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 7167b08..48862e4 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -80,6 +80,7 @@ int iptunnel_xmit(struct net *net, struct rtable *rt,
 			       (const struct iphdr *)skb_inner_network_header(skb),
 			       &rt->dst);
 
+	skb->pkt_type = PACKET_OUTGOING;
 	err = ip_local_out(skb);
 	if (unlikely(net_xmit_eval(err)))
 		pkt_len = 0;
-- 
1.7.10.4


-- 
yamahata



More information about the dev mailing list