aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/tcp_ipv6.c
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2017-08-07 11:44:21 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-07 14:39:22 -0400
commit4297a0ef085729af98adab9131d128c576ed3044 (patch)
tree4514e23109aff1005bb066d732a64f340b3f6617 /net/ipv6/tcp_ipv6.c
parent1801b570dd2ae50b90231f283e79a9a94fbe7875 (diff)
net: ipv6: add second dif to inet6 socket lookups
Add a second device index, sdif, to inet6 socket lookups. sdif is the index for ingress devices enslaved to an l3mdev. It allows the lookups to consider the enslaved device as well as the L3 domain when searching for a socket. TCP moves the data in the cb. Prior to tcp_v4_rcv (e.g., early demux) the ingress index is obtained from IPCB using inet_sdif and after tcp_v4_rcv tcp_v4_sdif is used. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r--net/ipv6/tcp_ipv6.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ced5dcf37465..f776ec4ecf6d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -350,7 +350,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
350 sk = __inet6_lookup_established(net, &tcp_hashinfo, 350 sk = __inet6_lookup_established(net, &tcp_hashinfo,
351 &hdr->daddr, th->dest, 351 &hdr->daddr, th->dest,
352 &hdr->saddr, ntohs(th->source), 352 &hdr->saddr, ntohs(th->source),
353 skb->dev->ifindex); 353 skb->dev->ifindex, inet6_sdif(skb));
354 354
355 if (!sk) { 355 if (!sk) {
356 __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev), 356 __ICMP6_INC_STATS(net, __in6_dev_get(skb->dev),
@@ -918,7 +918,8 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb)
918 &tcp_hashinfo, NULL, 0, 918 &tcp_hashinfo, NULL, 0,
919 &ipv6h->saddr, 919 &ipv6h->saddr,
920 th->source, &ipv6h->daddr, 920 th->source, &ipv6h->daddr,
921 ntohs(th->source), tcp_v6_iif(skb)); 921 ntohs(th->source), tcp_v6_iif(skb),
922 tcp_v6_sdif(skb));
922 if (!sk1) 923 if (!sk1)
923 goto out; 924 goto out;
924 925
@@ -1397,6 +1398,7 @@ static void tcp_v6_fill_cb(struct sk_buff *skb, const struct ipv6hdr *hdr,
1397 1398
1398static int tcp_v6_rcv(struct sk_buff *skb) 1399static int tcp_v6_rcv(struct sk_buff *skb)
1399{ 1400{
1401 int sdif = inet6_sdif(skb);
1400 const struct tcphdr *th; 1402 const struct tcphdr *th;
1401 const struct ipv6hdr *hdr; 1403 const struct ipv6hdr *hdr;
1402 bool refcounted; 1404 bool refcounted;
@@ -1430,7 +1432,7 @@ static int tcp_v6_rcv(struct sk_buff *skb)
1430 1432
1431lookup: 1433lookup:
1432 sk = __inet6_lookup_skb(&tcp_hashinfo, skb, __tcp_hdrlen(th), 1434 sk = __inet6_lookup_skb(&tcp_hashinfo, skb, __tcp_hdrlen(th),
1433 th->source, th->dest, inet6_iif(skb), 1435 th->source, th->dest, inet6_iif(skb), sdif,
1434 &refcounted); 1436 &refcounted);
1435 if (!sk) 1437 if (!sk)
1436 goto no_tcp_socket; 1438 goto no_tcp_socket;
@@ -1563,7 +1565,8 @@ do_time_wait:
1563 skb, __tcp_hdrlen(th), 1565 skb, __tcp_hdrlen(th),
1564 &ipv6_hdr(skb)->saddr, th->source, 1566 &ipv6_hdr(skb)->saddr, th->source,
1565 &ipv6_hdr(skb)->daddr, 1567 &ipv6_hdr(skb)->daddr,
1566 ntohs(th->dest), tcp_v6_iif(skb)); 1568 ntohs(th->dest), tcp_v6_iif(skb),
1569 sdif);
1567 if (sk2) { 1570 if (sk2) {
1568 struct inet_timewait_sock *tw = inet_twsk(sk); 1571 struct inet_timewait_sock *tw = inet_twsk(sk);
1569 inet_twsk_deschedule_put(tw); 1572 inet_twsk_deschedule_put(tw);
@@ -1610,7 +1613,7 @@ static void tcp_v6_early_demux(struct sk_buff *skb)
1610 sk = __inet6_lookup_established(dev_net(skb->dev), &tcp_hashinfo, 1613 sk = __inet6_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
1611 &hdr->saddr, th->source, 1614 &hdr->saddr, th->source,
1612 &hdr->daddr, ntohs(th->dest), 1615 &hdr->daddr, ntohs(th->dest),
1613 inet6_iif(skb)); 1616 inet6_iif(skb), inet6_sdif(skb));
1614 if (sk) { 1617 if (sk) {
1615 skb->sk = sk; 1618 skb->sk = sk;
1616 skb->destructor = sock_edemux; 1619 skb->destructor = sock_edemux;