Opened 5 years ago
Closed 19 months ago
#387 closed (fixed)
DHCP forwarding not working on WDS AP
| Reported by: | ads@… | Owned by: | BrainSlayer |
|---|---|---|---|
| Keywords: | dhcpfwd dhcp forward | Cc: | rob.townley@…, chris.nighswonger@… |
Description
I have a setup with 2 FONs set as WDS AP with RC2 (haven't succeeded with RC5 yet). Only problem with RC2 is that DHCP requests are not forwarded correctly by the FONs to the actual DHCP server, even though in the setup I've setup the DHCP forwarding.
Some investigation points out that /tmp/dhcp-fwd/dhcp-fwd.conf contains the lines:
if br0 true false true if false true true
The latter makes that dhcpfwd fails at startup. Looking at the source, I have the impression this line is coming out of /router/services/services/dhcpforward.c where you can find:
66 fprintf (fp, "if %s true false true\n",
67 nvram_safe_get ("lan_ifname"));
68
69 char *wan_proto = nvram_safe_get ("wan_proto");
70 char *wan_ifname = nvram_safe_get ("wan_ifname");
... ...
92 if (getWET ())
93 {
94 //nothing
95 }
96 else if (strcmp (wan_proto, "dhcp") == 0
97 || strcmp (wan_proto, "static") == 0)
98 {
99 fprintf (fp, "if %s false true true\n", wan_ifname);
100 }
... ...
119 else
120 {
121 fprintf (fp, "if %s false true true\n", wan_ifname);
122 }
If you have no WAN interface this seems to be generating the incorrect line in the dhcpfwd config file and causing the forwarding to fail ...
This is my first attempt at looking at the source-code of DD-WRT, so 1) I could be wrong in the root-cause analysis and 2) it can take me some time to get a setup to fix and compile the fix on top of RC2 myself ...
Change History (6)
comment:1 Changed 5 years ago by BrainSlayer
- Resolution set to invalid
- Status changed from new to closed
comment:2 Changed 5 years ago by Misterke (ads@…
- Resolution invalid deleted
- Status changed from closed to reopened
Might well be that in theory you don't need a DHCP forwarder when bridging, but the practice shows that it doesn't work (at least in my setup) without the forwarder and does work when it is correctly running.
Also note that several of the tutorials (a.o. http://www.dd-wrt.com/wiki/index.php/WDS_Linked_router_network) and forum-posts hint to setting the DHCP forwarding.
My Setup:
internet ((|))
-----------[DLINK]-------[Non-FON AP]-+
|
| ((|)) ((|)) ((|))
+---[FON1]-+ +-[FON2] +-[FON3]-----[XBOX]
((|))
[RoamingClients]-+
FON1 is in WDS AP mode with FON2 in the WDS list.
FON2 is also in WDS AP mode with FON1 in the WDS list. With RC2 these immediately found contact. With RC5 on both, they were unable to send stuff to eachother. In the iwconfig output you could see the Rx invalid nwid value running up quickly. Anyhow, RC2 works fine on this point, so I went back to RC2.
FON3 is in client bridge mode. Typically it will connect to FON2 as the signal of the two others will be too low there for a stable connection.
All FONs have static IPs and also the DLINK router has a static address.
As long as a client is connected wirelessly to FON1 or the non-FON AP, they immediately get a DHCP address without problems, but connect them to FON2 and they don't receive a DHCP address. Giving them a fixed address, shows that the actual connection from the client over FON2 to FON1 and upto the internet is working fine.
Also the XBOX connected to FON3 over UTP is not getting a DHCP address when the DHCP forwarding is turned off. Note however that in client-bridge mode the dhcp-fwd.conf does not contain the empty 'if' line for the WAN and hence on FON3 just enabling DHCP forwarding allowed the XBOX to get a DHCP address.
So, although in theory you are 100% right and the DHCP-related packets should be nicely broadcasted back and forth between all the different parts that are bridged either through WDS or client-bridge here, the practice is that it doesn't work.
Yesterday I've made the change to the dhcp-fwd.conf files manually and restarted dhcpfwd on FON1 and FON2 and since then all clients are nicely getting a DHCP address.
Anyhow, even if it in theory shouldn't help, it would not hurt either to ensure a correct dhcp-fwd.conf file by just adding a test (assuming wan_ifname is actually empty and not for example a set of spaces in the WDS AP case):
96 else if (strcmp (wan_proto, "dhcp") == 0
97 || strcmp (wan_proto, "static") == 0)
98 {
*** if (*wan_ifname)
99 fprintf (fp, "if %s false true true\n", wan_ifname);
100 }
... ...
119 else
120 {
*** if (*wan_ifname)
121 fprintf (fp, "if %s false true true\n", wan_ifname);
122 }
You can of course just close this ticket again and I'll then forget about it and just do the change locally myself, but the change is so minimal and risk-less that it is hard to understand why you wouldn't add it just for robustness ...
Kind regards, Misterke
comment:3 Changed 4 years ago by rjt
- Cc rob.townley@… added
confirmed to still exist with the security patched version from this summer. There is not a dchp-fwd if entry for the secondary wlan.
comment:4 Changed 3 years ago by ku4dd
- Cc chris.nighswonger@… added
- severity set to thoughtliu
confirmed to exist in v24 -sp2 SVN revision: 13064
Still no dhcp-fwd.conf if entry for multiple wlans, bridges, etc.
comment:5 Changed 2 years ago by akaylaa
disable dhcp, and it works. dhcp will then be forwarded to the dhcp server.
comment:6 Changed 19 months ago by Sash
- Resolution set to fixed
- Status changed from reopened to closed

dhcp forwarder forwards dhcp from wan networks to lan. within the bridge dhcp server is simply not neccessary since all parts of the bridge are receiving the dhcp broadcasts. which means you can enable the dhcp forwarder on the first ap which has wan for sure. but you dont need to enable it on the following bridges since the single dhcp forwarder with wan access is enough
dhcp forwarding is required if you have a central single dhcp server for multiple ap's in different network segments. but within a bridge all network segments are identical