mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
gre: move iptunnel_pull_header down to ipgre_rcv
This will allow to make the pull dependent on the tunnel type. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
00b2034029
commit
244a797bdc
@ -260,7 +260,8 @@ static __be32 tunnel_id_to_key(__be64 x)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
|
static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
|
||||||
|
int hdr_len)
|
||||||
{
|
{
|
||||||
struct net *net = dev_net(skb->dev);
|
struct net *net = dev_net(skb->dev);
|
||||||
struct metadata_dst *tun_dst = NULL;
|
struct metadata_dst *tun_dst = NULL;
|
||||||
@ -278,6 +279,9 @@ static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
|
|||||||
iph->saddr, iph->daddr, tpi->key);
|
iph->saddr, iph->daddr, tpi->key);
|
||||||
|
|
||||||
if (tunnel) {
|
if (tunnel) {
|
||||||
|
if (iptunnel_pull_header(skb, hdr_len, tpi->proto, false) < 0)
|
||||||
|
goto drop;
|
||||||
|
|
||||||
skb_pop_mac_header(skb);
|
skb_pop_mac_header(skb);
|
||||||
if (tunnel->collect_md) {
|
if (tunnel->collect_md) {
|
||||||
__be16 flags;
|
__be16 flags;
|
||||||
@ -294,6 +298,10 @@ static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
|
|||||||
return PACKET_RCVD;
|
return PACKET_RCVD;
|
||||||
}
|
}
|
||||||
return PACKET_REJECT;
|
return PACKET_REJECT;
|
||||||
|
|
||||||
|
drop:
|
||||||
|
kfree_skb(skb);
|
||||||
|
return PACKET_RCVD;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gre_rcv(struct sk_buff *skb)
|
static int gre_rcv(struct sk_buff *skb)
|
||||||
@ -314,10 +322,7 @@ static int gre_rcv(struct sk_buff *skb)
|
|||||||
if (hdr_len < 0)
|
if (hdr_len < 0)
|
||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
if (iptunnel_pull_header(skb, hdr_len, tpi.proto, false))
|
if (ipgre_rcv(skb, &tpi, hdr_len) == PACKET_RCVD)
|
||||||
goto drop;
|
|
||||||
|
|
||||||
if (ipgre_rcv(skb, &tpi) == PACKET_RCVD)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
|
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user