Modify

Opened 8 years ago

Last modified 3 years ago

#6435 reopened defect

udhcpc classless routes handle fix

Reported by: anonymous Owned by: jow
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version:
Keywords: udhcpc, routes Cc:

Description

Current udhcpc default.script doesn't handle classless routes since udhcpc set env var with different name and format. Also udhcpc doesn't handle "ms classless routes" which used by some ISPs instead and have same format but option number 249.

Attachments (4)

909-udhcpc_msclasslessroutes_support.patch (775 bytes) - added by anonymous 8 years ago.
default.script.patch (3.3 KB) - added by anonymous 8 years ago.
classless routes handling
configurable_dhcp_request.patch (1.4 KB) - added by anonymous 8 years ago.
udhcpc_script_prevent_staticroutes_to_myself.patch (694 bytes) - added by devel@… 6 years ago.
Skip routes via the router itself (otherwise the router can't communicate into its LAN)

Download all attachments as: .zip

Change History (33)

Changed 8 years ago by anonymous

comment:1 Changed 8 years ago by anonymous

Also, there seems no way to set which dhcp options udhcpc will request from server (-O) ?
It would be nice to be able to configure this.

Changed 8 years ago by anonymous

classless routes handling

Changed 8 years ago by anonymous

comment:2 Changed 8 years ago by anonymous

option "request" configure which dhcp options udhcpc should request with -O

config interface wan
	option ifname	eth1
	option proto	dhcp
	option request	'staticroutes msstaticroutes'

comment:3 Changed 7 years ago by jow

  • Owner changed from developers to jow
  • Status changed from new to accepted

comment:4 Changed 7 years ago by jow

Default script changed in r24778

comment:5 Changed 7 years ago by jow

Patch ported in r24779

comment:6 Changed 7 years ago by jow

Reqopts introduced in r24780

comment:7 Changed 7 years ago by jow

  • Resolution set to fixed
  • Status changed from accepted to closed

comment:8 Changed 7 years ago by Dmitry Tunin <hanipouspilot@…>

This patch does not seem to work. No routes got on Beeline. They are option 249.

comment:9 Changed 7 years ago by jow

did you add "option request 'staticroutes'" to your wan interface?

comment:10 Changed 7 years ago by Dmitry Tunin <hanipouspilot@…>

Yes, that's what I did.
I added request 'staticroutes msstaticroutes'
Restarted and got no routes.
Provider Beeline gives routes in both ways. But I get none.

comment:11 Changed 7 years ago by jow

Whats your OpenWrt version?

comment:12 Changed 7 years ago by Dmitry Tunin <hanipouspilot@…>

Backfire r26039

comment:13 Changed 7 years ago by Dmitry Tunin <hanipouspilot@…>

I tried all 3 ways. Both and either one options. No routes.

comment:14 Changed 7 years ago by Mario

Dmitry, use reqopts option instead request, because in package/base-files/files/lib/network/config.sh used

config_get reqopts "$config" reqopts

unlike described above.

comment:15 Changed 7 years ago by Dmitry Tunin <hanipouspilot@…>

Mario, thx.
This way it works partially. I get only ordinare, not ms (249) routes.

comment:16 Changed 7 years ago by anonymous

Use

option reqopts 'staticroutes msstaticroutes'

comment:17 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

  • Resolution fixed deleted
  • Status changed from closed to reopened

It does not help. Msstaticroutes does not work.

comment:19 Changed 6 years ago by jow

It works as expected here.

Server:

root@uplink:~# cat /etc/dnsmasq.conf 
dhcp-option=121,10.20.20.0/24,10.11.12.13,10.30.30.1/32,10.11.12.13
dhcp-option=249,10.50.50.0/24,10.11.12.13,10.60.60.1/32,10.11.12.13
root@uplink:~# 

Client:

root@OpenWrt:~# uci show network.wan
network.wan=interface
network.wan.ifname=eth1
network.wan.proto=dhcp
network.wan.reqopts=msstaticroutes staticroutes
root@OpenWrt:~# 
root@OpenWrt:~# udhcpc -i eth1 -O msstaticroutes -O staticroutes
udhcpc (v1.17.3) started
Sending discover...
Sending select for 10.11.12.37...
Lease of 10.11.12.37 obtained, lease time 43200
udhcpc: ifconfig eth1 10.11.12.37 netmask 255.255.255.0 broadcast 10.11.12.255
udhcpc: setting default routers: 10.11.12.13
udhcpc: adding route for net 10.20.20.0/24 via 10.11.12.13
udhcpc: adding route for host 10.30.30.1/32 via 10.11.12.13
udhcpc: adding route for net 10.50.50.0/24 via 10.11.12.13
udhcpc: adding route for host 10.60.60.1/32 via 10.11.12.13
udhcpc: setting dns servers: 10.11.12.13
udhcpc: setting dns domain: lan
root@OpenWrt:~#
root@OpenWrt:~# ifdown wan
root@OpenWrt:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br-lan
172.16.16.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan2
root@OpenWrt:~# ifup wan
root@OpenWrt:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.60.60.1      10.11.12.13     255.255.255.255 UGH   0      0        0 eth1
10.30.30.1      10.11.12.13     255.255.255.255 UGH   0      0        0 eth1
10.11.12.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 wlan0
10.20.20.0      10.11.12.13     255.255.255.0   UG    0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 br-lan
172.16.16.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan2
10.50.50.0      10.11.12.13     255.255.255.0   UG    0      0        0 eth1
0.0.0.0         10.11.12.13     0.0.0.0         UG    0      0        0 eth1
root@OpenWrt:~# 

So please provide some details, maybe even a packet capture of the DHCP response. It is possible that you receive routes that depend on each other so they must be added in a certain order etc.

comment:20 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

root@OpenWrt:~# uci show network.wan
network.wan=interface
network.wan.ifname=eth0.2
network.wan.proto=dhcp
network.wan.reqopts=msstaticroutes staticroutes
root@OpenWrt:~# udhcpc -i eth0.2 -O msstaticroutes -O staticroutes
udhcpc: unknown option 'msstaticroutes'
root@OpenWrt:~# ifup wan        route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 br-lan
10.83.48.0      *               255.255.248.0   U     0      0        0 eth0.2
default         10.83.48.1      0.0.0.0         UG    0      0        0 eth0.2
root@OpenWrt:~# ifdown wan
root@OpenWrt:~# ifup wan
root@OpenWrt:~# udhcpc (v1.15.3) started
Sending discover...
Sending select for 10.83.54.4...
Lease of 10.83.54.4 obtained, lease time 604800
udhcpc: ifconfig eth0.2 10.83.54.4 netmask 255.255.248.0 broadcast +
udhcpc: setting default routers: 10.83.48.1
udhcpc: setting dns servers: 85.21.192.3 213.234.192.8

See what happens? unknown option

comment:21 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

Now it is backfire r26383

comment:22 Changed 6 years ago by jow

  • Resolution set to worksforme
  • Status changed from reopened to closed

The patch simply was never merged to backfire and it works correctly in trunk for me so your reopening of this ticket is invalid. Next time please check whether the changes have been actually merged to the branch before reopening the ticket and state "it does not work".

comment:23 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

Sorry. My bad.
Maybe it nakes sense to merge?

comment:24 Changed 6 years ago by jow

Yes, I will look into merging it later.

comment:25 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

I built an image from trunk, but still no routes. Just FYI. I cannot test trunk for a long time. Critical packages for me do not work there.

comment:26 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

This was finally fixed in r27737

comment:27 Changed 6 years ago by Dmitry Tunin <hanipouspilot@…>

Typo r26737.

comment:28 Changed 6 years ago by Pilot6 <hanipouspilot@…>

Since the problem is fixed maybe it is time to merge this to Backfire?

Changed 6 years ago by devel@…

Skip routes via the router itself (otherwise the router can't communicate into its LAN)

comment:29 Changed 6 years ago by devel@…

  • Resolution worksforme deleted
  • Status changed from closed to reopened

The current implementation of set_classless_routes in default.script breaks the routing in my local setup. The attached patch attachment:udhcpc_script_prevent_staticroutes_to_myself.patch fixes this issue for me. Here is my setup ...

Consider four hosts:

A/B/C
three routers in front of different sub-nets (netA, netB, netC); their WAN interfaces are configured via DHCP (provided by G)
G
central router - delivering DHCP to A, B and C

I want to announce A, B and C as routers for their respective sub-nets via DHCP to the other routers. This reduces problems with ICMP redirect and simplifies routing in general (for me).

Here is the problem:

  • A adds all routes:
    • netA via A
    • netB via B
    • netC via C
  • the route to itself ("netA via A") competes with A's interface based route (something along "netA dev eth0")
  • result: the hosts in netA can't talk to A anymore, since A uses the new "netA via A" route (looping -> packets are lost)

The above patch skips the routes that point to the current router itself.

What do you think? Could this exception (never route to yourself) break specific setups? Or is there a more appropriate solution for my problem?

(I just re-opened the ticket - please revert if you disagree)

comment:30 Changed 3 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.