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

Commit 92101b3b authored by David S. Miller's avatar David S. Miller
Browse files

ipv4: Prepare for change of rt->rt_iif encoding.



Use inet_iif() consistently, and for TCP record the input interface of
cached RX dst in inet sock.

rt->rt_iif is going to be encoded differently, so that we can
legitimately cache input routes in the FIB info more aggressively.

When the input interface is "use SKB device index" the rt->rt_iif will
be set to zero.

This forces us to move the TCP RX dst cache installation into the ipv4
specific code, and as well it should since doing the route caching for
ipv6 is pointless at the moment since it is not inspected in the ipv6
input paths yet.

Also, remove the unlikely on dst->obsolete, all ipv4 dsts have
obsolete set to a non-zero value to force invocation of the check
callback.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe3edf45
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ struct inet_sock {
	int			uc_index;
	int			mc_index;
	__be32			mc_addr;
	int			rx_dst_ifindex;
	struct ip_mc_socklist __rcu	*mc_list;
	struct inet_cork_full	cork;
};
+1 −1
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
	struct rtable *rt;
	const struct iphdr *iph = ip_hdr(skb);
	struct flowi4 fl4 = {
		.flowi4_oif = skb_rtable(skb)->rt_iif,
		.flowi4_oif = inet_iif(skb),
		.daddr = iph->saddr,
		.saddr = iph->daddr,
		.flowi4_tos = RT_CONN_FLAGS(sk),
+1 −1
Original line number Diff line number Diff line
@@ -571,7 +571,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
		rcu_read_lock();
		if (rt_is_input_route(rt) &&
		    net->ipv4.sysctl_icmp_errors_use_inbound_ifaddr)
			dev = dev_get_by_index_rcu(net, rt->rt_iif);
			dev = dev_get_by_index_rcu(net, inet_iif(skb_in));

		if (dev)
			saddr = inet_select_addr(dev, 0, RT_SCOPE_LINK);
+2 −3
Original line number Diff line number Diff line
@@ -1027,10 +1027,9 @@ e_inval:
void ipv4_pktinfo_prepare(struct sk_buff *skb)
{
	struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);
	const struct rtable *rt = skb_rtable(skb);

	if (rt) {
		pktinfo->ipi_ifindex = rt->rt_iif;
	if (skb_rtable(skb)) {
		pktinfo->ipi_ifindex = inet_iif(skb);
		pktinfo->ipi_spec_dst.s_addr = fib_compute_spec_dst(skb);
	} else {
		pktinfo->ipi_ifindex = 0;
+1 −1
Original line number Diff line number Diff line
@@ -848,7 +848,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
		if (log_martians &&
		    peer->rate_tokens == ip_rt_redirect_number)
			net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
					     &ip_hdr(skb)->saddr, rt->rt_iif,
					     &ip_hdr(skb)->saddr, inet_iif(skb),
					     &ip_hdr(skb)->daddr, &rt->rt_gateway);
#endif
	}
Loading