openwrt / odhcpd

This repository is a mirror of https://git.openwrt.org/?p=project/odhcpd.git. Pull requests will be accepted which will be merged in odhcpd.git
GNU General Public License v2.0
160 stars 96 forks source link

ra_lifetime being ignored #133

Closed brianjmurrell closed 1 year ago

brianjmurrell commented 5 years ago

Implementing #119 with:

config dhcp 'lan'
        option interface 'lan'
        option dhcpv6 'disabled'
        option ra 'server'
        option ra_management '0'
        option ra_lifetime '1800'
        list dns 'fd31:aeb1:48df::2'
        option prefix_filter '2001:123:ab:123::/64'
        option ra_preference 'medium'

config dhcp 'lan1'
        option interface 'lan1'
        option dhcpv6 'disabled'
        option ra 'server'
        option ra_management '0'
        option ra_lifetime '1800'
        list dns 'fd31:aeb1:48df::2'
        option prefix_filter 'fc00:0:0:0:0:0:0:0/7'
        option ra_preference 'medium'

even with ra_lifetime specified (i.e. not expecting default) one of the prefixes is still advertising a lifetime of 0:

Soliciting ff02::2 (ff02::2) on pc_bridge...

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :           No
Mobile home agent         :           No
Router preference         :       medium
Neighbor discovery proxy  :           No
Router lifetime           :            0 (0x00000000) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Source link-layer address: 6C:B0:CE:F5:1E:4A
 MTU                      :         1280 bytes (valid)
 Prefix                   : fd31:aeb1:48df::/64
  On-link                 :          Yes
  Autonomous address conf.:          Yes
  Valid time              :     infinite (0xffffffff)
  Pref. time              :     infinite (0xffffffff)
 Route                    : fd31:aeb1:48df::/48
  Route preference        :       medium
  Route lifetime          :     infinite (0xffffffff)
 Recursive DNS server     : fd31:aeb1:48df::2
  DNS server lifetime     :         6000 (0x00001770) seconds
 from fe80::6eb0:ceff:fef5:1e4a

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :           No
Mobile home agent         :           No
Router preference         :       medium
Neighbor discovery proxy  :           No
Router lifetime           :         1800 (0x00000708) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Source link-layer address: 6C:B0:CE:F5:1E:4A
 MTU                      :         1280 bytes (valid)
 Prefix                   : 2001:123:ab:123::/64
  On-link                 :          Yes
  Autonomous address conf.:          Yes
  Valid time              :     infinite (0xffffffff)
  Pref. time              :     infinite (0xffffffff)
 Route                    : 2001:123:ab:123::/64
  Route preference        :       medium
  Route lifetime          :     infinite (0xffffffff)
 Recursive DNS server     : fd31:aeb1:48df::2
  DNS server lifetime     :         6000 (0x00001770) seconds

Is this a bug? I'm using:

# opkg info odhcpd
Package: odhcpd
Version: 1.15-3

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 18.06.2, r7676-cddd7b4c77
 -----------------------------------------------------
dedeckeh commented 5 years ago

The specified ra_lifetime will be sent as Router Lifetime in case there's a default IPv6 route. You can override the default route check by specifying ra_default to either 1 (ignore no default route) or 2 (ignore no valid IPv6 prefix). So the observed behavior is normal in case you don't have a default route

brianjmurrell commented 5 years ago

But in this mode of using multiple RAs to handle fine-grain control of prefix announcements, does it make sense for a single router sending these multiple RAs to send the router announcement with conflicting lifetimes?

brianjmurrell commented 4 years ago

Looking back at your previous comment, am I to understand that it's expected that the RA for the fd31:aeb1:48df::/64 prefix includes a Router lifetime of 0 because fd31:aeb1:48df::/64 is a ULA prefix and isn't supplied by an upstream link like the 2001:123:ab:123::/64 prefix is?

And that to stop the RA Router lifetime conflicts I have to set ra_default to 1 on the lan configuration with the ULA prefix?

dedeckeh commented 4 years ago

Can you set odhcpd loglevel to 7 and paste the output of logread when you observe the behavior ?

TCB13 commented 1 year ago

Apparently I've this issue as well: https://forum.openwrt.org/t/openwrt-as-dns-provider-and-ipv6-annoyances/143927/3?u=tcb13

root@router:~# uci show dhcp.lan.ra_lifetime
dhcp.lan.ra_lifetime='1800'

Under Wireshark:

Router lifetime (s): 0

Any ideas?

TCB13 commented 1 year ago

Hello, I just wanted to add the following about my config:

imagem imagem

config dhcp 'lan'
    option interface 'lan'
    option leasetime '12h'
    option dhcpv4 'server'
    option start '10'
    option limit '100'
    option ra 'server'
    list dns 'fe80::1:51ff:fe44:a2'
    option ra_default '2'
    list domain 'lan'
    option ra_preference 'high'
    option ra_lifetime '1800'
    option ra_useleasetime '1'

@brianjmurrell and @dedeckeh as you can see I've ra_default set to 2 and Wireshark still shows Router lifetime (s): 0.

TCB13 commented 1 year ago

Can you set odhcpd loglevel to 7 and paste the output of logread when you observe the behavior ?

@dedeckeh I changed the log level like this:

uci set dhcp.odhcpd.loglevel=7
uci commit dhcp.odhcpd.loglevel
/etc/init.d/odhcpd restart

The only thing logged was this:

$ logread -f
Fri Feb  3 21:44:56 2023 daemon.debug odhcpd[13338]: Using a RA lifetime of 0 seconds on lan
Fri Feb  3 21:44:56 2023 daemon.notice odhcpd[13338]: Sending a RA on lan
Fri Feb  3 21:44:56 2023 daemon.debug odhcpd[13338]: Sent 88 bytes to ff02::1%lan@br-lan
Fri Feb  3 21:45:12 2023 daemon.debug odhcpd[13338]: Using a RA lifetime of 0 seconds on lan
Fri Feb  3 21:45:12 2023 daemon.notice odhcpd[13338]: Sending a RA on lan
Fri Feb  3 21:45:12 2023 daemon.debug odhcpd[13338]: Sent 88 bytes to ff02::1%lan@br-lan

This seems to be an isolated problem with the lifetime parameter, for instance uci set dhcp.lan.ra_reachabletime='1800' works as expected:

imagem

Thank you.

stintel commented 1 year ago

https://github.com/openwrt/openwrt/commit/65c9b5ffb02ba233e0857c1c035512d88ea3d3d2