From d8cb89586bb3eb504a0ba71177731e1f4aeb538b Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 20 May 2014 08:54:00 +0000 Subject: [PATCH] Sockets would be opened with PF_*, not AF_*. --- if-bsd.c | 16 ++++++++-------- if-linux-wireless.c | 2 +- if.c | 10 +++++----- ipv6nd.c | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/if-bsd.c b/if-bsd.c index 34130554..c4892c8b 100644 --- a/if-bsd.c +++ b/if-bsd.c @@ -149,7 +149,7 @@ if_getssid(const char *ifname, char *ssid) char nwid[IEEE80211_NWID_LEN + 1]; #endif - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; #if defined(SIOCG80211NWID) /* NetBSD */ @@ -197,7 +197,7 @@ if_vimaster(const char *ifname) int s, r; struct ifmediareq ifmr; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; memset(&ifmr, 0, sizeof(ifmr)); strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name)); @@ -397,7 +397,7 @@ if_address(const struct interface *iface, const struct in_addr *address, struct sockaddr_in *sin; } _s; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; memset(&ifa, 0, sizeof(ifa)); @@ -543,7 +543,7 @@ if_address6(const struct ipv6_addr *a, int action) struct in6_aliasreq ifa; struct in6_addr mask; - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) return -1; memset(&ifa, 0, sizeof(ifa)); @@ -738,7 +738,7 @@ if_addrflags6(const char *ifname, const struct in6_addr *addr) int s, flags; struct in6_ifreq ifr6; - s = socket(AF_INET6, SOCK_DGRAM, 0); + s = socket(PF_INET6, SOCK_DGRAM, 0); flags = -1; if (s != -1) { memset(&ifr6, 0, sizeof(ifr6)); @@ -962,7 +962,7 @@ if_nd6_flag(const char *ifname, unsigned int flag, int set) struct in6_ndireq nd; unsigned int oflags; - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET6, SOCK_DGRAM, 0)) == -1) return -1; memset(&nd, 0, sizeof(nd)); strlcpy(nd.ifname, ifname, sizeof(nd.ifname)); @@ -994,7 +994,7 @@ if_nd6reachable(const char *ifname, struct in6_addr *addr) int s, flags; struct in6_nbrinfo nbi; - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) + if ((s = socket(PF_INET6, SOCK_DGRAM, 0)) < 0) return -1; memset(&nbi, 0, sizeof(nbi)); @@ -1063,7 +1063,7 @@ if_raflush(void) int s; char dummy[IFNAMSIZ + 8]; - s = socket(AF_INET6, SOCK_DGRAM, 0); + s = socket(PF_INET6, SOCK_DGRAM, 0); if (s == -1) return -1; strlcpy(dummy, "lo0", sizeof(dummy)); diff --git a/if-linux-wireless.c b/if-linux-wireless.c index 9733517d..028b682a 100644 --- a/if-linux-wireless.c +++ b/if-linux-wireless.c @@ -69,7 +69,7 @@ if_getssid(const char *ifname, char *ssid) int s, retval; struct iwreq iwr; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; memset(&iwr, 0, sizeof(iwr)); strlcpy(iwr.ifr_name, ifname, sizeof(iwr.ifr_name)); diff --git a/if.c b/if.c index ef6d0503..add301ea 100644 --- a/if.c +++ b/if.c @@ -102,7 +102,7 @@ if_carrier(struct interface *iface) char *p; #endif - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return LINK_UNKNOWN; memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); @@ -141,7 +141,7 @@ up_interface(struct interface *iface) char *p; #endif - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, iface->name, sizeof(ifr.ifr_name)); @@ -198,11 +198,11 @@ if_discover(struct dhcpcd_ctx *ctx, int argc, char * const *argv) #endif #ifdef SIOCGIFPRIORITY - if ((s_inet = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s_inet = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return NULL; #endif #ifdef IFLR_ACTIVE - if ((s_link = socket(AF_LINK, SOCK_DGRAM, 0)) == -1) { + if ((s_link = socket(PF_LINK, SOCK_DGRAM, 0)) == -1) { #ifdef SIOCGIFPRIORITY close(s_inet); #endif @@ -502,7 +502,7 @@ if_domtu(const char *ifname, short int mtu) int s, r; struct ifreq ifr; - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + if ((s = socket(PF_INET, SOCK_DGRAM, 0)) == -1) return -1; memset(&ifr, 0, sizeof(ifr)); strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); diff --git a/ipv6nd.c b/ipv6nd.c index 9977fd06..362fe4f7 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -172,12 +172,12 @@ ipv6nd_open(struct dhcpcd_ctx *dctx) if (ctx->nd_fd != -1) return ctx->nd_fd; #ifdef SOCK_CLOEXEC - ctx->nd_fd = socket(AF_INET6, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, + ctx->nd_fd = socket(PF_INET6, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, IPPROTO_ICMPV6); if (ctx->nd_fd == -1) return -1; #else - if ((ctx->nd_fd = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1) + if ((ctx->nd_fd = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1) return -1; if ((on = fcntl(ctx->nd_fd, F_GETFD, 0)) == -1 || fcntl(ctx->nd_fd, F_SETFD, on | FD_CLOEXEC) == -1)