]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
fd -> raw_fd
authorRoy Marples <roy@marples.name>
Wed, 16 Jul 2008 08:10:41 +0000 (08:10 +0000)
committerRoy Marples <roy@marples.name>
Wed, 16 Jul 2008 08:10:41 +0000 (08:10 +0000)
bpf.c
client.c
lpf.c
net.c
net.h

diff --git a/bpf.c b/bpf.c
index e37b5073282aaf330fab24104a4d366e14ea51a7..f661fe9b44bc30d71a45e813bf87010683aafd8a 100644 (file)
--- 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) {
index b3737cd8257599ee64d320bd6c4987833554e0c0..404a64903a1cdad233fae0f768f788fd0ed38bcd 100644 (file)
--- 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 daa8a4c60ff886b9178769555cce97a03342384f..9852187169be9975e2d08b3a748ec55d9175e91c 100644 (file)
--- 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 c3e82264a389b3c9b440f8c208546ed47ed2164b..c364d7fe455756fb36d8a8bbab088195b3d96fc9 100644 (file)
--- 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 04a3e6ef7180f0dc785b8bffff469102e204da69..12f13211a1823a9a624659804e7072f46b9fb632 100644 (file)
--- 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;