Hi everyone,

We are using both dnsmasq and isc dhcrelay as dhcp-relays for dhcpv6
only.

we launch dnsmasq like this:

        dnsmasq -d \
        --conf-file=/dev/null \
        --dhcp-relay fd12:3456::b6e3:f9ff:fea5:fa5b,2020:abcd::1 \
        --except-interface=lo \
        --interface=tun0,eno2 \
        --port 0

and isc dhcrelay like this:

        dhcrelay -d -6 -l tun0 -u 2020:abcd::1%eno2 --no-pid

tun0 address is fd12:3456::b6e3:f9ff:fea5:fa5b.
eno2 address is 2020:abcd::2.

With dnsmasq the source address of the relay-forward packets is the
address of tun0.
With dhcrelay the source address of the relay-forward packets is the
address of eno2.

We don't really understand why it so on dnsmasq (or dhcrelay for that
matter), could someone explain it to us ? RFC 3315 section 20. Relay
Agent Behavior says nothing about the source address.

In our use case it makes more sense that the source address of the
relay-forward packet is the address of eno2 since it's the outbound
interface (and the one that will receive the replies).

Nevertheless the attached patch fixes this issue as it sets the source
address of relay-forward packets to be the address of the "upper"
interface.

We've also attached two filtered pcap files of a wireshark capture
showing the difference before and after the patch on the machine
hosting the dhcp server and the machine hosting the dhcp_relay.

Regards,
-- 
Luis Thomas



From 87859636e9c584b9b25c4d76d50242cebb129514 Mon Sep 17 00:00:00 2001
From: Luis Thomas <luis.tho...@silabs.com>
Date: Thu, 1 Sep 2022 17:22:48 +0200
Subject: [PATCH] fix the source address of dhcpv6 relay-forward packets

---
 src/rfc3315.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rfc3315.c b/src/rfc3315.c
index 866b8b8..92164fb 100644
--- a/src/rfc3315.c
+++ b/src/rfc3315.c
@@ -2217,7 +2217,7 @@ int relay_upstream6(int iface_index, ssize_t sz,
 	  dump_packet(DUMP_DHCPV6, (void *)daemon->outpacket.iov_base, save_counter(-1), &fromsock, &to, 0);
 	}
 #endif
-	send_from(daemon->dhcp6fd, 0, daemon->outpacket.iov_base, save_counter(-1), &to, &from, 0);
+	send_from(daemon->dhcp6fd, 1, daemon->outpacket.iov_base, save_counter(-1), &to, &from, 0);
 	
 	if (option_bool(OPT_LOG_OPTS))
 	  {
-- 
2.37.2

Attachment: dhcp_relay_filter_icmpv6_or_dhcpv6.pcapng
Description: dhcp_relay_filter_icmpv6_or_dhcpv6.pcapng

Attachment: dhcp_server_filter_icmpv6_or_dhcpv6.pcap
Description: dhcp_server_filter_icmpv6_or_dhcpv6.pcap

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to