Sockets would be opened with PF_*, not AF_*.

This commit is contained in:
Roy Marples 2014-05-20 08:54:00 +00:00
parent f31c6094c5
commit d8cb89586b
4 changed files with 16 additions and 16 deletions

View File

@ -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));

View File

@ -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));

10
if.c
View File

@ -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));

View File

@ -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)