summaryrefslogtreecommitdiff
path: root/devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'devices.c')
-rw-r--r--devices.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/devices.c b/devices.c
index b7c1254..1c69710 100644
--- a/devices.c
+++ b/devices.c
@@ -30,6 +30,7 @@
int getDeviceIndex(int sockfd, unsigned char *deviceName) {
struct ifreq ifr;
+ /* Find interface index from deviceName */
strncpy(ifr.ifr_name, deviceName, 16);
if (ioctl(sockfd, SIOCGIFINDEX, &ifr) != 0) {
return -1;
@@ -42,6 +43,7 @@ int getDeviceIndex(int sockfd, unsigned char *deviceName) {
int getDeviceMAC(const int sockfd, const unsigned char *deviceName, unsigned char *mac) {
struct ifreq ifr;
+ /* Find interface hardware address from deviceName */
strncpy(ifr.ifr_name, deviceName, 16);
if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) != 0) {
return -1;
@@ -75,6 +77,7 @@ int getDeviceIp(const int sockfd, const unsigned char *deviceName, struct sockad
exit(1);
}
+ /* Do the actual query for info about all interfaces */
ifc.ifc_req = ifr;
if (ioctl(sockfd, SIOCGIFCONF, &ifc) != 0) {
free(ifr);