diff mbox

[2/2] ip6_gre: Set flowi6_proto as IPPROTO_GRE in xmit path.

Message ID 1463565952-8781-2-git-send-email-yanhaishuang@cmss.chinamobile.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Haishuang Yan May 18, 2016, 10:05 a.m. UTC
In gre6 xmit path, we are sending a GRE packet, so set fl6 proto
to IPPROTO_GRE properly.

Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
---
 net/ipv6/ip6_gre.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

David Miller May 20, 2016, 5:48 p.m. UTC | #1
From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Date: Wed, 18 May 2016 18:05:52 +0800

> In gre6 xmit path, we are sending a GRE packet, so set fl6 proto
> to IPPROTO_GRE properly.
> 
> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>

I think it would be a lot better to initialize the flow protocol field
properly in ip6gre_tnl_link_config() instead of fixing it up every
single transmit.
Haishuang Yan May 21, 2016, 3:46 a.m. UTC | #2
> On May 21, 2016, at 1:48 AM, David Miller <davem@davemloft.net> wrote:
> 
> From: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> Date: Wed, 18 May 2016 18:05:52 +0800
> 
>> In gre6 xmit path, we are sending a GRE packet, so set fl6 proto
>> to IPPROTO_GRE properly.
>> 
>> Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
> 
> I think it would be a lot better to initialize the flow protocol field
> properly in ip6gre_tnl_link_config() instead of fixing it up every
> single transmit.
> 
> 

I agree, I will modify the changes in v2.

Thanks

Haishuang
diff mbox

Patch

diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index 8ea5a4d..cc84098 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -541,6 +541,7 @@  static inline int ip6gre_xmit_ipv4(struct sk_buff *skb, struct net_device *dev)
 		encap_limit = t->parms.encap_limit;
 
 	memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
+	fl6.flowi6_proto = IPPROTO_GRE;
 
 	dsfield = ipv4_get_dsfield(iph);
 
@@ -595,6 +596,7 @@  static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev)
 		encap_limit = t->parms.encap_limit;
 
 	memcpy(&fl6, &t->fl.u.ip6, sizeof(fl6));
+	fl6.flowi6_proto = IPPROTO_GRE;
 
 	dsfield = ipv6_get_dsfield(ipv6h);
 	if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)