Learn the ARP entry of the DHCP server directly from the DHCP response
authorFelix Fietkau <nbd@openwrt.org>
Wed, 11 Aug 2010 02:12:17 +0000 (04:12 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 11 Aug 2010 02:12:17 +0000 (04:12 +0200)
main.c

diff --git a/main.c b/main.c
index f0630aef0709e943cafacb4ba4ca66342427b770..a29be2c1e733830c787e7680ac3faeba2e25eb4f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -536,6 +536,9 @@ static bool forward_dhcp_packet(struct relayd_interface *rif, void *data, int le
        if (!forward_dhcp)
                return true;
 
+       if (dhcp->op == 2)
+               refresh_host(rif, pkt->eth.ether_shost, (void *) &pkt->iph.saddr);
+
        DPRINTF(2, "%s: handling DHCP %s\n", rif->ifname, (dhcp->op == 1 ? "request" : "response"));
 
        dhcp->flags |= htons(DHCP_FLAG_BROADCAST);