rawnet - add functions to get mac and mtu, if known.

This commit is contained in:
Kelvin Sherlock 2018-12-18 19:21:20 -05:00
parent f550249382
commit 9370ed8604
4 changed files with 34 additions and 0 deletions

View File

@ -65,4 +65,8 @@ extern int rawnet_arch_enumadapter_close(void);
extern char *rawnet_arch_get_standard_interface(void);
extern int rawnet_arch_get_mtu(void);
extern int rawnet_arch_get_mac(uint8_t mac[6]);
#endif

View File

@ -268,3 +268,16 @@ int rawnet_arch_enumadapter_close(void) {
char *rawnet_arch_get_standard_interface(void) {
return lib_stralloc("vmnet");
}
int rawnet_arch_get_mtu(void) {
return interface ? interface_mtu : -1;
}
int rawnet_arch_get_mac(uint8_t mac[6]) {
if (interface) {
memcpy(mac, interface_mac, 6);
return 1;
}
return -1;
}

View File

@ -535,4 +535,12 @@ char *rawnet_arch_get_standard_interface(void)
return dev;
}
extern int rawnet_arch_get_mtu(void) {
return -1;
}
extern int rawnet_arch_get_mac(uint8_t mac[6]) {
return -1;
}
#endif /* #ifdef HAVE_RAWNET */

View File

@ -539,4 +539,13 @@ char *rawnet_arch_get_standard_interface(void)
return dev;
}
extern int rawnet_arch_get_mtu(void) {
return -1;
}
extern int rawnet_arch_get_mac(uint8_t mac[6]) {
return -1;
}
#endif /* #ifdef HAVE_RAWNET */