diff options
-rw-r--r-- | net/ipv4/fib_frontend.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_rpfilter.c | 2 | ||||
-rw-r--r-- | net/ipv4/route.c | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index f05afaf3235c..4d622112bf95 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -326,10 +326,11 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, | |||
326 | u8 tos, int oif, struct net_device *dev, | 326 | u8 tos, int oif, struct net_device *dev, |
327 | int rpf, struct in_device *idev, u32 *itag) | 327 | int rpf, struct in_device *idev, u32 *itag) |
328 | { | 328 | { |
329 | struct net *net = dev_net(dev); | ||
330 | struct flow_keys flkeys; | ||
329 | int ret, no_addr; | 331 | int ret, no_addr; |
330 | struct fib_result res; | 332 | struct fib_result res; |
331 | struct flowi4 fl4; | 333 | struct flowi4 fl4; |
332 | struct net *net = dev_net(dev); | ||
333 | bool dev_match; | 334 | bool dev_match; |
334 | 335 | ||
335 | fl4.flowi4_oif = 0; | 336 | fl4.flowi4_oif = 0; |
@@ -347,6 +348,11 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, | |||
347 | no_addr = idev->ifa_list == NULL; | 348 | no_addr = idev->ifa_list == NULL; |
348 | 349 | ||
349 | fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0; | 350 | fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0; |
351 | if (!fib4_rules_early_flow_dissect(net, skb, &fl4, &flkeys)) { | ||
352 | fl4.flowi4_proto = 0; | ||
353 | fl4.fl4_sport = 0; | ||
354 | fl4.fl4_dport = 0; | ||
355 | } | ||
350 | 356 | ||
351 | trace_fib_validate_source(dev, &fl4); | 357 | trace_fib_validate_source(dev, &fl4); |
352 | 358 | ||
diff --git a/net/ipv4/netfilter/ipt_rpfilter.c b/net/ipv4/netfilter/ipt_rpfilter.c index fd01f13c896a..12843c9ef142 100644 --- a/net/ipv4/netfilter/ipt_rpfilter.c +++ b/net/ipv4/netfilter/ipt_rpfilter.c | |||
@@ -89,10 +89,10 @@ static bool rpfilter_mt(const struct sk_buff *skb, struct xt_action_param *par) | |||
89 | return true ^ invert; | 89 | return true ^ invert; |
90 | } | 90 | } |
91 | 91 | ||
92 | memset(&flow, 0, sizeof(flow)); | ||
92 | flow.flowi4_iif = LOOPBACK_IFINDEX; | 93 | flow.flowi4_iif = LOOPBACK_IFINDEX; |
93 | flow.daddr = iph->saddr; | 94 | flow.daddr = iph->saddr; |
94 | flow.saddr = rpfilter_get_saddr(iph->daddr); | 95 | flow.saddr = rpfilter_get_saddr(iph->daddr); |
95 | flow.flowi4_oif = 0; | ||
96 | flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; | 96 | flow.flowi4_mark = info->flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0; |
97 | flow.flowi4_tos = RT_TOS(iph->tos); | 97 | flow.flowi4_tos = RT_TOS(iph->tos); |
98 | flow.flowi4_scope = RT_SCOPE_UNIVERSE; | 98 | flow.flowi4_scope = RT_SCOPE_UNIVERSE; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 29268efad247..2cfa1b518f8d 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1961,8 +1961,13 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1961 | fl4.saddr = saddr; | 1961 | fl4.saddr = saddr; |
1962 | fl4.flowi4_uid = sock_net_uid(net, NULL); | 1962 | fl4.flowi4_uid = sock_net_uid(net, NULL); |
1963 | 1963 | ||
1964 | if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) | 1964 | if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) { |
1965 | flkeys = &_flkeys; | 1965 | flkeys = &_flkeys; |
1966 | } else { | ||
1967 | fl4.flowi4_proto = 0; | ||
1968 | fl4.fl4_sport = 0; | ||
1969 | fl4.fl4_dport = 0; | ||
1970 | } | ||
1966 | 1971 | ||
1967 | err = fib_lookup(net, &fl4, res, 0); | 1972 | err = fib_lookup(net, &fl4, res, 0); |
1968 | if (err != 0) { | 1973 | if (err != 0) { |