Commit d14c77e0 authored by David Ahern's avatar David Ahern Committed by David S. Miller

ipv6/tcp: Pass dif and sdif to tcp_v6_inbound_md5_hash

The original ingress device index is saved to the cb space of the skb
and the cb is moved during tcp processing. Since tcp_v6_inbound_md5_hash
can be called before and after the cb move, pass dif and sdif to it so
the caller can save both prior to the cb move. Both are used by a later
patch.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cea97609
...@@ -698,7 +698,8 @@ static int tcp_v6_md5_hash_skb(char *md5_hash, ...@@ -698,7 +698,8 @@ static int tcp_v6_md5_hash_skb(char *md5_hash,
#endif #endif
static bool tcp_v6_inbound_md5_hash(const struct sock *sk, static bool tcp_v6_inbound_md5_hash(const struct sock *sk,
const struct sk_buff *skb) const struct sk_buff *skb,
int dif, int sdif)
{ {
#ifdef CONFIG_TCP_MD5SIG #ifdef CONFIG_TCP_MD5SIG
const __u8 *hash_location = NULL; const __u8 *hash_location = NULL;
...@@ -953,6 +954,9 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb) ...@@ -953,6 +954,9 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
if (sk && sk_fullsock(sk)) { if (sk && sk_fullsock(sk)) {
key = tcp_v6_md5_do_lookup(sk, &ipv6h->saddr); key = tcp_v6_md5_do_lookup(sk, &ipv6h->saddr);
} else if (hash_location) { } else if (hash_location) {
int dif = tcp_v6_iif_l3_slave(skb);
int sdif = tcp_v6_sdif(skb);
/* /*
* active side is lost. Try to find listening socket through * active side is lost. Try to find listening socket through
* source port, and then find md5 key through listening socket. * source port, and then find md5 key through listening socket.
...@@ -964,9 +968,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb) ...@@ -964,9 +968,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
&tcp_hashinfo, NULL, 0, &tcp_hashinfo, NULL, 0,
&ipv6h->saddr, &ipv6h->saddr,
th->source, &ipv6h->daddr, th->source, &ipv6h->daddr,
ntohs(th->source), ntohs(th->source), dif, sdif);
tcp_v6_iif_l3_slave(skb),
tcp_v6_sdif(skb));
if (!sk1) if (!sk1)
goto out; goto out;
...@@ -1480,6 +1482,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) ...@@ -1480,6 +1482,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
{ {
struct sk_buff *skb_to_free; struct sk_buff *skb_to_free;
int sdif = inet6_sdif(skb); int sdif = inet6_sdif(skb);
int dif = inet6_iif(skb);
const struct tcphdr *th; const struct tcphdr *th;
const struct ipv6hdr *hdr; const struct ipv6hdr *hdr;
bool refcounted; bool refcounted;
...@@ -1528,7 +1531,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) ...@@ -1528,7 +1531,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
struct sock *nsk; struct sock *nsk;
sk = req->rsk_listener; sk = req->rsk_listener;
if (tcp_v6_inbound_md5_hash(sk, skb)) { if (tcp_v6_inbound_md5_hash(sk, skb, dif, sdif)) {
sk_drops_add(sk, skb); sk_drops_add(sk, skb);
reqsk_put(req); reqsk_put(req);
goto discard_it; goto discard_it;
...@@ -1583,7 +1586,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) ...@@ -1583,7 +1586,7 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb)) if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
goto discard_and_relse; goto discard_and_relse;
if (tcp_v6_inbound_md5_hash(sk, skb)) if (tcp_v6_inbound_md5_hash(sk, skb, dif, sdif))
goto discard_and_relse; goto discard_and_relse;
if (tcp_filter(sk, skb)) if (tcp_filter(sk, 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