aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2017-09-28 09:51:36 -0400
committerDavid S. Miller <davem@davemloft.net>2017-09-30 22:55:47 -0400
commit7487449c86c65202b3b725c4524cb48dd65e4e6f (patch)
tree4adea181ccd96b769cf011bad6312fe6e07543b3 /net/ipv4/tcp_ipv4.c
parentd41bb33ba33b8f8debe54ed36be6925eb496e354 (diff)
IPv4: early demux can return an error code
Currently no error is emitted, but this infrastructure will used by the next patch to allow source address validation for mcast sockets. Since early demux can do a route lookup and an ipv4 route lookup can return an error code this is consistent with the current ipv4 route infrastructure. Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index d9416b5162bc..85164d4d3e53 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1503,23 +1503,23 @@ csum_err:
1503} 1503}
1504EXPORT_SYMBOL(tcp_v4_do_rcv); 1504EXPORT_SYMBOL(tcp_v4_do_rcv);
1505 1505
1506void tcp_v4_early_demux(struct sk_buff *skb) 1506int tcp_v4_early_demux(struct sk_buff *skb)
1507{ 1507{
1508 const struct iphdr *iph; 1508 const struct iphdr *iph;
1509 const struct tcphdr *th; 1509 const struct tcphdr *th;
1510 struct sock *sk; 1510 struct sock *sk;
1511 1511
1512 if (skb->pkt_type != PACKET_HOST) 1512 if (skb->pkt_type != PACKET_HOST)
1513 return; 1513 return 0;
1514 1514
1515 if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr))) 1515 if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
1516 return; 1516 return 0;
1517 1517
1518 iph = ip_hdr(skb); 1518 iph = ip_hdr(skb);
1519 th = tcp_hdr(skb); 1519 th = tcp_hdr(skb);
1520 1520
1521 if (th->doff < sizeof(struct tcphdr) / 4) 1521 if (th->doff < sizeof(struct tcphdr) / 4)
1522 return; 1522 return 0;
1523 1523
1524 sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo, 1524 sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
1525 iph->saddr, th->source, 1525 iph->saddr, th->source,
@@ -1538,6 +1538,7 @@ void tcp_v4_early_demux(struct sk_buff *skb)
1538 skb_dst_set_noref(skb, dst); 1538 skb_dst_set_noref(skb, dst);
1539 } 1539 }
1540 } 1540 }
1541 return 0;
1541} 1542}
1542 1543
1543bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb) 1544bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)