int sockfd;
};
-#define MAX_IP_CHAR 128
-#define MAX_PREFIX_CHAR 4
-#define MAX_MAC_CHAR 18
+#define IPADDR_CHAR_MAX 128
+#define PREFIX_CHAR_MAX 4
-struct _ip {
- char ip_addr[MAX_IP_CHAR];
- char prefix[MAX_PREFIX_CHAR];
+struct nozzle_ip {
+ char ip_addr[IPADDR_CHAR_MAX];
+ char prefix[PREFIX_CHAR_MAX];
int domain;
- struct _ip *next;
+ struct nozzle_ip *next;
};
+#define MACADDR_CHAR_MAX 18
+
struct nozzle_iface {
struct ifreq ifr;
int fd;
char nozzlename[IFNAMSIZ];
- char default_mac[MAX_MAC_CHAR];
+ char default_mac[MACADDR_CHAR_MAX];
int default_mtu;
int current_mtu;
char updownpath[PATH_MAX - 11 - 1 - IFNAMSIZ]; /* 11 = post-down.d 1 = / */
int hasupdown;
int up;
- struct _ip *ip;
+ struct nozzle_ip *ip;
struct nozzle_iface *next;
};
#define ifname ifr.ifr_name
char **error_string, int secondary);
static int _find_ip(nozzle_t nozzle,
const char *ip_addr, const char *prefix,
- struct _ip **ip, struct _ip **ip_prev);
+ struct nozzle_ip **ip, struct nozzle_ip **ip_prev);
static int _read_pipe(int fd, char **file, size_t *length)
{
static int _get_mac(const nozzle_t nozzle, char **ether_addr)
{
int err = 0, savederrno = 0;
- char mac[MAX_MAC_CHAR];
+ char mac[MACADDR_CHAR_MAX];
#ifdef KNET_BSD
struct ifaddrs *ifap = NULL;
struct ifaddrs *ifa;
int found = 0;
#endif
- memset(&mac, 0, MAX_MAC_CHAR);
+ memset(&mac, 0, MACADDR_CHAR_MAX);
memset(&nozzle->ifr, 0, sizeof(struct ifreq));
strncpy(nozzle->ifname, nozzle->nozzlename, IFNAMSIZ);
int err = 0, savederrno = 0;
nozzle_t temp = lib_cfg.head;
nozzle_t prev = lib_cfg.head;
- struct _ip *ip, *ip_next;
+ struct nozzle_ip *ip, *ip_next;
char *error_string = NULL;
savederrno = pthread_mutex_lock(&lib_mutex);
int nozzle_set_mtu(nozzle_t nozzle, const int mtu, char **error_string)
{
int err = 0, savederrno = 0;
- struct _ip *tmp_ip;
+ struct nozzle_ip *tmp_ip;
if ((!nozzle) || (!mtu) || (!error_string)) {
errno = EINVAL;
static int _find_ip(nozzle_t nozzle,
const char *ip_addr, const char *prefix,
- struct _ip **ip, struct _ip **ip_prev)
+ struct nozzle_ip **ip, struct nozzle_ip **ip_prev)
{
- struct _ip *local_ip, *local_ip_prev;
+ struct nozzle_ip *local_ip, *local_ip_prev;
int found = 0;
local_ip = local_ip_prev = nozzle->ip;
{
int err = 0, savederrno = 0;
int found = 0;
- struct _ip *ip = NULL, *ip_prev = NULL, *ip_last = NULL;
+ struct nozzle_ip *ip = NULL, *ip_prev = NULL, *ip_last = NULL;
int secondary = 0;
if ((!nozzle) || (!ip_addr) || (!prefix) || (!error_string)) {
goto out_clean;
}
- ip = malloc(sizeof(struct _ip));
+ ip = malloc(sizeof(struct nozzle_ip));
if (!ip) {
savederrno = errno;
err = -1 ;
goto out_clean;
}
- memset(ip, 0, sizeof(struct _ip));
- strncpy(ip->ip_addr, ip_addr, MAX_IP_CHAR);
- strncpy(ip->prefix, prefix, MAX_PREFIX_CHAR);
+ memset(ip, 0, sizeof(struct nozzle_ip));
+ strncpy(ip->ip_addr, ip_addr, IPADDR_CHAR_MAX);
+ strncpy(ip->prefix, prefix, PREFIX_CHAR_MAX);
if (!strchr(ip->ip_addr, ':')) {
ip->domain = AF_INET;
} else {
{
int err = 0, savederrno = 0;
int found = 0;
- struct _ip *ip = NULL, *ip_prev = NULL;
+ struct nozzle_ip *ip = NULL, *ip_prev = NULL;
if ((!nozzle) || (!ip_addr) || (!prefix) || (!error_string)) {
errno = EINVAL;
int found = 0;
char *ip_list = NULL;
int size = 0, offset = 0, len;
- struct _ip *ip = NULL;
+ struct nozzle_ip *ip = NULL;
if ((!nozzle) || (!ip_addr_list) || (!entries)) {
errno = EINVAL;
goto out_clean;
}
- size = found * (MAX_IP_CHAR + MAX_PREFIX_CHAR + 2);
+ size = found * (IPADDR_CHAR_MAX + PREFIX_CHAR_MAX + 2);
ip_list = malloc(size);
if (!ip_list) {