Commit e058464990c2ef1f3ecd6b83a154913c3c06f02a
1 parent
0e214ad815
Exists in
master
and in
7 other branches
Revert "ipv4: Allow configuring subnets as local addresses"
This reverts commit 4465b469008bc03b98a1b8df4e9ae501b6c69d4b. Conflicts: net/ipv4/fib_frontend.c As reported by Ben Greear, this causes regressions: > Change 4465b469008bc03b98a1b8df4e9ae501b6c69d4b caused rules > to stop matching the input device properly because the > FLOWI_FLAG_MATCH_ANY_IIF is always defined in ip_dev_find(). > > This breaks rules such as: > > ip rule add pref 512 lookup local > ip rule del pref 0 lookup local > ip link set eth2 up > ip -4 addr add 172.16.0.102/24 broadcast 172.16.0.255 dev eth2 > ip rule add to 172.16.0.102 iif eth2 lookup local pref 10 > ip rule add iif eth2 lookup 10001 pref 20 > ip route add 172.16.0.0/24 dev eth2 table 10001 > ip route add unreachable 0/0 table 10001 > > If you had a second interface 'eth0' that was on a different > subnet, pinging a system on that interface would fail: > > [root@ct503-60 ~]# ping 192.168.100.1 > connect: Invalid argument Reported-by: Ben Greear <greearb@candelatech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 3 changed files with 9 additions and 5 deletions Side-by-side Diff
include/net/flow.h
net/core/fib_rules.c
... | ... | @@ -181,8 +181,7 @@ |
181 | 181 | { |
182 | 182 | int ret = 0; |
183 | 183 | |
184 | - if (rule->iifindex && (rule->iifindex != fl->iif) && | |
185 | - !(fl->flags & FLOWI_FLAG_MATCH_ANY_IIF)) | |
184 | + if (rule->iifindex && (rule->iifindex != fl->iif)) | |
186 | 185 | goto out; |
187 | 186 | |
188 | 187 | if (rule->oifindex && (rule->oifindex != fl->oif)) |
net/ipv4/fib_frontend.c
... | ... | @@ -163,13 +163,19 @@ |
163 | 163 | .daddr = addr |
164 | 164 | } |
165 | 165 | }, |
166 | - .flags = FLOWI_FLAG_MATCH_ANY_IIF | |
167 | 166 | }; |
168 | 167 | struct fib_result res = { 0 }; |
169 | 168 | struct net_device *dev = NULL; |
169 | + struct fib_table *local_table; | |
170 | 170 | |
171 | +#ifdef CONFIG_IP_MULTIPLE_TABLES | |
172 | + res.r = NULL; | |
173 | +#endif | |
174 | + | |
171 | 175 | rcu_read_lock(); |
172 | - if (fib_lookup(net, &fl, &res)) { | |
176 | + local_table = fib_get_table(net, RT_TABLE_LOCAL); | |
177 | + if (!local_table || | |
178 | + fib_table_lookup(local_table, &fl, &res, FIB_LOOKUP_NOREF)) { | |
173 | 179 | rcu_read_unlock(); |
174 | 180 | return NULL; |
175 | 181 | } |