Learn the ARP entry of the DHCP server directly from the DHCP response
[project/relayd.git] / main.c
diff --git a/main.c b/main.c
index f0630ae..a29be2c 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);