[Dnsmasq-discuss] Problem with dhcp relay function

André Valentin avalentin at marcant.net
Fri Oct 28 09:53:36 BST 2016


Hi !

I had a problem using the dhcp relay in dnsmasq. If a reply comes in from the upstream DHCP Server,
it has always been sent back on the receiving interface. Correct is the interface with the
corresponding network/ip configuration.

This patch helped:
diff --git a/src/dhcp.c b/src/dhcp.c
index fb2f650..9b4e9bc 100644
--- a/src/dhcp.c
+++ b/src/dhcp.c
@@ -417,6 +417,11 @@ void dhcp_packet(time_t now, int pxe_fd)
           if (ioctl(daemon->dhcpfd, SIOCSARP, &arp_req) == -1)
             my_syslog(MS_DHCP | LOG_ERR, _("ARP-cache injection failed: %s"), strerror(errno));
         }
+       /* This is a reply that is to be relayed, unset target interface
+       to enforce routing. */
+       if (is_relay_reply) {
+               pkt->ipi_ifindex = 0;
+       }
     }
 #elif defined(HAVE_SOLARIS_NETWORK)
   else if ((ntohs(mess->flags) & 0x8000) || mess->hlen != ETHER_ADDR_LEN || mess->htype != ARPHRD_ETHER)

Please take a look if I solved it right. If needed, I can resend the patch with git send-email.

Kind regards,

André


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3691 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20161028/28bde53f/attachment.bin>


More information about the Dnsmasq-discuss mailing list