[Dnsmasq-discuss] DHCP Relay across VLANs

André Valentin avalentin at marcant.net
Fri Sep 15 10:21:08 BST 2017


Hello Ray,

I used the attached patch to fix the problem:
--- a/src/dhcp.c	2016-10-26 20:29:04.756059875 +0200
+++ b/src/dhcp.c	2016-10-26 20:27:57.793515090 +0200
@@ -420,6 +420,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)

I sent it to the mailinglist, but there was no interest in it. Please try and inform me.

Kind regards,

André


Am 15.09.2017 um 02:26 schrieb Ray Ramadorai:
> I recently was trying to transition from OpenWRT to LEDE and ran into a problem with DHCP relay not working correctly after the transition.  I have taken debug about as far as I can and am looking for some help going forward. 
> 
>  
> 
> Some details on network and configuration:
> 
>  
> 
> Network A (VLAN82) 192.168.42.0/24
> 
>                 Host: DHCP Server 192.168.42.4
> 
>                 Host: Relay 192.168.42.41 on interface (eth0.82)
> 
>  
> 
> Network B (VLAN85) 192.168.85.0/24
> 
>                 Host: DHCP Client MAC:  (00:0c:29:ed:03:a5)
> 
>                 Host: Relay 192.168.85.2 on interface (eth0.85)
> 
>  
> 
> dnsmasq.conf on the Relay host:
> 
>  
> 
> dhcp-authoritative
> 
> domain-needed
> 
> localise-queries
> 
> read-ethers
> 
> bogus-priv
> 
> expand-hosts
> 
> local-service
> 
> domain=lan
> 
> server=/lan/
> 
> dhcp-leasefile=/tmp/dhcp.leases
> 
> resolv-file=/tmp/resolv.conf.auto
> 
> stop-dns-rebind
> 
> rebind-localhost-ok
> 
> dhcp-broadcast=tag:needs-broadcast
> 
> addn-hosts=/tmp/hosts
> 
> conf-dir=/tmp/dnsmasq.d
> 
> user=dnsmasq
> 
> group=dnsmasq
> 
> dhcp-relay=192.168.85.2,192.168.42.4
> 
>  
> 
> The platform is a set of virtual machines running on x86 hardware. 
> 
>  
> 
> Software versions working case:
> 
> Kernel:  Linux Openwrt 3.18.23 #1 SMP Sun Jan 31 15:32:38 CET 2016 x86_64 GNU/Linux
> 
> DNSMasq:  Dnsmasq version 2.73  Copyright (c) 2000-2015 Simon Kelley
> 
> Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC loop-detect inotify
> 
>  
> 
> Software versions NOT working case:
> 
> Kernel:  Linux LEDE 4.4.71 #0 SMP Wed Jun 7 19:24:41 2017 x86_64 GNU/Linux
> 
> Dnsmasq version 2.77  Copyright (c) 2000-2016 Simon Kelley
> 
> Compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth no-DNSSEC no-ID loop-detect inotify
> 
>  
> 
> In the working case the normal 4 packet DHCP handshake occurs as expected and the relay passes the packets between the DHCP server and the client. 
> 
>  
> 
> In the failing case the client request packet gets from the client to the relay and then on to the dhcp server via the relay.  The response from the dhcp server makes it back to the relay, but then the corresponding packet from the relay to the client never gets sent.  Though I see the packet come back from the server it is not clear that DNSMasq sees the packet.  I can attach TCP dumps as needed.   Any help in further debug steps to determine if dnsmasq is not seeing the response from the DHCP server or is not sending the packet and why would be very helpful. 
> 
>  
> 
> I also came across this bug that looks similar but I am not sure has been reported upstream:
> 
>  
> 
> https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1686192
> 
>  
> 
>  
> 
> Thanks
> 
>  
> 
> Ray Ramadorai
> 
>  
> 
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 

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


More information about the Dnsmasq-discuss mailing list