What's new

Relationship/function between odhcp6, dhcp6, /sbin/rc

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

bengalih

Senior Member
When IPv6 is enabled (at least in Native mode), odhcp6c is daemonized to run performing as a DHCPv6 client.
The following can be seen running on the device:

Code:
/usr/sbin/odhcp6c -df -R -s /tmp/dhcp6c -N try -c 0003000XXXXXXXXXXXX -FP 0:XXXXX eth0

The odhcp6c help defines -s as:

Code:
-s <script>     Status update script (/usr/sbin/odhcp6c-update)

In turn, on the system the defined script, '/tmp/dhcp6c' is a symlink to '/sbin/rc'
Code:
root@router-asus:/tmp# ll /tmp/dhcp6c
lrwxrwxrwx    1 root root             8 Apr  7 13:00 /tmp/dhcp6c -> /sbin/rc*

I understand the function of odhcp6c to server as the DHCPv6 client requesting both DHCPv6-NA/PD configuration and to serve out RAs.

I also know that the triggering of '/tmp/dhcp6c' from within the above code is what seems to actually configure the interface with any received IPv6 addresses.

I am trying to understand a bit more about how it actually does so.
odhcp6c does not seem to be passing any command line parameters to dhcp6c.
dhcp6c does not seem to be a "normal" implementation of dhcp6c as it does not appear to take any command line arguments (like -d/-D to present debug info).
In fact if you run it on its own it just terminates with no information or logging.

Can anyone describe how these components actually work together within the firmware? I took a look at the code, but I'm afraid its beyond my C skill.
 
dhcp6c does not seem to be a "normal" implementation of dhcp6c as it does not appear to take any command line arguments (like -d/-D to present debug info).

It's an rc applet, just like all your shell commands are busybox applet. The dhcp6c code is within rc.

odhcp6c does not seem to be passing any command line parameters to dhcp6c.

It does pass arguments to it, they are documented on the odhcp6c project page:


dhcp6c will take both arguments passed at the command line by odhcp6c as well as all the information provided through env vars.
 
dhcp6c will take both arguments passed at the command line by odhcp6c as well as all the information provided through env vars.

Can you help me understand why if I were to run odhcp6c manually and set a "-s /tmp/test.sh" which was a script that simply echoed any passed parameters (or env) to a text file, nothing appears to go there ?

Likewise, if I don't have odhcp6c run "-s /tmp/dhcp6c" but run in manually immediately following like "/tmp/dhcp6c eth0 started" nothing happens (I assume this might have to do with not having the environmental variables there...one reason I'm trying to capture them as above).

thanks
 
Can you help me understand why if I were to run odhcp6c manually and set a "-s /tmp/test.sh" which was a script that simply echoed any passed parameters (or env) to a text file, nothing appears to go there ?
No idea, I never used odhcp6c. The documentation says it's supposed to provide two arguments to that script, and the rc code does use both parameters.

Likewise, if I don't have odhcp6c run "-s /tmp/dhcp6c" but run in manually immediately following like "/tmp/dhcp6c eth0 started" nothing happens (I assume this might have to do with not having the environmental variables there...one reason I'm trying to capture them as above).
Yes, dhcp6c will need both the two command line arguments it needs to know what it's supposed to do, and all the env vars to know how to do it.
 
No idea, I never used odhcp6c. The documentation says it's supposed to provide two arguments to that script, and the rc code does use both parameters.


Yes, dhcp6c will need both the two command line arguments it needs to know what it's supposed to do, and all the env vars to know how to do it.

Thanks. While my wrapper script was properly capturing parameters and environment when I ran it manually, it was not when running it through the "-s scriptname" parameter. Turns out my issue was missing my shebang interpreter at the top of my script (not sure how it properly worked manually without it, but as I was doing a quick hack job I overlooked it).

Anyway, that allowed me to get all the output, and it is very helpful in seeing what's going on.
 

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top