提交 cb7928a5 编写于 作者: R Rami Rosen 提交者: David S. Miller

[IPV4]: Remove unsupported DNAT (RTCF_NAT and RTCF_NAT) in IPV4

- The DNAT (Destination NAT) is not implemented in IPV4.

- This patch remove the code which checks these flags
in net/ipv4/arp.c and net/ipv4/route.c.

The RTCF_NAT and RTCF_NAT should stay in the header (linux/in_route.h)
because they are used in DECnet.
Signed-off-by: NRami Rosen <ramirose@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f0b5a0dc
...@@ -835,9 +835,8 @@ static int arp_process(struct sk_buff *skb) ...@@ -835,9 +835,8 @@ static int arp_process(struct sk_buff *skb)
} }
goto out; goto out;
} else if (IN_DEV_FORWARD(in_dev)) { } else if (IN_DEV_FORWARD(in_dev)) {
if ((rt->rt_flags&RTCF_DNAT) || if (addr_type == RTN_UNICAST && rt->u.dst.dev != dev &&
(addr_type == RTN_UNICAST && rt->u.dst.dev != dev && (arp_fwd_proxy(in_dev, rt) || pneigh_lookup(&arp_tbl, &init_net, &tip, dev, 0))) {
(arp_fwd_proxy(in_dev, rt) || pneigh_lookup(&arp_tbl, &init_net, &tip, dev, 0)))) {
n = neigh_event_ns(&arp_tbl, sha, &sip, dev); n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
if (n) if (n)
neigh_release(n); neigh_release(n);
......
...@@ -1768,7 +1768,7 @@ static inline int __mkroute_input(struct sk_buff *skb, ...@@ -1768,7 +1768,7 @@ static inline int __mkroute_input(struct sk_buff *skb,
if (err) if (err)
flags |= RTCF_DIRECTSRC; flags |= RTCF_DIRECTSRC;
if (out_dev == in_dev && err && !(flags & (RTCF_NAT | RTCF_MASQ)) && if (out_dev == in_dev && err && !(flags & RTCF_MASQ) &&
(IN_DEV_SHARED_MEDIA(out_dev) || (IN_DEV_SHARED_MEDIA(out_dev) ||
inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
flags |= RTCF_DOREDIRECT; flags |= RTCF_DOREDIRECT;
...@@ -1777,7 +1777,7 @@ static inline int __mkroute_input(struct sk_buff *skb, ...@@ -1777,7 +1777,7 @@ static inline int __mkroute_input(struct sk_buff *skb,
/* Not IP (i.e. ARP). Do not create route, if it is /* Not IP (i.e. ARP). Do not create route, if it is
* invalid for proxy arp. DNAT routes are always valid. * invalid for proxy arp. DNAT routes are always valid.
*/ */
if (out_dev == in_dev && !(flags & RTCF_DNAT)) { if (out_dev == in_dev) {
err = -EINVAL; err = -EINVAL;
goto cleanup; goto cleanup;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册