Skip to content

Commit

Permalink
ip_gre: Remove even more unused code
Browse files Browse the repository at this point in the history
There is a confusing mix of ipgre and gretap functions with some
needed for gretap still having ipgre_ prefixes.  This time though
I think I got the rest of the unused ipgre code.

Passes Travis here and this time I made sure the patch passing
Travis is the same one I'm mailing.
https://travis-ci.org/gvrose8192/ovs-experimental/builds/607296133

Fixes: d5822f4 ("gre: Remove dead ipgre code")
Signed-off-by: Greg Rose <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
gvrose8192 authored and blp committed Nov 5, 2019
1 parent 8987997 commit b903e17
Showing 1 changed file with 0 additions and 102 deletions.
102 changes: 0 additions & 102 deletions datapath/linux/compat/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,108 +922,6 @@ 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);
struct iphdr *iph = &tunnel->parms.iph;

__gre_tunnel_init(dev);

memcpy(dev->dev_addr, &iph->saddr, 4);
memcpy(dev->broadcast, &iph->daddr, 4);

dev->flags = IFF_NOARP;
netif_keep_dst(dev);
dev->addr_len = 4;

if (!tunnel->collect_md) {
dev->header_ops = &ipgre_header_ops;
}

return ip_tunnel_init(dev);
}

static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
struct net_device *dev)
{
struct ip_tunnel *tunnel = netdev_priv(dev);
const struct iphdr *tnl_params;

if (tunnel->collect_md) {
gre_fb_xmit(skb);
return NETDEV_TX_OK;
}

if (dev->header_ops) {
/* Need space for new headers */
if (skb_cow_head(skb, dev->needed_headroom -
(tunnel->hlen + sizeof(struct iphdr))))
goto free_skb;

tnl_params = (const struct iphdr *)skb->data;

/* Pull skb since ip_tunnel_xmit() needs skb->data pointing
* to gre header.
*/
skb_pull(skb, tunnel->hlen + sizeof(struct iphdr));
skb_reset_mac_header(skb);
} else {
if (skb_cow_head(skb, dev->needed_headroom))
goto free_skb;

tnl_params = &tunnel->parms.iph;
}

if (gre_handle_offloads(skb, !!(tunnel->parms.o_flags & TUNNEL_CSUM)))
goto free_skb;

__gre_xmit(skb, dev, tnl_params, skb->protocol);
return NETDEV_TX_OK;

free_skb:
kfree_skb(skb);
dev->stats.tx_dropped++;
return NETDEV_TX_OK;
}

static const struct net_device_ops gre_tap_netdev_ops = {
.ndo_init = gre_tap_init,
.ndo_uninit = rpl_ip_tunnel_uninit,
Expand Down

0 comments on commit b903e17

Please sign in to comment.