Skip to content

Commit

Permalink
[IPV4]: reset IPCB flags when neccessary
Browse files Browse the repository at this point in the history
Reset IPSKB_XFRM_TUNNEL_SIZE flags in ipip and ip_gre hard_start_xmit
function before the packet reenters IP. This is neccessary so the
encapsulated packets are checked not to be oversized in xfrm4_output.c
again. Reset all flags in sit when a packet changes its address family.

Also remove some obsolete IPSKB flags.

Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
kaber authored and David S. Miller committed Jan 7, 2006
1 parent b05e106 commit 8cdfab8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
8 changes: 3 additions & 5 deletions include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,9 @@ struct inet_skb_parm
struct ip_options opt; /* Compiled IP options */
unsigned char flags;

#define IPSKB_MASQUERADED 1
#define IPSKB_TRANSLATED 2
#define IPSKB_FORWARDED 4
#define IPSKB_XFRM_TUNNEL_SIZE 8
#define IPSKB_FRAG_COMPLETE 16
#define IPSKB_FORWARDED 1
#define IPSKB_XFRM_TUNNEL_SIZE 2
#define IPSKB_FRAG_COMPLETE 4
};

struct ipcm_cookie
Expand Down
1 change: 1 addition & 0 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
skb->h.raw = skb->nh.raw;
skb->nh.raw = skb_push(skb, gre_hlen);
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
IPCB(skb)->flags &= ~IPSKB_XFRM_TUNNEL_SIZE;
dst_release(skb->dst);
skb->dst = &rt->u.dst;

Expand Down
1 change: 1 addition & 0 deletions net/ipv4/ipip.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ static int ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
skb->h.raw = skb->nh.raw;
skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
IPCB(skb)->flags &= ~IPSKB_XFRM_TUNNEL_SIZE;
dst_release(skb->dst);
skb->dst = &rt->u.dst;

Expand Down
2 changes: 2 additions & 0 deletions net/ipv6/sit.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ static int ipip6_rcv(struct sk_buff *skb)
skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data;
memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
IPCB(skb)->flags = 0;
skb->protocol = htons(ETH_P_IPV6);
skb->pkt_type = PACKET_HOST;
tunnel->stat.rx_packets++;
Expand Down Expand Up @@ -552,6 +553,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
skb->h.raw = skb->nh.raw;
skb->nh.raw = skb_push(skb, sizeof(struct iphdr));
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
IPCB(skb)->flags = 0;
dst_release(skb->dst);
skb->dst = &rt->u.dst;

Expand Down

0 comments on commit 8cdfab8

Please sign in to comment.