[ovs-discuss] [abstract-netdev v2 13/21] netdev: Make netdev_find_dev_by_in4() use netdevs, not device names.

Justin Pettit jpettit at nicira.com
Wed Jul 29 17:40:39 UTC 2009


On Jul 28, 2009, at 2:13 PM, Ben Pfaff wrote:

> -/* Attempts to locate a device based on its IPv4 address.  The caller
> - * may provide a hint as to the device by setting 'netdev_name' to a
> - * likely device name.  This string must be malloc'd, since if it is
> - * not correct then it will be freed.  If there is no hint, then
> - * 'netdev_name' must be the NULL pointer.
> - *
> - * If the device is found, the return value will be true and  
> 'netdev_name'
> - * contains the device's name as a string, which the caller is  
> responsible
> - * for freeing.  If the device is not found, the return value is  
> false. */
> -bool
> -netdev_find_dev_by_in4(const struct in_addr *in4, char **netdev_name)
> +/* Returns a network device that has 'in4' as its IP address, if  
> one exists,
> + * otherwise a null pointer. */
> +struct netdev *
> +netdev_find_dev_by_in4(const struct in_addr *in4)


I agree that the old "hint" mechanism was a bit clunky as implemented,  
but do you think we should scrap it entirely?  Opening the netdev  
device for all the devices each time this call is made seems like it  
could get pretty expensive.  In my queue of changes backed up behind  
L3-based in-band control, I had the attached patch, which provides a  
better hint interface to netdev_find_dev_by_in4().  Obviously, it  
would need to be updated to not use netdev_nodev_* functions to work  
with this change set.

--Justin


-------------- next part --------------
A non-text attachment was scrubbed...
Name: hint.patch
Type: application/octet-stream
Size: 3684 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20090729/5df4e77a/attachment-0004.obj>
-------------- next part --------------






More information about the discuss mailing list