lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 9 Mar 2011 02:49:49 +0200 (EET)
From:	Julian Anastasov <ja@....bg>
To:	David Miller <davem@...emloft.net>
cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] ipv4: Cache source address in nexthop entries.


 	Hello,

On Tue, 8 Mar 2011, David Miller wrote:

>> As the addresses have nothing to do with the link
>> state, I don't think it is correct to call fib_update_nh_saddrs
>> for DEV events.
>
> fib_update_nh_saddrs() gets called for "DEV" events since those
> are what are emitted when addresses are addded and removed.

 	But we still need to propagate the address events
to nexthops on all devices. Even if it is slow, I see it in
this way (not tested):

static inline void update_nh_saddr(const struct in_ifaddr *ifa,
 				   struct net_device *dev,
 				   struct fib_nh *nexthop_nh,
 				   unsigned long event)
{
 	if (event == NETDEV_UP) {
 		if (ifa->ifa_local == nexthop_nh->nh_saddr)
 			return;
 	} else {
 		if (ifa->ifa_local != nexthop_nh->nh_saddr)
 			return;
 	}
 	if (ifa->ifa_scope > nexthop_nh->nh_cfg_scope)
 		return;
 	if (dev != nexthop_nh->nh_dev && ifa->ifa_scope >= RT_SCOPE_LINK)
 		return;
 	if (nexthop_nh->nh_flags & RTNH_F_DEAD)
 		return;
 	nexthop_nh->nh_saddr = inet_select_addr(nexthop_nh->nh_dev,
 						nexthop_nh->nh_gw,
 						nexthop_nh->nh_cfg_scope);
}

void fib_update_nh_saddrs(const struct in_ifaddr *ifa, unsigned long event)
{
 	struct net_device *dev = ifa->ifa_dev->dev;
 	int i;

 	for (i = 0; i < fib_hash_size; i++) {
 		struct hlist_head *head = &fib_info_hash[i];
 		struct hlist_node *node;
 		struct fib_info *fi;

 		hlist_for_each_entry(fi, node, head, fib_hash) {
 			if (fi->fib_prefsrc)
 				continue;
 			change_nexthops(fi) {
 				if (!nexthop_nh->nh_dev)
 					continue;
 				update_nh_saddr(ifa, dev, nexthop_nh, event);
 			} endfor_nexthops(fi);
 		}
 	}
}

 	Then may be fib_sync_up() should also refresh nh_saddr,
so that all alive nexthops get actual source address which
was not possible while device was down.

Regards

--
Julian Anastasov <ja@....bg>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ