Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 951dbc8a authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[IPV6]: Move nextheader offset to the IP6CB



Move nextheader offset to the IP6CB to make it possible to pass a
packet to ip6_input_finish multiple times and have it skip already
parsed headers. As a nice side effect this gets rid of the manual
hopopts skipping in ip6_input_finish.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 16a6677f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ struct inet6_skb_parm {
	__u16			srcrt;
	__u16			dst1;
	__u16			lastopt;
	__u32			nhoff;
};

#define IP6CB(skb)	((struct inet6_skb_parm*)((skb)->cb))
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ struct net_protocol {
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
struct inet6_protocol 
{
	int	(*handler)(struct sk_buff **skb, unsigned int *nhoffp);
	int	(*handler)(struct sk_buff **skb);

	void	(*err_handler)(struct sk_buff *skb,
			       struct inet6_skb_parm *opt,
+3 −3
Original line number Diff line number Diff line
@@ -831,7 +831,7 @@ struct xfrm_tunnel {
};

struct xfrm6_tunnel {
	int (*handler)(struct sk_buff **pskb, unsigned int *nhoffp);
	int (*handler)(struct sk_buff **pskb);
	void (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
			    int type, int code, int offset, __u32 info);
};
@@ -868,8 +868,8 @@ extern int xfrm4_rcv(struct sk_buff *skb);
extern int xfrm4_output(struct sk_buff *skb);
extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
extern int xfrm6_rcv_spi(struct sk_buff **pskb, unsigned int *nhoffp, u32 spi);
extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp);
extern int xfrm6_rcv_spi(struct sk_buff **pskb, u32 spi);
extern int xfrm6_rcv(struct sk_buff **pskb);
extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
+1 −1
Original line number Diff line number Diff line
@@ -1029,7 +1029,7 @@ static int dccp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
	return 0;
}

static int dccp_v6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
static int dccp_v6_rcv(struct sk_buff **pskb)
{
	const struct dccp_hdr *dh;
	struct sk_buff *skb = *pskb;
+12 −7
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ static struct tlvtype_proc tlvprocdestopt_lst[] = {
	{-1,			NULL}
};

static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
static int ipv6_destopt_rcv(struct sk_buff **skbp)
{
	struct sk_buff *skb = *skbp;
	struct inet6_skb_parm *opt = IP6CB(skb);
@@ -169,7 +169,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)

	if (ip6_parse_tlv(tlvprocdestopt_lst, skb)) {
		skb->h.raw += ((skb->h.raw[1]+1)<<3);
		*nhoffp = opt->dst1;
		opt->nhoff = opt->dst1;
		return 1;
	}

@@ -192,7 +192,7 @@ void __init ipv6_destopt_init(void)
  NONE header. No data in packet.
 ********************************/

static int ipv6_nodata_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
static int ipv6_nodata_rcv(struct sk_buff **skbp)
{
	struct sk_buff *skb = *skbp;

@@ -215,7 +215,7 @@ void __init ipv6_nodata_init(void)
  Routing header.
 ********************************/

static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
static int ipv6_rthdr_rcv(struct sk_buff **skbp)
{
	struct sk_buff *skb = *skbp;
	struct inet6_skb_parm *opt = IP6CB(skb);
@@ -249,7 +249,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
		skb->h.raw += (hdr->hdrlen + 1) << 3;
		opt->dst0 = opt->dst1;
		opt->dst1 = 0;
		*nhoffp = (&hdr->nexthdr) - skb->nh.raw;
		opt->nhoff = (&hdr->nexthdr) - skb->nh.raw;
		return 1;
	}

@@ -487,9 +487,14 @@ static struct tlvtype_proc tlvprochopopt_lst[] = {

int ipv6_parse_hopopts(struct sk_buff *skb, int nhoff)
{
	IP6CB(skb)->hop = sizeof(struct ipv6hdr);
	if (ip6_parse_tlv(tlvprochopopt_lst, skb))
	struct inet6_skb_parm *opt = IP6CB(skb);

	opt->hop = sizeof(struct ipv6hdr);
	if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
		skb->h.raw += (skb->h.raw[1]+1)<<3;
		opt->nhoff = sizeof(struct ipv6hdr);
		return sizeof(struct ipv6hdr);
	}
	return -1;
}

Loading