route.c (35732d01fe311ec13c4e42936878b782b8e7ea85) route.c (60006a4825f9e71adf770745e17790c6e6c97a89)
1/*
2 * Linux INET6 implementation
3 * FIB front-end.
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * This program is free software; you can redistribute it and/or

--- 1250 unchanged lines hidden (view full) ---

1259 * and exception table is indexed by a hash of
1260 * both rt6i_dst and rt6i_src.
1261 * Otherwise, the exception table is indexed by
1262 * a hash of only rt6i_dst.
1263 */
1264 if (ort->rt6i_src.plen)
1265 src_key = &nrt->rt6i_src.addr;
1266#endif
1/*
2 * Linux INET6 implementation
3 * FIB front-end.
4 *
5 * Authors:
6 * Pedro Roque <roque@di.fc.ul.pt>
7 *
8 * This program is free software; you can redistribute it and/or

--- 1250 unchanged lines hidden (view full) ---

1259 * and exception table is indexed by a hash of
1260 * both rt6i_dst and rt6i_src.
1261 * Otherwise, the exception table is indexed by
1262 * a hash of only rt6i_dst.
1263 */
1264 if (ort->rt6i_src.plen)
1265 src_key = &nrt->rt6i_src.addr;
1266#endif
1267
1268 /* Update rt6i_prefsrc as it could be changed
1269 * in rt6_remove_prefsrc()
1270 */
1271 nrt->rt6i_prefsrc = ort->rt6i_prefsrc;
1272
1267 rt6_ex = __rt6_find_exception_spinlock(&bucket, &nrt->rt6i_dst.addr,
1268 src_key);
1269 if (rt6_ex)
1270 rt6_remove_exception(bucket, rt6_ex);
1271
1272 rt6_ex = kzalloc(sizeof(*rt6_ex), GFP_ATOMIC);
1273 if (!rt6_ex) {
1274 err = -ENOMEM;

--- 152 unchanged lines hidden (view full) ---

1427 &rt->rt6i_dst.addr,
1428 src_key);
1429 if (rt6_ex)
1430 rt6_ex->stamp = jiffies;
1431
1432 rcu_read_unlock();
1433}
1434
1273 rt6_ex = __rt6_find_exception_spinlock(&bucket, &nrt->rt6i_dst.addr,
1274 src_key);
1275 if (rt6_ex)
1276 rt6_remove_exception(bucket, rt6_ex);
1277
1278 rt6_ex = kzalloc(sizeof(*rt6_ex), GFP_ATOMIC);
1279 if (!rt6_ex) {
1280 err = -ENOMEM;

--- 152 unchanged lines hidden (view full) ---

1433 &rt->rt6i_dst.addr,
1434 src_key);
1435 if (rt6_ex)
1436 rt6_ex->stamp = jiffies;
1437
1438 rcu_read_unlock();
1439}
1440
1441static void rt6_exceptions_remove_prefsrc(struct rt6_info *rt)
1442{
1443 struct rt6_exception_bucket *bucket;
1444 struct rt6_exception *rt6_ex;
1445 int i;
1446
1447 bucket = rcu_dereference_protected(rt->rt6i_exception_bucket,
1448 lockdep_is_held(&rt6_exception_lock));
1449
1450 if (bucket) {
1451 for (i = 0; i < FIB6_EXCEPTION_BUCKET_SIZE; i++) {
1452 hlist_for_each_entry(rt6_ex, &bucket->chain, hlist) {
1453 rt6_ex->rt6i->rt6i_prefsrc.plen = 0;
1454 }
1455 bucket++;
1456 }
1457 }
1458}
1459
1435struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
1436 int oif, struct flowi6 *fl6, int flags)
1437{
1438 struct fib6_node *fn, *saved_fn;
1439 struct rt6_info *rt;
1440 int strict = 0;
1441
1442 strict |= flags & RT6_LOOKUP_F_IFACE;

--- 1711 unchanged lines hidden (view full) ---

3154{
3155 struct net_device *dev = ((struct arg_dev_net_ip *)arg)->dev;
3156 struct net *net = ((struct arg_dev_net_ip *)arg)->net;
3157 struct in6_addr *addr = ((struct arg_dev_net_ip *)arg)->addr;
3158
3159 if (((void *)rt->dst.dev == dev || !dev) &&
3160 rt != net->ipv6.ip6_null_entry &&
3161 ipv6_addr_equal(addr, &rt->rt6i_prefsrc.addr)) {
1460struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
1461 int oif, struct flowi6 *fl6, int flags)
1462{
1463 struct fib6_node *fn, *saved_fn;
1464 struct rt6_info *rt;
1465 int strict = 0;
1466
1467 strict |= flags & RT6_LOOKUP_F_IFACE;

--- 1711 unchanged lines hidden (view full) ---

3179{
3180 struct net_device *dev = ((struct arg_dev_net_ip *)arg)->dev;
3181 struct net *net = ((struct arg_dev_net_ip *)arg)->net;
3182 struct in6_addr *addr = ((struct arg_dev_net_ip *)arg)->addr;
3183
3184 if (((void *)rt->dst.dev == dev || !dev) &&
3185 rt != net->ipv6.ip6_null_entry &&
3186 ipv6_addr_equal(addr, &rt->rt6i_prefsrc.addr)) {
3187 spin_lock_bh(&rt6_exception_lock);
3162 /* remove prefsrc entry */
3163 rt->rt6i_prefsrc.plen = 0;
3188 /* remove prefsrc entry */
3189 rt->rt6i_prefsrc.plen = 0;
3190 /* need to update cache as well */
3191 rt6_exceptions_remove_prefsrc(rt);
3192 spin_unlock_bh(&rt6_exception_lock);
3164 }
3165 return 0;
3166}
3167
3168void rt6_remove_prefsrc(struct inet6_ifaddr *ifp)
3169{
3170 struct net *net = dev_net(ifp->idev->dev);
3171 struct arg_dev_net_ip adni = {

--- 1405 unchanged lines hidden ---
3193 }
3194 return 0;
3195}
3196
3197void rt6_remove_prefsrc(struct inet6_ifaddr *ifp)
3198{
3199 struct net *net = dev_net(ifp->idev->dev);
3200 struct arg_dev_net_ip adni = {

--- 1405 unchanged lines hidden ---