diff options
author | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2012-07-19 19:12:54 +0000 |
---|---|---|
committer | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2012-07-19 19:12:54 +0000 |
commit | 166bb2f9e4ef5d126311b523326e2c1d17411b4a (patch) | |
tree | 4f0922a2f601d17185aaaddcf5734d22498b1ce4 | |
parent | 547e66b53a1992e87ea6ff8362f9c15daa95051d (diff) | |
download | upstream-166bb2f9e4ef5d126311b523326e2c1d17411b4a.tar.gz upstream-166bb2f9e4ef5d126311b523326e2c1d17411b4a.tar.bz2 upstream-166bb2f9e4ef5d126311b523326e2c1d17411b4a.zip |
[package] dnsmasq: Fix DHCP no address on interface warning (#10570)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32781 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | package/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/package/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch b/package/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch new file mode 100644 index 0000000000..d108a7d3bc --- /dev/null +++ b/package/dnsmasq/patches/100-fix-dhcp-no-address-warning.patch @@ -0,0 +1,49 @@ +--- a/src/dhcp.c ++++ b/src/dhcp.c +@@ -134,7 +134,7 @@ void dhcp_packet(time_t now, int pxe_fd) + struct iovec iov; + ssize_t sz; + int iface_index = 0, unicast_dest = 0, is_inform = 0; +- struct in_addr iface_addr; ++ struct in_addr iface_addr, *addrp = NULL; + struct iface_param parm; + #ifdef HAVE_LINUX_NETWORK + struct arpreq arp_req; +@@ -246,11 +246,9 @@ void dhcp_packet(time_t now, int pxe_fd) + + ifr.ifr_addr.sa_family = AF_INET; + if (ioctl(daemon->dhcpfd, SIOCGIFADDR, &ifr) != -1 ) +- iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr; +- else + { +- my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name); +- return; ++ addrp = &iface_addr; ++ iface_addr = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr; + } + + for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next) +@@ -272,7 +270,7 @@ void dhcp_packet(time_t now, int pxe_fd) + parm.current = NULL; + parm.ind = iface_index; + +- if (!iface_check(AF_INET, (struct all_addr *)&iface_addr, ifr.ifr_name)) ++ if (!iface_check(AF_INET, (struct all_addr *)addrp, ifr.ifr_name)) + { + /* If we failed to match the primary address of the interface, see if we've got a --listen-address + for a secondary */ +@@ -291,7 +289,13 @@ void dhcp_packet(time_t now, int pxe_fd) + there is more than one address on the interface in the same subnet */ + complete_context(match.addr, iface_index, match.netmask, match.broadcast, &parm); + } +- ++ ++ if (!addrp) ++ { ++ my_syslog(MS_DHCP | LOG_WARNING, _("DHCP packet received on %s which has no address"), ifr.ifr_name); ++ return; ++ } ++ + if (!iface_enumerate(AF_INET, &parm, complete_context)) + return; + |