2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00

ofproto-dpif-sflow: allow sFlow to infer the agent device.

Bug #2407.
This commit is contained in:
Luca Giraudo
2011-12-06 13:01:25 -08:00
committed by Ben Pfaff
parent dcc13bc6ee
commit 733adf2aaf
6 changed files with 61 additions and 18 deletions

View File

@@ -692,6 +692,26 @@ netdev_set_in4(struct netdev *netdev, struct in_addr addr, struct in_addr mask)
: EOPNOTSUPP);
}
/* Obtains ad IPv4 address from device name and save the address in
* in4. Returns 0 if successful, otherwise a positive errno value.
*/
int
netdev_get_in4_by_name(const char *device_name, struct in_addr *in4)
{
struct netdev *netdev;
int error;
error = netdev_open(device_name, "system", &netdev);
if (error) {
in4->s_addr = htonl(0);
return error;
}
error = netdev_get_in4(netdev, in4, NULL);
netdev_close(netdev);
return error;
}
/* Adds 'router' as a default IP gateway for the TCP/IP stack that corresponds
* to 'netdev'. */
int