From 996983143e2487ca7a15beeadc335aba35eccfa5 Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Thu, 31 Mar 2011 15:05:05 -0400 Subject: [PATCH] Only query gateway hwaddr when binding a new lease. Don't bother when just renewing or rebinding a lease. --- ndhc/dhcpmsg.h | 3 +-- ndhc/ifchange.c | 10 +++++----- ndhc/ifchange.h | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ndhc/dhcpmsg.h b/ndhc/dhcpmsg.h index f3ce96b..7bacd7b 100644 --- a/ndhc/dhcpmsg.h +++ b/ndhc/dhcpmsg.h @@ -1,5 +1,5 @@ /* dhcpmsg.c - dhcp packet generation and sending functions - * Time-stamp: <2011-03-30 23:53:52 nk> + * Time-stamp: <2011-03-31 03:27:02 nk> * * (c) 2004-2011 Nicholas J. Kain * (c) 2001 Russ Dill @@ -44,7 +44,6 @@ uint32_t random_xid(void); int send_discover(uint32_t xid, uint32_t requested); int send_selecting(uint32_t xid, uint32_t server, uint32_t requested); int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr); -int send_renew(uint32_t xid, uint32_t server, uint32_t ciaddr); int send_decline(uint32_t xid, uint32_t server, uint32_t requested); int send_release(uint32_t server, uint32_t ciaddr); int get_raw_packet(struct dhcpMessage *payload, int fd); diff --git a/ndhc/ifchange.c b/ndhc/ifchange.c index edcfee2..ef002da 100644 --- a/ndhc/ifchange.c +++ b/ndhc/ifchange.c @@ -1,5 +1,5 @@ /* ifchange.c - functions to call the interface change daemon - * Time-stamp: <2011-03-31 01:57:46 nk> + * Time-stamp: <2011-03-31 03:44:58 nk> * * (c) 2004-2011 Nicholas J. Kain * @@ -197,7 +197,7 @@ static void send_cmd(int sockfd, struct dhcpMessage *packet, uint8_t code) sockwrite(sockfd, buf, strlen(buf)); } -static void bound_if(struct dhcpMessage *packet) +static void bound_if(struct dhcpMessage *packet, int mode) { int sockfd; char buf[256]; @@ -226,7 +226,7 @@ static void bound_if(struct dhcpMessage *packet) send_cmd(sockfd, packet, DHCP_WINS_SERVER); close(sockfd); - if (router_set == 1) { + if (mode == IFCHANGE_BOUND && router_set == 1) { if (arp_get_gw_hwaddr(&cs) == -1) { log_warning("arp_get_gw_hwaddr failed to make arp socket; setting gw mac=ff:ff:ff:ff:ff:ff"); memset(&cs.routerAddr, 0xff, 4); @@ -241,10 +241,10 @@ void ifchange(struct dhcpMessage *packet, int mode) deconfig_if(); break; case IFCHANGE_BOUND: - bound_if(packet); + bound_if(packet, mode); break; case IFCHANGE_RENEW: - bound_if(packet); + bound_if(packet, mode); break; case IFCHANGE_NAK: deconfig_if(); diff --git a/ndhc/ifchange.h b/ndhc/ifchange.h index d59d77b..0faaec5 100644 --- a/ndhc/ifchange.h +++ b/ndhc/ifchange.h @@ -1,5 +1,5 @@ /* ifchange.h - functions to call the interface change daemon - * Time-stamp: <2011-03-30 16:38:19 nk> + * Time-stamp: <2011-03-31 03:44:18 nk> * * (c) 2004-2011 Nicholas J. Kain *