From 86ef08483513bfaa6cc33700e7a215f0e72beaa5 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Sun, 14 Nov 2010 00:41:32 -0500 Subject: [PATCH] Clean up parameter names and comment read_interface(). --- ndhc/socket.c | 9 +++++---- ndhc/socket.h | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ndhc/socket.c b/ndhc/socket.c index 49a6be4..2018c89 100644 --- a/ndhc/socket.c +++ b/ndhc/socket.c @@ -38,8 +38,9 @@ #include "strl.h" #include "dhcpd.h" /* For SERVER_PORT and CLIENT_PORT */ -int read_interface(char *interface, int *ifindex, uint32_t *addr, - unsigned char *arp) +/* Given an interface name in @interface, return its index number, + * IPv4 address, and MAC in @ifindex, @addr (optional), and @mac.*/ +int read_interface(char *interface, int *ifindex, uint32_t *addr, uint8_t *mac) { int fd, ret = -1; struct ifreq ifr; @@ -78,9 +79,9 @@ int read_interface(char *interface, int *ifindex, uint32_t *addr, goto out_fd; } - memcpy(arp, ifr.ifr_hwaddr.sa_data, 6); + memcpy(mac, ifr.ifr_hwaddr.sa_data, 6); log_line("adapter hardware address %02x:%02x:%02x:%02x:%02x:%02x", - arp[0], arp[1], arp[2], arp[3], arp[4], arp[5]); + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ret = 0; out_fd: close(fd); diff --git a/ndhc/socket.h b/ndhc/socket.h index e8090d6..db0b50b 100644 --- a/ndhc/socket.h +++ b/ndhc/socket.h @@ -2,7 +2,8 @@ #ifndef SOCKET_H_ #define SOCKET_H_ -int read_interface(char *interface, int *ifindex, uint32_t *addr, unsigned char *arp); +int read_interface(char *interface, int *ifindex, uint32_t *addr, + uint8_t *mac); int listen_socket(unsigned int ip, int port, char *inf); int raw_socket(int ifindex);