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>
This commit is contained in:
committed by
David S. Miller
parent
d41bb33ba3
commit
7487449c86
@@ -1503,23 +1503,23 @@ csum_err:
|
||||
}
|
||||
EXPORT_SYMBOL(tcp_v4_do_rcv);
|
||||
|
||||
void tcp_v4_early_demux(struct sk_buff *skb)
|
||||
int tcp_v4_early_demux(struct sk_buff *skb)
|
||||
{
|
||||
const struct iphdr *iph;
|
||||
const struct tcphdr *th;
|
||||
struct sock *sk;
|
||||
|
||||
if (skb->pkt_type != PACKET_HOST)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
|
||||
return;
|
||||
return 0;
|
||||
|
||||
iph = ip_hdr(skb);
|
||||
th = tcp_hdr(skb);
|
||||
|
||||
if (th->doff < sizeof(struct tcphdr) / 4)
|
||||
return;
|
||||
return 0;
|
||||
|
||||
sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
|
||||
iph->saddr, th->source,
|
||||
@@ -1538,6 +1538,7 @@ void tcp_v4_early_demux(struct sk_buff *skb)
|
||||
skb_dst_set_noref(skb, dst);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
|
||||
|
||||
Reference in New Issue
Block a user