aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index a68966059b50..c47ce7076bd5 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -15,16 +15,19 @@ int ip_route_me_harder(struct sk_buff **pskb, unsigned addr_type)
15 struct flowi fl = {}; 15 struct flowi fl = {};
16 struct dst_entry *odst; 16 struct dst_entry *odst;
17 unsigned int hh_len; 17 unsigned int hh_len;
18 unsigned int type;
18 19
20 type = inet_addr_type(iph->saddr);
19 if (addr_type == RTN_UNSPEC) 21 if (addr_type == RTN_UNSPEC)
20 addr_type = inet_addr_type(iph->saddr); 22 addr_type = type;
21 23
22 /* some non-standard hacks like ipt_REJECT.c:send_reset() can cause 24 /* some non-standard hacks like ipt_REJECT.c:send_reset() can cause
23 * packets with foreign saddr to appear on the NF_IP_LOCAL_OUT hook. 25 * packets with foreign saddr to appear on the NF_IP_LOCAL_OUT hook.
24 */ 26 */
25 if (addr_type == RTN_LOCAL) { 27 if (addr_type == RTN_LOCAL) {
26 fl.nl_u.ip4_u.daddr = iph->daddr; 28 fl.nl_u.ip4_u.daddr = iph->daddr;
27 fl.nl_u.ip4_u.saddr = iph->saddr; 29 if (type == RTN_LOCAL)
30 fl.nl_u.ip4_u.saddr = iph->saddr;
28 fl.nl_u.ip4_u.tos = RT_TOS(iph->tos); 31 fl.nl_u.ip4_u.tos = RT_TOS(iph->tos);
29 fl.oif = (*pskb)->sk ? (*pskb)->sk->sk_bound_dev_if : 0; 32 fl.oif = (*pskb)->sk ? (*pskb)->sk->sk_bound_dev_if : 0;
30 fl.mark = (*pskb)->mark; 33 fl.mark = (*pskb)->mark;