Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 108345 - dhcpcd should execute /etc/dhcpc/dhcpcd.exe if it's going to override -c
Summary: dhcpcd should execute /etc/dhcpc/dhcpcd.exe if it's going to override -c
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Roy Marples (RETIRED)
Depends on:
Reported: 2005-10-06 20:51 UTC by Daniel Ceregatti
Modified: 2005-10-26 18:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---

allows the use of the -c dhcpcd option (dhcpcd-wrapper-script.patch,1.72 KB, patch)
2005-10-09 08:31 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Ceregatti 2005-10-06 20:51:30 UTC
man dhcpcd

-- snip --

       -c <ExecFilePath>
              dhcpcd  will  try  to  execute <ExecFilePath> script instead of
default /etc/dhcpc/dhcpcd.exe script every time it configures or brings down the
interface. See the description of dhcpcd.exe script in FILES section below.

ps auxww | grep dhcpcd

/sbin/dhcpcd -h bubba -R -N -d -o -m 0 -c
/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper -e
/var/lib/net-scripts/state/eth0 eth0

grep exe /lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper

Unless I missed something here, the expected behavior of dhcpcd executing
/etc/dhcpc/dhcpcd.exe just isn't happening.

Perhaps something needs to happen in /etc/conf.d/net? Perhaps
/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper should call the default
dhcpcd exe script?
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2005-10-07 00:14:23 UTC
I've really missed the point of this bug... the wrapper script is in
/lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper and dhcpcd calls it w/ -c
option as per man page.

Closing INVALID.
Comment 2 Daniel Ceregatti 2005-10-07 13:31:02 UTC
It seems that you've missed my point. Let me give you a real world scenario:

My machine at home uses dhcp to get its IP address from my cable modem provider.
In the past, I've used the dhcpcd.exe file (per the man page) to 1) update my
host name against my dyndns, 2) setup my somewhat complicated ipsec tunnel to my
office, and 3) run my iptables script to reflect the new IP.

This was actually working in gentoo, but then suddenly stopped working, because
of the bug I've reported here.

So, unless gentoo provides me the ability to always run a script when my dhcp
comes up, I'm going to insist that this is a bug.

So how about a few suggestions:

1) Make /lib/rcscripts/net.modules.d/helpers.d/dhcpcd-wrapper shell out to
/etc/dhcpc/dhcpcd.exe, if present and executable, with the expected arguments.

2) Provide some sort of facility in /etc/conf.d/net to execute an arbitrary
script when dhcp, be it dhcpcd or dhclient or whatever, obtains a new IP address.

Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-10-09 08:02:14 UTC

You can write a postup() function in /etc/conf.d/net which would work just as
well and would work for all dhcp clients (dhcpcd isn't the only choice). Example

postup() {
   local ip=$( interface_get_address "${IFACE}" )
   # Strip the CIDR part returned by baselayout-1.12.0
   register_dns_program "${ip}" $( hostname )

Of course, we can always let the dhcpcd wrapper run a script as well
Comment 4 Roy Marples (RETIRED) gentoo-dev 2005-10-09 08:31:40 UTC
Created attachment 70227 [details, diff]
allows the use of the -c dhcpcd option
Comment 5 Roy Marples (RETIRED) gentoo-dev 2005-10-09 08:32:15 UTC
Please test the above patch against baselayout-1.12.0_pre8 and tell me if it
works or not.

Comment 6 Daniel Ceregatti 2005-10-11 12:29:00 UTC
The patch didn't apply cleanly to baselayout-1.12.0_pre8-r2, which seems to be
the latest ~x86. If you provide such a patch, I'll gladly test it.
Comment 7 Roy Marples (RETIRED) gentoo-dev 2005-10-11 15:49:59 UTC
pre9 is now in portage with this patch included
Comment 8 Daniel Ceregatti 2005-10-11 18:08:02 UTC
I'll test it once baselayout-1.12.0_pre9 hits portage and report back here.
Comment 9 Daniel Ceregatti 2005-10-26 18:11:00 UTC
Works great. Thanks.
Comment 10 Daniel Ceregatti 2005-10-26 18:14:11 UTC
Oops, clicked the wrong radio button.