diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-01-21 10:21:45 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-01-21 10:21:45 -0600 |
commit | 8388961f5ffae7cb5f2904b606d797d76c678257 (patch) | |
tree | ff83896512fd4ef3ede6247e139f79c3052e8b51 /apps/netutils/uiplib/uip_getifflag.c | |
parent | 9fc3ffdbbe02c3f9bf128527aee96a52b5657fcb (diff) | |
download | nuttx-8388961f5ffae7cb5f2904b606d797d76c678257.tar.gz nuttx-8388961f5ffae7cb5f2904b606d797d76c678257.tar.bz2 nuttx-8388961f5ffae7cb5f2904b606d797d76c678257.zip |
Networking: Improved status reporting and new carrier management interfaces. From Max Holtzberg
Diffstat (limited to 'apps/netutils/uiplib/uip_getifflag.c')
-rw-r--r-- | apps/netutils/uiplib/uip_getifflag.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/apps/netutils/uiplib/uip_getifflag.c b/apps/netutils/uiplib/uip_getifflag.c index 8574d331a..0f292e4a1 100644 --- a/apps/netutils/uiplib/uip_getifflag.c +++ b/apps/netutils/uiplib/uip_getifflag.c @@ -1,7 +1,7 @@ /**************************************************************************** * netutils/uiplib/uip_getifflag.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -65,14 +65,14 @@ * * Parameters: * ifname The name of the interface to use - * status interface flag ifup or ifdown status + * flags The interface flags returned by SIOCGIFFLAGS * * Return: * 0 on sucess; -1 on failure * ****************************************************************************/ -int uip_getifstatus(const char *ifname, bool *status) +int uip_getifstatus(const char *ifname, uint8_t *flags) { int ret = ERROR; if (ifname) @@ -94,24 +94,13 @@ int uip_getifstatus(const char *ifname, bool *status) ret = ioctl(sockfd, SIOCGIFFLAGS, (unsigned long)&req); if (!ret) { - /* Return the ifup or ifdown status */ - - if ((req.ifr_flags & IF_FLAG_IFUP) == (req.ifr_flags & IF_FLAG_IFDOWN)) - { - ret = ERROR; - } - else if(req.ifr_flags & IF_FLAG_IFUP) - { - *status = true; - } - else - { - *status = false; - } + *flags = req.ifr_flags; } + close(sockfd); } } + return ret; } |