Commit 8b58a398 authored by Florian Westphal's avatar Florian Westphal Committed by David S. Miller

ipv6: use flag instead of u16 for hop in inet6_skb_parm

Hop was always either 0 or sizeof(struct ipv6hdr).
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c3d0d67
...@@ -94,7 +94,6 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb) ...@@ -94,7 +94,6 @@ static inline struct ipv6hdr *ipipv6_hdr(const struct sk_buff *skb)
struct inet6_skb_parm { struct inet6_skb_parm {
int iif; int iif;
__be16 ra; __be16 ra;
__u16 hop;
__u16 dst0; __u16 dst0;
__u16 srcrt; __u16 srcrt;
__u16 dst1; __u16 dst1;
...@@ -111,6 +110,7 @@ struct inet6_skb_parm { ...@@ -111,6 +110,7 @@ struct inet6_skb_parm {
#define IP6SKB_REROUTED 4 #define IP6SKB_REROUTED 4
#define IP6SKB_ROUTERALERT 8 #define IP6SKB_ROUTERALERT 8
#define IP6SKB_FRAGMENTED 16 #define IP6SKB_FRAGMENTED 16
#define IP6SKB_HOPBYHOP 32
}; };
#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) #define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
......
...@@ -679,8 +679,8 @@ bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb, ...@@ -679,8 +679,8 @@ bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb,
const struct ipv6_pinfo *np = inet6_sk(sk); const struct ipv6_pinfo *np = inet6_sk(sk);
if (np->rxopt.all) { if (np->rxopt.all) {
if ((opt->hop && (np->rxopt.bits.hopopts || if (((opt->flags & IP6SKB_HOPBYHOP) &&
np->rxopt.bits.ohopopts)) || (np->rxopt.bits.hopopts || np->rxopt.bits.ohopopts)) ||
(ip6_flowinfo((struct ipv6hdr *) skb_network_header(skb)) && (ip6_flowinfo((struct ipv6hdr *) skb_network_header(skb)) &&
np->rxopt.bits.rxflow) || np->rxopt.bits.rxflow) ||
(opt->srcrt && (np->rxopt.bits.srcrt || (opt->srcrt && (np->rxopt.bits.srcrt ||
......
...@@ -558,8 +558,8 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg, ...@@ -558,8 +558,8 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
} }
/* HbH is allowed only once */ /* HbH is allowed only once */
if (np->rxopt.bits.hopopts && opt->hop) { if (np->rxopt.bits.hopopts && (opt->flags & IP6SKB_HOPBYHOP)) {
u8 *ptr = nh + opt->hop; u8 *ptr = nh + sizeof(struct ipv6hdr);
put_cmsg(msg, SOL_IPV6, IPV6_HOPOPTS, (ptr[1]+1)<<3, ptr); put_cmsg(msg, SOL_IPV6, IPV6_HOPOPTS, (ptr[1]+1)<<3, ptr);
} }
...@@ -620,8 +620,8 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg, ...@@ -620,8 +620,8 @@ void ip6_datagram_recv_specific_ctl(struct sock *sk, struct msghdr *msg,
int hlim = ipv6_hdr(skb)->hop_limit; int hlim = ipv6_hdr(skb)->hop_limit;
put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim); put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);
} }
if (np->rxopt.bits.ohopopts && opt->hop) { if (np->rxopt.bits.ohopopts && (opt->flags & IP6SKB_HOPBYHOP)) {
u8 *ptr = nh + opt->hop; u8 *ptr = nh + sizeof(struct ipv6hdr);
put_cmsg(msg, SOL_IPV6, IPV6_2292HOPOPTS, (ptr[1]+1)<<3, ptr); put_cmsg(msg, SOL_IPV6, IPV6_2292HOPOPTS, (ptr[1]+1)<<3, ptr);
} }
if (np->rxopt.bits.odstopts && opt->dst0) { if (np->rxopt.bits.odstopts && opt->dst0) {
......
...@@ -632,7 +632,7 @@ int ipv6_parse_hopopts(struct sk_buff *skb) ...@@ -632,7 +632,7 @@ int ipv6_parse_hopopts(struct sk_buff *skb)
return -1; return -1;
} }
opt->hop = sizeof(struct ipv6hdr); opt->flags |= IP6SKB_HOPBYHOP;
if (ip6_parse_tlv(tlvprochopopt_lst, skb)) { if (ip6_parse_tlv(tlvprochopopt_lst, skb)) {
skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3; skb->transport_header += (skb_transport_header(skb)[1] + 1) << 3;
opt = IP6CB(skb); opt = IP6CB(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment