diff --git a/ifchd/ifchd.c b/ifchd/ifchd.c index 6291d4c..447a5e0 100644 --- a/ifchd/ifchd.c +++ b/ifchd/ifchd.c @@ -527,7 +527,7 @@ static int get_listen(void) .sun_path = "/var/state/ifchange" }; - lsock = socket(PF_UNIX, SOCK_STREAM, 0); + lsock = socket(AF_UNIX, SOCK_STREAM, 0); if (lsock == -1) suicide("dispatch_work - failed to create socket"); diff --git a/ifchd/linux.c b/ifchd/linux.c index 55995be..9a77d95 100644 --- a/ifchd/linux.c +++ b/ifchd/linux.c @@ -132,7 +132,7 @@ static int set_if_flag(int idx, short flag) if (!is_permitted(ifnam[idx])) goto out0; - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (set_if_flag) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); @@ -184,7 +184,7 @@ void perform_ip(int idx, char *str) sin.sin_addr = ipaddr; memcpy(&ifrt.ifr_addr, &sin, sizeof(struct sockaddr)); - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (perform_ip) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); @@ -217,7 +217,7 @@ void perform_subnet(int idx, char *str) sin.sin_addr = subnet; memcpy(&ifrt.ifr_addr, &sin, sizeof(struct sockaddr)); - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (perform_ip) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); @@ -264,7 +264,7 @@ void perform_router(int idx, char *str) rt.rt_dev = ifnam[idx]; rt.rt_metric = 1; - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (perform_router) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); @@ -293,7 +293,7 @@ void perform_mtu(int idx, char *str) ifrt.ifr_mtu = mtu; strlcpy(ifrt.ifr_name, ifnam[idx], IFNAMSIZ); - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (perform_mtu) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); @@ -325,7 +325,7 @@ void perform_broadcast(int idx, char *str) sin.sin_addr = broadcast; memcpy(&ifrt.ifr_addr, &sin, sizeof(struct sockaddr)); - fd = socket(PF_INET, SOCK_DGRAM, 0); + fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { log_line("%s: (perform_broadcast) failed to open interface socket: %s\n", ifnam[idx], strerror(errno)); return; diff --git a/ndhc/arp.c b/ndhc/arp.c index 505effa..ea22ba6 100644 --- a/ndhc/arp.c +++ b/ndhc/arp.c @@ -69,7 +69,7 @@ static int arpping(struct client_state_t *cs, uint32_t test_ip, struct arpMsg arp; if (cs->arpFd == -1) { - int arpfd = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)); + int arpfd = socket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ARP)); if (arpfd == -1) { log_error("arp: failed to create socket: %s", strerror(errno)); return -1; diff --git a/ndhc/netlink.c b/ndhc/netlink.c index b563ce3..694b7ee 100644 --- a/ndhc/netlink.c +++ b/ndhc/netlink.c @@ -64,7 +64,7 @@ int nl_open(struct client_state_t *cs) assert(cs->nlFd == -1); - cs->nlFd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); + cs->nlFd = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE); if (cs->nlFd == -1) return -1; diff --git a/ndhc/packet.c b/ndhc/packet.c index 1417cf3..51b740a 100644 --- a/ndhc/packet.c +++ b/ndhc/packet.c @@ -56,7 +56,7 @@ static int create_udp_listen_socket(unsigned int ip, int port, char *inf) int opt = 1; log_line("Opening listen socket on 0x%08x:%d %s", ip, port, inf); - if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { + if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { log_error("create_udp_listen_socket: socket failed: %s", strerror(errno)); goto out; @@ -364,7 +364,7 @@ int kernel_packet(struct dhcpMessage *payload, uint32_t source_ip, int opt = 1, fd, result = -1; unsigned int padding; - if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) + if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) goto out; if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof opt) == -1)