Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 547510 - net-misc/netifrc: udhcpc can not run in background
Summary: net-misc/netifrc: udhcpc can not run in background
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: netifrc Team
URL:
Whiteboard: netifrc:dhcp netifrc:udhcpc
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-23 17:36 UTC by Joakim Tjernlund
Modified: 2016-10-24 21:36 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2015-04-23 17:36:02 UTC
udhcpc.sh uses --now like so:
  eval "${x}" "${args}" --interface="${IFACE}" --now
This makes it impossible to use --background as a user.
Please remove --now or scan "${args}" for --background and then
remove --now

minor nit, if net-dns/openresolv is installed I see this when udhcpc starts:
  No resolv.conf for interface eth4
and when stopping eth4 /etc/resolv.conf is still configured:
# Generated by udhcpc for eth4
domain transmode.se
nameserver 192.168.201.2
nameserver 192.168.201.12
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2015-04-24 21:21:56 UTC
I do not entirely understand why you need to run in background, usually ifplugd or wpa_supplicant should be used to detect link.

Please open a separate bug for the openresolv issue, please provide your exact configuration.
Comment 2 Joakim Tjernlund 2015-04-25 08:12:08 UTC
(In reply to Alon Bar-Lev from comment #1)
> I do not entirely understand why you need to run in background, usually
> ifplugd or wpa_supplicant should be used to detect link.

Becuse udhcpc can mange link detect by itsleft so I don't have to
use ifplugd.
Comment 3 Alon Bar-Lev (RETIRED) gentoo-dev 2015-04-25 08:27:59 UTC
(In reply to Joakim Tjernlund from comment #2)
> (In reply to Alon Bar-Lev from comment #1)
> > I do not entirely understand why you need to run in background, usually
> > ifplugd or wpa_supplicant should be used to detect link.
> 
> Becuse udhcpc can mange link detect by itsleft so I don't have to
> use ifplugd.

this is entirely different issue. you want to use udhcpc as replacement to link detection, it should support the proper notifications for service in pending state and enable it, probably also support wireless properly etc... I suggest you just use ifplugd as this configuration is much simpler.
Comment 4 Joakim Tjernlund 2015-04-25 11:47:45 UTC
(In reply to Alon Bar-Lev from comment #3)
> (In reply to Joakim Tjernlund from comment #2)
> > (In reply to Alon Bar-Lev from comment #1)
> > > I do not entirely understand why you need to run in background, usually
> > > ifplugd or wpa_supplicant should be used to detect link.
> > 
> > Becuse udhcpc can mange link detect by itsleft so I don't have to
> > use ifplugd.
> 
> this is entirely different issue. you want to use udhcpc as replacement to
> link detection, it should support the proper notifications for service in
> pending state and enable it, probably also support wireless properly etc...
> I suggest you just use ifplugd as this configuration is much simpler.

This is an embedded target with no wireless I/F. I just want to have
udhcp be able to get me an IP address etc. when link is detected.

Just specifying --background etc in conf.d/net seems even simpler than using ifplugd:
udhcpc_eth4="--background --tryagain 1 --timeout 1 --retries 10"

What will ifplugd get me that udhcpc dosen't ?
Comment 5 Joakim Tjernlund 2015-04-25 13:30:36 UTC
(In reply to Alon Bar-Lev from comment #3)
> (In reply to Joakim Tjernlund from comment #2)
> > (In reply to Alon Bar-Lev from comment #1)
> > > I do not entirely understand why you need to run in background, usually
> > > ifplugd or wpa_supplicant should be used to detect link.
> > 
> > Becuse udhcpc can mange link detect by itsleft so I don't have to
> > use ifplugd.
> 
> this is entirely different issue. you want to use udhcpc as replacement to
> link detection, it should support the proper notifications for service in
> pending state and enable it, probably also support wireless properly etc...
> I suggest you just use ifplugd as this configuration is much simpler.

So I had a look at ifplugd, maybe it will be better :)

Not sure how restrict ifplugd to just eth4, any pointer ?
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2015-04-25 15:49:04 UTC
(In reply to Joakim Tjernlund from comment #5)
> (In reply to Alon Bar-Lev from comment #3)
> > (In reply to Joakim Tjernlund from comment #2)
> > > (In reply to Alon Bar-Lev from comment #1)
> > > > I do not entirely understand why you need to run in background, usually
> > > > ifplugd or wpa_supplicant should be used to detect link.
> > > 
> > > Becuse udhcpc can mange link detect by itsleft so I don't have to
> > > use ifplugd.
> > 
> > this is entirely different issue. you want to use udhcpc as replacement to
> > link detection, it should support the proper notifications for service in
> > pending state and enable it, probably also support wireless properly etc...
> > I suggest you just use ifplugd as this configuration is much simpler.
> 
> So I had a look at ifplugd, maybe it will be better :)
> 
> Not sure how restrict ifplugd to just eth4, any pointer ?

if ifplugd exists the netifrc will use it automatically for link detection for the interface that is started if it is wired, wpa_supplicant will be used if interface is wireless.
Comment 7 Joakim Tjernlund 2015-04-25 16:12:32 UTC
Maybe ifplugd will work for me but I still find it
odd that udhcpc is not allowed to enter background like other
dhcp clients can.
Comment 8 Alon Bar-Lev (RETIRED) gentoo-dev 2015-04-25 18:26:42 UTC
(In reply to Joakim Tjernlund from comment #7)
> Maybe ifplugd will work for me but I still find it
> odd that udhcpc is not allowed to enter background like other
> dhcp clients can.

there is a difference between using dhcp client as standalone and using within netifrc. if you want to leverage the abilities and flexibility of netifrc of managing an interface there is a specific sequence in which these utilities should be used, which is a subset of their capabilities.

so either you use it using the netifrc way or you just start your own dhcp client daemon in your embedded environment. it is your call to make.
Comment 9 Joakim Tjernlund 2015-05-22 07:07:16 UTC
Using sys-apps/ifplugd in openrc still has its problems.

Now udhcpc is started when the link comes up(good) but if the
dhcp server does not reply in time, udhcpc will exit and no IP address
will ever be configured.

I cannot change this as udhcpc.sh forces --now

Also, /lib/netifrc/sh/udhcpc-hook.sh gladly creates a /etc/resolv.conf but
never removes /etc/resolv.conf when deconfigured.

Using resolvconf does not change that either.