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

Commit c2ad6eba authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Revert "tcp/udp: Make early_demux back namespacified."



This reverts commit 7162f05f which is
commit 11052589cf5c0bab3b4884d423d5f60c38fcf25d upstream.

It is breaks the abi and is not needed in Android systems, so revert it.

Bug: 161946584
Change-Id: I357d52cd6a635050f305127246f95cb2302633be
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 9e134db9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,8 @@

/* This is used to register protocols. */
struct net_protocol {
	int			(*early_demux)(struct sk_buff *skb);
	int			(*early_demux_handler)(struct sk_buff *skb);
	int			(*handler)(struct sk_buff *skb);
	void			(*err_handler)(struct sk_buff *skb, u32 info);
	unsigned int		no_policy:1,
@@ -52,6 +54,8 @@ struct net_protocol {

#if IS_ENABLED(CONFIG_IPV6)
struct inet6_protocol {
	void	(*early_demux)(struct sk_buff *skb);
	void    (*early_demux_handler)(struct sk_buff *skb);
	int	(*handler)(struct sk_buff *skb);

	void	(*err_handler)(struct sk_buff *skb,
+0 −2
Original line number Diff line number Diff line
@@ -901,8 +901,6 @@ static inline int tcp_v6_sdif(const struct sk_buff *skb)
#endif
	return 0;
}

void tcp_v6_early_demux(struct sk_buff *skb);
#endif

static inline bool inet_exact_dif_match(struct net *net, struct sk_buff *skb)
+0 −1
Original line number Diff line number Diff line
@@ -173,7 +173,6 @@ typedef struct sock *(*udp_lookup_t)(struct sk_buff *skb, __be16 sport,
struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
				struct udphdr *uh, udp_lookup_t lookup);
int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup);
void udp_v6_early_demux(struct sk_buff *skb);

struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
				  netdev_features_t features);
+12 −2
Original line number Diff line number Diff line
@@ -1678,7 +1678,12 @@ static const struct net_protocol igmp_protocol = {
};
#endif

static const struct net_protocol tcp_protocol = {
/* thinking of making this const? Don't.
 * early_demux can change based on sysctl.
 */
static struct net_protocol tcp_protocol = {
	.early_demux	=	tcp_v4_early_demux,
	.early_demux_handler =  tcp_v4_early_demux,
	.handler	=	tcp_v4_rcv,
	.err_handler	=	tcp_v4_err,
	.no_policy	=	1,
@@ -1686,7 +1691,12 @@ static const struct net_protocol tcp_protocol = {
	.icmp_strict_tag_validation = 1,
};

static const struct net_protocol udp_protocol = {
/* thinking of making this const? Don't.
 * early_demux can change based on sysctl.
 */
static struct net_protocol udp_protocol = {
	.early_demux =	udp_v4_early_demux,
	.early_demux_handler =	udp_v4_early_demux,
	.handler =	udp_rcv,
	.err_handler =	udp_err,
	.no_policy =	1,
+11 −21
Original line number Diff line number Diff line
@@ -306,39 +306,29 @@ static inline bool ip_rcv_options(struct sk_buff *skb, struct net_device *dev)
	return true;
}

int udp_v4_early_demux(struct sk_buff *);
int tcp_v4_early_demux(struct sk_buff *);
static int ip_rcv_finish_core(struct net *net, struct sock *sk,
			      struct sk_buff *skb, struct net_device *dev)
{
	const struct iphdr *iph = ip_hdr(skb);
	int (*edemux)(struct sk_buff *skb);
	struct rtable *rt;
	int err;

	if (READ_ONCE(net->ipv4.sysctl_ip_early_demux) &&
	if (net->ipv4.sysctl_ip_early_demux &&
	    !skb_dst(skb) &&
	    !skb->sk &&
	    !ip_is_fragment(iph)) {
		switch (iph->protocol) {
		case IPPROTO_TCP:
			if (READ_ONCE(net->ipv4.sysctl_tcp_early_demux)) {
				tcp_v4_early_demux(skb);
		const struct net_protocol *ipprot;
		int protocol = iph->protocol;

				/* must reload iph, skb->head might have changed */
				iph = ip_hdr(skb);
			}
			break;
		case IPPROTO_UDP:
			if (READ_ONCE(net->ipv4.sysctl_udp_early_demux)) {
				err = udp_v4_early_demux(skb);
		ipprot = rcu_dereference(inet_protos[protocol]);
		if (ipprot && (edemux = READ_ONCE(ipprot->early_demux))) {
			err = edemux(skb);
			if (unlikely(err))
				goto drop_error;

			/* must reload iph, skb->head might have changed */
			iph = ip_hdr(skb);
		}
			break;
		}
	}

	/*
Loading