From 460923cf8b81078e6a6e792f99155c36ee83382d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 5 Jun 2009 14:26:42 -0700 Subject: [PATCH] netdev: New function netdev_nodev_get_carrier(). --- lib/netdev.c | 8 +++++++- lib/netdev.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/netdev.c b/lib/netdev.c index 7fd070eb..17e8fe5d 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -1115,6 +1115,12 @@ get_stats_via_proc(const char *netdev_name, struct netdev_stats *stats) int netdev_get_carrier(const struct netdev *netdev, bool *carrier) +{ + return netdev_nodev_get_carrier(netdev->name, carrier); +} + +int +netdev_nodev_get_carrier(const char *netdev_name, bool *carrier) { char line[8]; int retval; @@ -1124,7 +1130,7 @@ netdev_get_carrier(const struct netdev *netdev, bool *carrier) *carrier = false; - fn = xasprintf("/sys/class/net/%s/carrier", netdev->name); + fn = xasprintf("/sys/class/net/%s/carrier", netdev_name); fd = open(fn, O_RDONLY); if (fd < 0) { error = errno; diff --git a/lib/netdev.h b/lib/netdev.h index 63462c56..fbb0ca29 100644 --- a/lib/netdev.h +++ b/lib/netdev.h @@ -110,6 +110,7 @@ int netdev_nodev_set_etheraddr(const char *name, const uint8_t mac[6]); int netdev_nodev_get_etheraddr(const char *netdev_name, uint8_t mac[6]); int netdev_nodev_set_policing(const char *netdev_name, uint32_t kbits_rate, uint32_t kbits_burst); +int netdev_nodev_get_carrier(const char *netdev_name, bool *carrier); int netdev_get_vlan_vid(const char *netdev_name, int *vlan_vid); -- 2.30.2