diff options
| author | Roy Marples <roy@marples.name> | 2008-06-08 20:07:54 +0000 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2008-06-08 20:07:54 +0000 |
| commit | 5fb580a7713ca5bca9b7238a57977f1d739cdd46 (patch) | |
| tree | 1f10e990c22847a6f203107b2b90365ad9a91122 /net.h | |
| parent | 27e5226dc33c91862912b03c1f3d9162579dbcac (diff) | |
| download | dhcpcd-5fb580a7713ca5bca9b7238a57977f1d739cdd46.tar.xz | |
Re-write the client state engine around a simple timer instead of complex loops. Use the re-transmission times as per RFC 2131. Integrate the ARP handling code in the new engine so we are able to defend our IPV4LL address whilst negotiating a DHCP lease. This also means we're able to bind the address and fork BEFORE waiting to send announcements which makes us appear faster on the commandline.
Diffstat (limited to 'net.h')
| -rw-r--r-- | net.h | 25 |
1 files changed, 6 insertions, 19 deletions
@@ -107,17 +107,15 @@ struct interface int udp_fd; size_t buffer_size, buffer_len, buffer_pos; unsigned char *buffer; - -#ifdef __linux__ - int socket_protocol; +#ifdef ENABLE_ARP + int arp_fd; #endif - char leasefile[PATH_MAX]; - struct in_addr addr; struct in_addr net; struct rt *routes; + char leasefile[PATH_MAX]; time_t start_uptime; unsigned char *clientid; @@ -158,6 +156,7 @@ int if_route(const char *, const struct in_addr *, const struct in_addr *, void free_routes(struct rt *); int open_udp_socket(struct interface *); +const size_t udp_dhcp_len; ssize_t make_udp_packet(uint8_t **, const uint8_t *, size_t, struct in_addr, struct in_addr); ssize_t get_udp_data(const uint8_t **, const uint8_t *); @@ -168,21 +167,9 @@ ssize_t send_packet(const struct interface *, struct in_addr, const uint8_t *, ssize_t); ssize_t send_raw_packet(const struct interface *, int, const void *, ssize_t); -ssize_t get_packet(struct interface *, void *, ssize_t); +ssize_t get_raw_packet(struct interface *, int, void *, ssize_t); #ifdef ENABLE_ARP -/* These are really for IPV4LL, RFC 3927. - * We multiply some numbers by 1000 so they are suitable for use in poll(). */ -#define PROBE_WAIT 1 * 1000 -#define PROBE_NUM 3 -#define PROBE_MIN 1 * 1000 -#define PROBE_MAX 2 * 1000 -#define ANNOUNCE_WAIT 2 * 1000 -#define ANNOUNCE_NUM 2 -#define ANNOUNCE_INTERVAL 2 * 1000 -#define MAX_CONFLICTS 10 -#define RATE_LIMIT_INTERVAL 60 -#define DEFEND_INTERVAL 10 -int arp_claim(struct interface *, struct in_addr); +int send_arp(const struct interface *, int, in_addr_t, in_addr_t); #endif #endif |
