aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/route.c45
-rw-r--r--net/ipv4/xfrm4_policy.c1
2 files changed, 9 insertions, 37 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 264617c98c25..85d103fee88e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -850,7 +850,7 @@ void ip_rt_send_redirect(struct sk_buff *skb)
850 peer->rate_tokens == ip_rt_redirect_number) 850 peer->rate_tokens == ip_rt_redirect_number)
851 net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n", 851 net_warn_ratelimited("host %pI4/if%d ignores redirects for %pI4 to %pI4\n",
852 &ip_hdr(skb)->saddr, rt->rt_iif, 852 &ip_hdr(skb)->saddr, rt->rt_iif,
853 &rt->rt_dst, &rt->rt_gateway); 853 &ip_hdr(skb)->daddr, &rt->rt_gateway);
854#endif 854#endif
855 } 855 }
856out_put_peer: 856out_put_peer:
@@ -1132,8 +1132,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst)
1132 mtu = dst->dev->mtu; 1132 mtu = dst->dev->mtu;
1133 1133
1134 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) { 1134 if (unlikely(dst_metric_locked(dst, RTAX_MTU))) {
1135 1135 if (rt->rt_gateway != 0 && mtu > 576)
1136 if (rt->rt_gateway != rt->rt_dst && mtu > 576)
1137 mtu = 576; 1136 mtu = 576;
1138 } 1137 }
1139 1138
@@ -1271,7 +1270,6 @@ static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr,
1271 rth->rt_genid = rt_genid(dev_net(dev)); 1270 rth->rt_genid = rt_genid(dev_net(dev));
1272 rth->rt_flags = RTCF_MULTICAST; 1271 rth->rt_flags = RTCF_MULTICAST;
1273 rth->rt_type = RTN_MULTICAST; 1272 rth->rt_type = RTN_MULTICAST;
1274 rth->rt_dst = daddr;
1275 rth->rt_route_iif = dev->ifindex; 1273 rth->rt_route_iif = dev->ifindex;
1276 rth->rt_iif = dev->ifindex; 1274 rth->rt_iif = dev->ifindex;
1277 rth->rt_oif = 0; 1275 rth->rt_oif = 0;
@@ -1390,7 +1388,6 @@ static int __mkroute_input(struct sk_buff *skb,
1390 rth->rt_genid = rt_genid(dev_net(rth->dst.dev)); 1388 rth->rt_genid = rt_genid(dev_net(rth->dst.dev));
1391 rth->rt_flags = flags; 1389 rth->rt_flags = flags;
1392 rth->rt_type = res->type; 1390 rth->rt_type = res->type;
1393 rth->rt_dst = daddr;
1394 rth->rt_route_iif = in_dev->dev->ifindex; 1391 rth->rt_route_iif = in_dev->dev->ifindex;
1395 rth->rt_iif = in_dev->dev->ifindex; 1392 rth->rt_iif = in_dev->dev->ifindex;
1396 rth->rt_oif = 0; 1393 rth->rt_oif = 0;
@@ -1556,7 +1553,6 @@ local_input:
1556 rth->rt_genid = rt_genid(net); 1553 rth->rt_genid = rt_genid(net);
1557 rth->rt_flags = flags|RTCF_LOCAL; 1554 rth->rt_flags = flags|RTCF_LOCAL;
1558 rth->rt_type = res.type; 1555 rth->rt_type = res.type;
1559 rth->rt_dst = daddr;
1560 rth->rt_route_iif = dev->ifindex; 1556 rth->rt_route_iif = dev->ifindex;
1561 rth->rt_iif = dev->ifindex; 1557 rth->rt_iif = dev->ifindex;
1562 rth->rt_oif = 0; 1558 rth->rt_oif = 0;
@@ -1707,7 +1703,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
1707 rth->rt_genid = rt_genid(dev_net(dev_out)); 1703 rth->rt_genid = rt_genid(dev_net(dev_out));
1708 rth->rt_flags = flags; 1704 rth->rt_flags = flags;
1709 rth->rt_type = type; 1705 rth->rt_type = type;
1710 rth->rt_dst = fl4->daddr;
1711 rth->rt_route_iif = 0; 1706 rth->rt_route_iif = 0;
1712 rth->rt_iif = orig_oif ? : dev_out->ifindex; 1707 rth->rt_iif = orig_oif ? : dev_out->ifindex;
1713 rth->rt_oif = orig_oif; 1708 rth->rt_oif = orig_oif;
@@ -1995,7 +1990,6 @@ struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_or
1995 rt->rt_genid = rt_genid(net); 1990 rt->rt_genid = rt_genid(net);
1996 rt->rt_flags = ort->rt_flags; 1991 rt->rt_flags = ort->rt_flags;
1997 rt->rt_type = ort->rt_type; 1992 rt->rt_type = ort->rt_type;
1998 rt->rt_dst = ort->rt_dst;
1999 rt->rt_gateway = ort->rt_gateway; 1993 rt->rt_gateway = ort->rt_gateway;
2000 rt->fi = ort->fi; 1994 rt->fi = ort->fi;
2001 if (rt->fi) 1995 if (rt->fi)
@@ -2026,9 +2020,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
2026} 2020}
2027EXPORT_SYMBOL_GPL(ip_route_output_flow); 2021EXPORT_SYMBOL_GPL(ip_route_output_flow);
2028 2022
2029static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4, 2023static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
2030 struct sk_buff *skb, u32 pid, u32 seq, int event, 2024 struct flowi4 *fl4, struct sk_buff *skb, u32 pid,
2031 int nowait, unsigned int flags) 2025 u32 seq, int event, int nowait, unsigned int flags)
2032{ 2026{
2033 struct rtable *rt = skb_rtable(skb); 2027 struct rtable *rt = skb_rtable(skb);
2034 struct rtmsg *r; 2028 struct rtmsg *r;
@@ -2056,7 +2050,7 @@ static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
2056 if (rt->rt_flags & RTCF_NOTIFY) 2050 if (rt->rt_flags & RTCF_NOTIFY)
2057 r->rtm_flags |= RTM_F_NOTIFY; 2051 r->rtm_flags |= RTM_F_NOTIFY;
2058 2052
2059 if (nla_put_be32(skb, RTA_DST, rt->rt_dst)) 2053 if (nla_put_be32(skb, RTA_DST, dst))
2060 goto nla_put_failure; 2054 goto nla_put_failure;
2061 if (src) { 2055 if (src) {
2062 r->rtm_src_len = 32; 2056 r->rtm_src_len = 32;
@@ -2100,29 +2094,8 @@ static int rt_fill_info(struct net *net, __be32 src, struct flowi4 *fl4,
2100 } 2094 }
2101 2095
2102 if (rt_is_input_route(rt)) { 2096 if (rt_is_input_route(rt)) {
2103#ifdef CONFIG_IP_MROUTE 2097 if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
2104 __be32 dst = rt->rt_dst; 2098 goto nla_put_failure;
2105
2106 if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
2107 IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
2108 int err = ipmr_get_route(net, skb,
2109 fl4->saddr, fl4->daddr,
2110 r, nowait);
2111 if (err <= 0) {
2112 if (!nowait) {
2113 if (err == 0)
2114 return 0;
2115 goto nla_put_failure;
2116 } else {
2117 if (err == -EMSGSIZE)
2118 goto nla_put_failure;
2119 error = err;
2120 }
2121 }
2122 } else
2123#endif
2124 if (nla_put_u32(skb, RTA_IIF, rt->rt_iif))
2125 goto nla_put_failure;
2126 } 2099 }
2127 2100
2128 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0) 2101 if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0)
@@ -2217,7 +2190,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
2217 if (rtm->rtm_flags & RTM_F_NOTIFY) 2190 if (rtm->rtm_flags & RTM_F_NOTIFY)
2218 rt->rt_flags |= RTCF_NOTIFY; 2191 rt->rt_flags |= RTCF_NOTIFY;
2219 2192
2220 err = rt_fill_info(net, src, &fl4, skb, 2193 err = rt_fill_info(net, dst, src, &fl4, skb,
2221 NETLINK_CB(in_skb).pid, nlh->nlmsg_seq, 2194 NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
2222 RTM_NEWROUTE, 0, 0); 2195 RTM_NEWROUTE, 0, 0);
2223 if (err <= 0) 2196 if (err <= 0)
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index f73ba8210bd3..6074b694f118 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -91,7 +91,6 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
91 xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST | 91 xdst->u.rt.rt_flags = rt->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST |
92 RTCF_LOCAL); 92 RTCF_LOCAL);
93 xdst->u.rt.rt_type = rt->rt_type; 93 xdst->u.rt.rt_type = rt->rt_type;
94 xdst->u.rt.rt_dst = rt->rt_dst;
95 xdst->u.rt.rt_gateway = rt->rt_gateway; 94 xdst->u.rt.rt_gateway = rt->rt_gateway;
96 xdst->u.rt.rt_pmtu = rt->rt_pmtu; 95 xdst->u.rt.rt_pmtu = rt->rt_pmtu;
97 96