Message ID | 1572624474-24209-1-git-send-email-gvrose8192@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] Revert "ip_gre: Remove even more unused code" | expand |
On 11/1/2019 9:07 AM, Greg Rose wrote: > This reverts commit 42a059e02bf343787951be2824c579e1c9a26e12. > > Not all the necessary ipgre prefixed code was removed that > should have been. Another patch will follow with the correct > removed code. > > Signed-off-by: Greg Rose <gvrose8192@gmail.com> > --- Maintainers, please apply this revert patch to fix the Travis builds. Patch passes Travis here: https://travis-ci.org/gvrose8192/ovs-experimental/builds/606080092 Thanks, - Greg > datapath/linux/compat/ip_gre.c | 38 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c > index 8536241..3b7e607 100644 > --- a/datapath/linux/compat/ip_gre.c > +++ b/datapath/linux/compat/ip_gre.c > @@ -922,6 +922,44 @@ static int erspan_tunnel_init(struct net_device *dev) > return ip_tunnel_init(dev); > } > > +static int ipgre_header(struct sk_buff *skb, struct net_device *dev, > + unsigned short type, > + const void *daddr, const void *saddr, unsigned int len) > +{ > + struct ip_tunnel *t = netdev_priv(dev); > + struct iphdr *iph; > + struct gre_base_hdr *greh; > + > + iph = (struct iphdr *)__skb_push(skb, t->hlen + sizeof(*iph)); > + greh = (struct gre_base_hdr *)(iph+1); > + greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags); > + greh->protocol = htons(type); > + > + memcpy(iph, &t->parms.iph, sizeof(struct iphdr)); > + > + /* Set the source hardware address. */ > + if (saddr) > + memcpy(&iph->saddr, saddr, 4); > + if (daddr) > + memcpy(&iph->daddr, daddr, 4); > + if (iph->daddr) > + return t->hlen + sizeof(*iph); > + > + return -(t->hlen + sizeof(*iph)); > +} > + > +static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) > +{ > + const struct iphdr *iph = (const struct iphdr *) skb_mac_header(skb); > + memcpy(haddr, &iph->saddr, 4); > + return 4; > +} > + > +static const struct header_ops ipgre_header_ops = { > + .create = ipgre_header, > + .parse = ipgre_header_parse, > +}; > + > static int ipgre_tunnel_init(struct net_device *dev) > { > struct ip_tunnel *tunnel = netdev_priv(dev);
On Fri, Nov 01, 2019 at 10:27:09AM -0700, Gregory Rose wrote: > > On 11/1/2019 9:07 AM, Greg Rose wrote: > > This reverts commit 42a059e02bf343787951be2824c579e1c9a26e12. > > > > Not all the necessary ipgre prefixed code was removed that > > should have been. Another patch will follow with the correct > > removed code. > > > > Signed-off-by: Greg Rose <gvrose8192@gmail.com> > > --- > > Maintainers, please apply this revert patch to fix the Travis builds. Patch > passes Travis here: > > https://travis-ci.org/gvrose8192/ovs-experimental/builds/606080092 Thanks Greg, pushed to master.
On 11/1/2019 11:04 AM, Simon Horman wrote: > On Fri, Nov 01, 2019 at 10:27:09AM -0700, Gregory Rose wrote: >> On 11/1/2019 9:07 AM, Greg Rose wrote: >>> This reverts commit 42a059e02bf343787951be2824c579e1c9a26e12. >>> >>> Not all the necessary ipgre prefixed code was removed that >>> should have been. Another patch will follow with the correct >>> removed code. >>> >>> Signed-off-by: Greg Rose <gvrose8192@gmail.com> >>> --- >> Maintainers, please apply this revert patch to fix the Travis builds. Patch >> passes Travis here: >> >> https://travis-ci.org/gvrose8192/ovs-experimental/builds/606080092 > Thanks Greg, > > pushed to master. And thank you Simon, I'll make sure I mail the right patch next time. - Greg
diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index 8536241..3b7e607 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -922,6 +922,44 @@ static int erspan_tunnel_init(struct net_device *dev) return ip_tunnel_init(dev); } +static int ipgre_header(struct sk_buff *skb, struct net_device *dev, + unsigned short type, + const void *daddr, const void *saddr, unsigned int len) +{ + struct ip_tunnel *t = netdev_priv(dev); + struct iphdr *iph; + struct gre_base_hdr *greh; + + iph = (struct iphdr *)__skb_push(skb, t->hlen + sizeof(*iph)); + greh = (struct gre_base_hdr *)(iph+1); + greh->flags = gre_tnl_flags_to_gre_flags(t->parms.o_flags); + greh->protocol = htons(type); + + memcpy(iph, &t->parms.iph, sizeof(struct iphdr)); + + /* Set the source hardware address. */ + if (saddr) + memcpy(&iph->saddr, saddr, 4); + if (daddr) + memcpy(&iph->daddr, daddr, 4); + if (iph->daddr) + return t->hlen + sizeof(*iph); + + return -(t->hlen + sizeof(*iph)); +} + +static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr) +{ + const struct iphdr *iph = (const struct iphdr *) skb_mac_header(skb); + memcpy(haddr, &iph->saddr, 4); + return 4; +} + +static const struct header_ops ipgre_header_ops = { + .create = ipgre_header, + .parse = ipgre_header_parse, +}; + static int ipgre_tunnel_init(struct net_device *dev) { struct ip_tunnel *tunnel = netdev_priv(dev);
This reverts commit 42a059e02bf343787951be2824c579e1c9a26e12. Not all the necessary ipgre prefixed code was removed that should have been. Another patch will follow with the correct removed code. Signed-off-by: Greg Rose <gvrose8192@gmail.com> --- datapath/linux/compat/ip_gre.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)