diff options
| author | Roy Marples <roy@marples.name> | 2020-02-06 12:50:31 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-02-06 13:03:01 +0000 |
| commit | 791fbfc05b58f888522e207582155cad02b3eedb (patch) | |
| tree | 69beaac3fdb44b114915fb1f7c07cab3f1cef979 | |
| parent | 1c9a59bca4b99e4523c179a75b0b9d67173c518e (diff) | |
| download | dhcpcd-791fbfc05b58f888522e207582155cad02b3eedb.tar.xz | |
eloop: define eloop queue numbers in common.h
Allows for easier maintainance.
| -rw-r--r-- | src/arp.c | 2 | ||||
| -rw-r--r-- | src/common.h | 10 | ||||
| -rw-r--r-- | src/dhcp.c | 2 | ||||
| -rw-r--r-- | src/dhcp6.c | 2 | ||||
| -rw-r--r-- | src/dhcpcd.c | 2 | ||||
| -rw-r--r-- | src/eloop.h | 3 | ||||
| -rw-r--r-- | src/ipv4ll.c | 2 | ||||
| -rw-r--r-- | src/ipv6.c | 9 | ||||
| -rw-r--r-- | src/ipv6nd.c | 2 |
9 files changed, 24 insertions, 10 deletions
@@ -41,7 +41,7 @@ #include <string.h> #include <unistd.h> -#define ELOOP_QUEUE 5 +#define ELOOP_QUEUE ELOOP_ARP #include "config.h" #include "arp.h" #include "bpf.h" diff --git a/src/common.h b/src/common.h index 4e8bcdea..b55483d0 100644 --- a/src/common.h +++ b/src/common.h @@ -34,6 +34,16 @@ #include <stdint.h> #include <stdio.h> +/* Define eloop queues here, as other apps share eloop.h */ +#define ELOOP_DHCPCD 1 /* default queue */ +#define ELOOP_DHCP 2 +#define ELOOP_ARP 3 +#define ELOOP_IPV4LL 4 +#define ELOOP_IPV6 5 +#define ELOOP_IPV6ND 6 +#define ELOOP_IPV6RA_EXPIRE 7 +#define ELOOP_DHCP6 8 + #ifndef HOSTNAME_MAX_LEN #define HOSTNAME_MAX_LEN 250 /* 255 - 3 (FQDN) - 2 (DNS enc) */ #endif @@ -57,7 +57,7 @@ #include <string.h> #include <unistd.h> -#define ELOOP_QUEUE 2 +#define ELOOP_QUEUE ELOOP_DHCP #include "config.h" #include "arp.h" #include "bpf.h" diff --git a/src/dhcp6.c b/src/dhcp6.c index df29ace7..d1adbbcc 100644 --- a/src/dhcp6.c +++ b/src/dhcp6.c @@ -45,7 +45,7 @@ #include <unistd.h> #include <fcntl.h> -#define ELOOP_QUEUE 4 +#define ELOOP_QUEUE ELOOP_DHCP6 #include "config.h" #include "common.h" #include "dhcp.h" diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 98e81218..7d55020b 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -435,7 +435,7 @@ stop_interface(struct interface *ifp) script_runreason(ifp, "STOPPED"); /* Delete all timeouts for the interfaces */ - eloop_q_timeout_delete(ctx->eloop, 0, NULL, ifp); + eloop_q_timeout_delete(ctx->eloop, ELOOP_QUEUE_ALL, NULL, ifp); /* De-activate the interface */ ifp->active = IF_INACTIVE; diff --git a/src/eloop.h b/src/eloop.h index 18cd06d7..0013043f 100644 --- a/src/eloop.h +++ b/src/eloop.h @@ -67,6 +67,9 @@ #define ELOOP_QUEUE 1 #endif +/* Used for deleting a timeout for all queues. */ +#define ELOOP_QUEUE_ALL 0 + /* Forward declare eloop - the content should be invisible to the outside */ struct eloop; diff --git a/src/ipv4ll.c b/src/ipv4ll.c index 42a6a784..eb1d6cb1 100644 --- a/src/ipv4ll.c +++ b/src/ipv4ll.c @@ -36,7 +36,7 @@ #include <string.h> #include <unistd.h> -#define ELOOP_QUEUE 6 +#define ELOOP_QUEUE IPV4LL #include "config.h" #include "arp.h" #include "common.h" @@ -59,7 +59,7 @@ #include <string.h> #include <unistd.h> -#define ELOOP_QUEUE 7 +#define ELOOP_QUEUE ELOOP_IPV6 #include "common.h" #include "if.h" #include "dhcpcd.h" @@ -932,7 +932,7 @@ ipv6_doaddr(struct ipv6_addr *ia, struct timespec *now) if (ia->flags & IPV6_AF_ADDED) ipv6_deleteaddr(ia); eloop_q_timeout_delete(ia->iface->ctx->eloop, - 0, NULL, ia); + ELOOP_QUEUE_ALL, NULL, ia); if (ia->flags & IPV6_AF_REQUEST) { ia->flags &= ~IPV6_AF_ADDED; return 0; @@ -974,6 +974,7 @@ ipv6_addaddrs(struct ipv6_addrhead *iaddrs) void ipv6_freeaddr(struct ipv6_addr *ia) { + struct eloop *eloop = ia->iface->ctx->eloop; #ifndef SMALL struct ipv6_addr *iad; @@ -989,10 +990,10 @@ ipv6_freeaddr(struct ipv6_addr *ia) if (ia->dhcp6_fd != -1) { close(ia->dhcp6_fd); - eloop_event_delete(ia->iface->ctx->eloop, ia->dhcp6_fd); + eloop_event_delete(eloop, ia->dhcp6_fd); } - eloop_q_timeout_delete(ia->iface->ctx->eloop, 0, NULL, ia); + eloop_q_timeout_delete(eloop, ELOOP_QUEUE_ALL, NULL, ia); free(ia->na); free(ia); } diff --git a/src/ipv6nd.c b/src/ipv6nd.c index 55f8c993..90fdecf4 100644 --- a/src/ipv6nd.c +++ b/src/ipv6nd.c @@ -43,7 +43,7 @@ #include <string.h> #include <unistd.h> -#define ELOOP_QUEUE 3 +#define ELOOP_QUEUE ELOOP_IPV6ND #include "common.h" #include "dhcpcd.h" #include "dhcp-common.h" |
