respond to arp requests to the local address
authorFelix Fietkau <nbd@openwrt.org>
Fri, 27 Aug 2010 19:09:36 +0000 (21:09 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 27 Aug 2010 19:09:36 +0000 (21:09 +0200)
main.c

diff --git a/main.c b/main.c
index 8fbbed2e44804e723cc31277b9a689b97651725d..c30526ef2cdd9963531f044ceaac09538d5f742d 100644 (file)
--- a/main.c
+++ b/main.c
@@ -345,6 +345,11 @@ static void recv_arp_request(struct relayd_interface *rif, struct arp_packet *pk
        if (!memcmp(pkt->arp.arp_spa, "\x00\x00\x00\x00", 4))
                return;
 
+       if (local_route_table && !memcmp(pkt->arp.arp_tpa, local_addr, sizeof(local_addr))) {
+               send_arp_reply(rif, local_addr, pkt->arp.arp_sha, pkt->arp.arp_spa);
+               return;
+       }
+
        relayd_refresh_host(rif, pkt->eth.ether_shost, pkt->arp.arp_spa);
 
        host = find_host_by_ipaddr(NULL, pkt->arp.arp_tpa);