How is odhcp6c daemon started

This is related to my recent post Static IPv6 wan6 interface but odhcp6c daemon requests address My primary objective is to stop odhcp6c requesting a DHCPv6 address on wan6.

I am trying to understand how the odhcp6c daemon is managed. I have found /lib/netifd/proto/dhcpv6.sh and basically understand what is happening inside it.

I would like to know:

  1. how, where and when /lib/netifd/proto/dhcpv6.sh is called
  2. why odhcp6c restarts shortly after I kill it manually

/usr/lib/lua/luci/model/network/proto_dhcpv6.lua registers /lib/netifd/proto/dhcpv6.sh

Not much wiser :frowning:

In your other thread I've seen that your wan uses the pppoe protocol so the DHCPv6 client is likely launched by the autoipv6 feature of the pppoe proto.

Run ubus call network.interface dump and see if you have a virtual interface wan_6 (note the underscore) with proto set to dhcpv6. If yes, then thats what is launching the client. That virtual interface is dynamically registered by the ppp up scripts if ipcp6 negotiation succeeded.

To inhibit this automatic IPv6 handling, set option ipv6 0 on the wan PPPoE interface.

For reference, here's the place where the dynamic interface is triggered:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=package/network/services/ppp/files/lib/netifd/ppp6-up ($AUTOIPV6 traces back to the value of option ipv6 of the parent interface)

Thank you very much. ubus call network.interface dump shows a wan_6 interface. I saw it in my debugging writes from /lib/netifd/proto/dhcpv6.sh and was puzzling over it.

I will have another play when the family have finished with the router and report back.

Amusingly, while trying to avoid starting odhcp6c I managed to get two copies running - from wan_6 and wan6. Is that a bug?

Wouldn't think so as it does not happen in the default configuration. Having two copies running is not technically forbidden either.

That was it. IPv6 now works without the routing hack, and I understand why (mostly). Thanks again.

... but after a reboot other “bad things” happened with IPv6. I have reverted to my previous working configuration and – at least for now – will just work around my ISPs brokenness. It is working so I really should just leave it alone.

Thanks for the useful information. I had fun digging around in openwrt internals and learned a little more about IPv6.

My experience is a little different. I tried option ipv6 with 0, 1, auto and undefined for wan PPPoE interface. Then scattered logger commands through a few scripts. I then used the commands:

  • logread | grep pppd to check on pppd
  • ubus call network.interface dump to check for virtual interface wan_6
  • ps to check for odhcp6c
  • ifstatus wan6 to examine the wan6 interface

The results below surprised me – probably because I didn't understand the documentation.

The value of network.wan.ipv6 can be auto (default), 0 or 1:

  • 0: IPv6 is not available on wan interface
  • 1: IPv6 requested on wan interface and Link Local address is allocated – presumably if available. odhcp6c not started automatically
  • auto (default): IPv6 requested on wan interface and Link Local address is requested. pseudo-interface wan_6 is created and odhcp6c started automatically

I can now control odhcp6c. I can use the network.wan6 section to configure IPv6 as static, dhcpv6 or whatever. When odhcp6c isn't doing things behind my back the network behaviour is much more predictable.

I think my previous confusion was due to:

  • ignorance
  • assuming that the default value for ipv6 was '1'.
  • intermittent IPv6 routing issues with my ISP