From: Roy Marples Date: Wed, 16 Jul 2008 08:10:41 +0000 (+0000) Subject: fd -> raw_fd X-Git-Tag: v4.0.2~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4d4ee1358061ff620679a51b0d620ce4fa1326b;p=thirdparty%2Fdhcpcd.git fd -> raw_fd --- diff --git a/bpf.c b/bpf.c index e37b5073..f661fe9b 100644 --- a/bpf.c +++ b/bpf.c @@ -116,7 +116,7 @@ open_socket(struct interface *iface, int protocol) } else { pf.bf_insns = UNCONST(dhcp_bpf_filter); pf.bf_len = dhcp_bpf_filter_len; - fdp = &iface->fd; + fdp = &iface->raw_fd; } if (ioctl(fd, BIOCSETF, &pf) == -1) goto eexit; @@ -156,7 +156,7 @@ send_raw_packet(const struct interface *iface, int protocol, fd = iface->arp_fd; else #endif - fd = iface->fd; + fd = iface->raw_fd; return writev(fd, iov, 2); } @@ -176,7 +176,7 @@ get_raw_packet(struct interface *iface, int protocol, fd = iface->arp_fd; #endif } else - fd = iface->fd; + fd = iface->raw_fd; for (;;) { if (iface->buffer_len == 0) { diff --git a/client.c b/client.c index b3737cd8..404a6490 100644 --- a/client.c +++ b/client.c @@ -603,9 +603,9 @@ client_setup(struct if_state *state, const struct options *options) static int do_socket(struct if_state *state, int mode) { - if (state->interface->fd != -1) { - close(state->interface->fd); - state->interface->fd = -1; + if (state->interface->raw_fd != -1) { + close(state->interface->raw_fd); + state->interface->raw_fd = -1; } if (mode == SOCKET_CLOSED) { if (state->interface->udp_fd != -1) { @@ -721,8 +721,8 @@ wait_for_packet(struct if_state *state) logger(LOG_DEBUG, "waiting for infinity"); timeout = INFTIM; } else { - if (state->interface->fd != -1) { - fds[nfds].fd = state->interface->fd; + if (state->interface->raw_fd != -1) { + fds[nfds].fd = state->interface->raw_fd; fds[nfds].events = POLLIN; nfds++; } @@ -1607,7 +1607,7 @@ dhcp_run(const struct options *options, int *pid_fd) /* The interupt will be handled above */ retval = 0; } else if (retval > 0) { - if (fd_hasdata(state->interface->fd) == 1) + if (fd_hasdata(state->interface->raw_fd) == 1) retval = handle_dhcp_packet(state, options); #ifdef ENABLE_ARP else if (fd_hasdata(state->interface->arp_fd) == 1) { diff --git a/lpf.c b/lpf.c index daa8a4c6..98521871 100644 --- a/lpf.c +++ b/lpf.c @@ -112,7 +112,7 @@ open_socket(struct interface *iface, int protocol) fd = &iface->arp_fd; else #endif - fd = &iface->fd; + fd = &iface->raw_fd; if (*fd != -1) close(*fd); *fd = s; @@ -153,7 +153,7 @@ send_raw_packet(const struct interface *iface, int protocol, fd = iface->arp_fd; else #endif - fd = iface->fd; + fd = iface->raw_fd; return sendto(fd, data, len, 0, &su.sa, sizeof(su)); } @@ -169,7 +169,7 @@ get_raw_packet(struct interface *iface, int protocol, void *data, ssize_t len) fd = iface->arp_fd; #endif } else - fd = iface->fd; + fd = iface->raw_fd; bytes = read(fd, data, len); if (bytes == -1) return errno == EAGAIN ? 0 : -1; diff --git a/net.c b/net.c index c3e82264..c364d7fe 100644 --- a/net.c +++ b/net.c @@ -384,7 +384,7 @@ read_interface(const char *ifname, _unused int metric) iface->arpable = !(ifr.ifr_flags & (IFF_NOARP | IFF_LOOPBACK)); /* 0 is a valid fd, so init to -1 */ - iface->fd = -1; + iface->raw_fd = -1; iface->udp_fd = -1; #ifdef ENABLE_ARP iface->arp_fd = -1; diff --git a/net.h b/net.h index 04a3e6ef..12f13211 100644 --- a/net.h +++ b/net.h @@ -101,7 +101,7 @@ struct interface size_t hwlen; int arpable; - int fd; + int raw_fd; int udp_fd; size_t buffer_size, buffer_len, buffer_pos; unsigned char *buffer;