summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2017-03-23 17:42:03 +1100
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2017-07-11 14:32:23 +1000
commit1ac262ed5224463c01525c680d1f58f7df48b943 (patch)
tree56dabeeb372d5c09bb79a6d1a89ea4d16d1d784e
parent417265c68731537deeed22a3a3530cd6dd986513 (diff)
downloadpetitboot-1ac262ed5224463c01525c680d1f58f7df48b943.zip
petitboot-1ac262ed5224463c01525c680d1f58f7df48b943.tar.gz
discover/sysinfo: Add network availability helper
Add a helper function that describes interfaces as available if they have an assigned address. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
-rw-r--r--discover/sysinfo.c9
-rw-r--r--discover/sysinfo.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/discover/sysinfo.c b/discover/sysinfo.c
index e8e6d52..74d1eae 100644
--- a/discover/sysinfo.c
+++ b/discover/sysinfo.c
@@ -17,6 +17,15 @@ const struct system_info *system_info_get(void)
return sysinfo;
}
+bool system_info_network_available(void)
+{
+ unsigned int i;
+
+ for (i = 0; i < sysinfo->n_interfaces; i++)
+ if (sysinfo->interfaces[i]->address)
+ return true;
+ return false;
+}
void system_info_set_interface_address(unsigned int hwaddr_size,
uint8_t *hwaddr, const char *address)
diff --git a/discover/sysinfo.h b/discover/sysinfo.h
index c570951..835dfbe 100644
--- a/discover/sysinfo.h
+++ b/discover/sysinfo.h
@@ -7,6 +7,7 @@ struct discover_server;
const struct system_info *system_info_get(void);
+bool system_info_network_available(void);
void system_info_set_interface_address(unsigned int hwaddr_size,
uint8_t *hwaddr, const char *address);
void system_info_register_interface(unsigned int hwaddr_size, uint8_t *hwaddr,
OpenPOWER on IntegriCloud