Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ef083d3 authored by Paolo Abeni's avatar Paolo Abeni Committed by Sean Tranchetti
Browse files

ip: factor out protocol delivery helper



So that we can re-use it at the UDP level in a later patch

rfc v3 -> v1
 - add the helper declaration into the ip header

Change-Id: I5dd1f510dc689a7370c09882985d0ee0dcb2ede4
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git


Git-commit: 68cb7d531e6a87250a51b8a4ee1c79b3445aeff3
Signed-off-by: default avatarSean Tranchetti <stranche@codeaurora.org>
parent e3e92021
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
void ip_list_rcv(struct list_head *head, struct packet_type *pt,
		 struct net_device *orig_dev);
int ip_local_deliver(struct sk_buff *skb);
void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int proto);
int ip_mr_input(struct sk_buff *skb);
int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb);
int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb);
+36 −37
Original line number Diff line number Diff line
@@ -188,27 +188,20 @@ bool ip_call_ra_chain(struct sk_buff *skb)
	return false;
}

static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
	__skb_pull(skb, skb_network_header_len(skb));

	rcu_read_lock();
void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int protocol)
{
		int protocol = ip_hdr(skb)->protocol;
	const struct net_protocol *ipprot;
		int raw;
	int raw, ret;

resubmit:
	raw = raw_local_deliver(skb, protocol);

	ipprot = rcu_dereference(inet_protos[protocol]);
	if (ipprot) {
			int ret;

		if (!ipprot->no_policy) {
			if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
				kfree_skb(skb);
					goto out;
				return;
			}
			nf_reset(skb);
		}
@@ -232,7 +225,13 @@ static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_b
		}
	}
}
 out:

static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
	__skb_pull(skb, skb_network_header_len(skb));

	rcu_read_lock();
	ip_protocol_deliver_rcu(net, skb, ip_hdr(skb)->protocol);
	rcu_read_unlock();

	return 0;