diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/ipt_REDIRECT.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/ipv4/netfilter/ipt_REDIRECT.c b/net/ipv4/netfilter/ipt_REDIRECT.c index d2e13447678e..715cb613405c 100644 --- a/net/ipv4/netfilter/ipt_REDIRECT.c +++ b/net/ipv4/netfilter/ipt_REDIRECT.c | |||
@@ -88,14 +88,18 @@ redirect_target(struct sk_buff **pskb, | |||
88 | newdst = htonl(0x7F000001); | 88 | newdst = htonl(0x7F000001); |
89 | else { | 89 | else { |
90 | struct in_device *indev; | 90 | struct in_device *indev; |
91 | struct in_ifaddr *ifa; | ||
91 | 92 | ||
92 | /* Device might not have an associated in_device. */ | 93 | newdst = 0; |
93 | indev = (struct in_device *)(*pskb)->dev->ip_ptr; | 94 | |
94 | if (indev == NULL || indev->ifa_list == NULL) | 95 | rcu_read_lock(); |
95 | return NF_DROP; | 96 | indev = __in_dev_get((*pskb)->dev); |
97 | if (indev && (ifa = indev->ifa_list)) | ||
98 | newdst = ifa->ifa_local; | ||
99 | rcu_read_unlock(); | ||
96 | 100 | ||
97 | /* Grab first address on interface. */ | 101 | if (!newdst) |
98 | newdst = indev->ifa_list->ifa_local; | 102 | return NF_DROP; |
99 | } | 103 | } |
100 | 104 | ||
101 | /* Transfer from original range. */ | 105 | /* Transfer from original range. */ |