mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-30 10:49:28 +00:00
ipv4: Kill early demux method return value.
It's completely unnecessary. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1d1e34ddd4
commit
160eb5a6b1
4 changed files with 27 additions and 38 deletions
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
/* This is used to register protocols. */
|
/* This is used to register protocols. */
|
||||||
struct net_protocol {
|
struct net_protocol {
|
||||||
int (*early_demux)(struct sk_buff *skb);
|
void (*early_demux)(struct sk_buff *skb);
|
||||||
int (*handler)(struct sk_buff *skb);
|
int (*handler)(struct sk_buff *skb);
|
||||||
void (*err_handler)(struct sk_buff *skb, u32 info);
|
void (*err_handler)(struct sk_buff *skb, u32 info);
|
||||||
int (*gso_send_check)(struct sk_buff *skb);
|
int (*gso_send_check)(struct sk_buff *skb);
|
||||||
|
|
|
@ -325,7 +325,7 @@ extern void tcp_v4_err(struct sk_buff *skb, u32);
|
||||||
|
|
||||||
extern void tcp_shutdown (struct sock *sk, int how);
|
extern void tcp_shutdown (struct sock *sk, int how);
|
||||||
|
|
||||||
extern int tcp_v4_early_demux(struct sk_buff *skb);
|
extern void tcp_v4_early_demux(struct sk_buff *skb);
|
||||||
extern int tcp_v4_rcv(struct sk_buff *skb);
|
extern int tcp_v4_rcv(struct sk_buff *skb);
|
||||||
|
|
||||||
extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
|
extern struct inet_peer *tcp_v4_get_peer(struct sock *sk);
|
||||||
|
|
|
@ -320,26 +320,23 @@ static int ip_rcv_finish(struct sk_buff *skb)
|
||||||
const struct iphdr *iph = ip_hdr(skb);
|
const struct iphdr *iph = ip_hdr(skb);
|
||||||
struct rtable *rt;
|
struct rtable *rt;
|
||||||
|
|
||||||
/*
|
if (sysctl_ip_early_demux && !skb_dst(skb)) {
|
||||||
* Initialise the virtual path cache for the packet. It describes
|
|
||||||
* how the packet travels inside Linux networking.
|
|
||||||
*/
|
|
||||||
if (skb_dst(skb) == NULL) {
|
|
||||||
int err = -ENOENT;
|
|
||||||
|
|
||||||
if (sysctl_ip_early_demux) {
|
|
||||||
const struct net_protocol *ipprot;
|
const struct net_protocol *ipprot;
|
||||||
int protocol = iph->protocol;
|
int protocol = iph->protocol;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
ipprot = rcu_dereference(inet_protos[protocol]);
|
ipprot = rcu_dereference(inet_protos[protocol]);
|
||||||
if (ipprot && ipprot->early_demux)
|
if (ipprot && ipprot->early_demux)
|
||||||
err = ipprot->early_demux(skb);
|
ipprot->early_demux(skb);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err) {
|
/*
|
||||||
err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
|
* Initialise the virtual path cache for the packet. It describes
|
||||||
|
* how the packet travels inside Linux networking.
|
||||||
|
*/
|
||||||
|
if (!skb_dst(skb)) {
|
||||||
|
int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
|
||||||
iph->tos, skb->dev);
|
iph->tos, skb->dev);
|
||||||
if (unlikely(err)) {
|
if (unlikely(err)) {
|
||||||
if (err == -EXDEV)
|
if (err == -EXDEV)
|
||||||
|
@ -348,7 +345,6 @@ static int ip_rcv_finish(struct sk_buff *skb)
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_IP_ROUTE_CLASSID
|
#ifdef CONFIG_IP_ROUTE_CLASSID
|
||||||
if (unlikely(skb_dst(skb)->tclassid)) {
|
if (unlikely(skb_dst(skb)->tclassid)) {
|
||||||
|
|
|
@ -1673,30 +1673,28 @@ csum_err:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(tcp_v4_do_rcv);
|
EXPORT_SYMBOL(tcp_v4_do_rcv);
|
||||||
|
|
||||||
int tcp_v4_early_demux(struct sk_buff *skb)
|
void tcp_v4_early_demux(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct net *net = dev_net(skb->dev);
|
struct net *net = dev_net(skb->dev);
|
||||||
const struct iphdr *iph;
|
const struct iphdr *iph;
|
||||||
const struct tcphdr *th;
|
const struct tcphdr *th;
|
||||||
struct net_device *dev;
|
struct net_device *dev;
|
||||||
struct sock *sk;
|
struct sock *sk;
|
||||||
int err;
|
|
||||||
|
|
||||||
err = -ENOENT;
|
|
||||||
if (skb->pkt_type != PACKET_HOST)
|
if (skb->pkt_type != PACKET_HOST)
|
||||||
goto out_err;
|
return;
|
||||||
|
|
||||||
if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
|
if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
|
||||||
goto out_err;
|
return;
|
||||||
|
|
||||||
iph = ip_hdr(skb);
|
iph = ip_hdr(skb);
|
||||||
th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
|
th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
|
||||||
|
|
||||||
if (th->doff < sizeof(struct tcphdr) / 4)
|
if (th->doff < sizeof(struct tcphdr) / 4)
|
||||||
goto out_err;
|
return;
|
||||||
|
|
||||||
if (!pskb_may_pull(skb, ip_hdrlen(skb) + th->doff * 4))
|
if (!pskb_may_pull(skb, ip_hdrlen(skb) + th->doff * 4))
|
||||||
goto out_err;
|
return;
|
||||||
|
|
||||||
dev = skb->dev;
|
dev = skb->dev;
|
||||||
sk = __inet_lookup_established(net, &tcp_hashinfo,
|
sk = __inet_lookup_established(net, &tcp_hashinfo,
|
||||||
|
@ -1713,18 +1711,13 @@ int tcp_v4_early_demux(struct sk_buff *skb)
|
||||||
if (dst) {
|
if (dst) {
|
||||||
struct rtable *rt = (struct rtable *) dst;
|
struct rtable *rt = (struct rtable *) dst;
|
||||||
|
|
||||||
if (rt->rt_iif == dev->ifindex) {
|
if (rt->rt_iif == dev->ifindex)
|
||||||
skb_dst_set_noref(skb, dst);
|
skb_dst_set_noref(skb, dst);
|
||||||
err = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out_err:
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From tcp_input.c
|
* From tcp_input.c
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue