Last active
September 15, 2017 06:23
-
-
Save pluser/8f78b08a9a76ed6606a4c8fed9ef11da to your computer and use it in GitHub Desktop.
dnsmasq has a bug that it sends DHCPOffer packet via wrong interface if it is dhcp relay mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/src/dhcp.c 2017-05-23 06:58:46.000000000 +0900 | |
+++ b/src/dhcp.c 2017-09-15 14:31:43.586293892 +0900 | |
@@ -399,7 +399,7 @@ | |
msg.msg_controllen = sizeof(control_u); | |
cmptr = CMSG_FIRSTHDR(&msg); | |
pkt = (struct in_pktinfo *)CMSG_DATA(cmptr); | |
- pkt->ipi_ifindex = rcvd_iface_index; | |
+ pkt->ipi_ifindex = is_relay_reply ? iface_index : rcvd_iface_index; | |
pkt->ipi_spec_dst.s_addr = 0; | |
msg.msg_controllen = cmptr->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo)); | |
cmptr->cmsg_level = IPPROTO_IP; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment