[arch-projects] [netctl][PATCH 1/2] Factor out DHCP client support
Support for additional DHCP clients is now easy to add.
---
Makefile | 3 +-
docs/netctl.profile.5.txt | 16 +++++----
src/lib/connections/README | 2 +-
src/lib/dhcp/README | 34 +++++++++++++++++++
src/lib/dhcp/dhclient | 27 +++++++++++++++
src/lib/dhcp/dhcpcd | 28 ++++++++++++++++
src/lib/ip | 83 ++++++++++++++--------------------------------
7 files changed, 126 insertions(+), 67 deletions(-)
create mode 100644 src/lib/dhcp/README
create mode 100644 src/lib/dhcp/dhclient
create mode 100644 src/lib/dhcp/dhcpcd
diff --git a/Makefile b/Makefile
index b22fbe0..08ad462 100644
--- a/Makefile
+++ b/Makefile
@@ -15,9 +15,10 @@ install:
install -d $(DESTDIR)/etc/netctl/{examples,hooks,interfaces}
install -m644 docs/examples/* $(DESTDIR)/etc/netctl/examples/
# Libs
- install -d $(DESTDIR)/usr/lib/network/connections
+ install -d $(DESTDIR)/usr/lib/network/{connections,dhcp}
install -m644 src/lib/{globals,ip,rfkill,wpa} $(DESTDIR)/usr/lib/network/
install -m644 src/lib/connections/* $(DESTDIR)/usr/lib/network/connections/
+ install -m644 src/lib/dhcp/* $(DESTDIR)/usr/lib/network/dhcp/
install -m755 src/lib/{auto.action,network} $(DESTDIR)/usr/lib/network/
# Scripts
install -d $(DESTDIR)/usr/bin
diff --git a/docs/netctl.profile.5.txt b/docs/netctl.profile.5.txt
index dfc13bb..2cf0285 100644
--- a/docs/netctl.profile.5.txt
+++ b/docs/netctl.profile.5.txt
@@ -137,18 +137,20 @@ network. In particular, these connection types are +ethernet+,
An array of custom routes of the form +
`**<address range>** via **<gateway>**'.
-'DHCPClient=' [requires a DHCP setting]::
- The name of the preferred DHCP client. Supported options are
- `dhcpcd' and `dhclient'. Defaults to `dhcpcd'.
+'DHCPClient=' [requires 'IP=dhcp']::
+ The name of the DHCP client to use. Clients may accept additional
+ options through client-specific variables. By default, *netctl*
+ comes with support for `dhcpcd' and `dhclient'. Defaults to
+ `++dhcpcd++'.
+
+'DHCP6Client=' [requires 'IP6=dhcp' or 'IP6=dhcp-noaddr']::
+ The name of the DHCPv6 client to use. By default, only `dhclient'
+ is supported. Defaults to `++dhclient++'.
'DHCPReleaseOnStop='::
Set to `++yes++' to release the DHCP lease when the profile is
stopped.
-'DhcpcdOptions=', 'DhclientOptions=', 'DhclientOptions6='::
- Additional options to be passed to the DHCP client. Do not use this
- unless you know what you are doing.
-
'IPCustom=()'::
An array of argument lines to pass to `ip`. This can be used to
achieve complicated configurations within the framework of *netctl*.
diff --git a/src/lib/connections/README b/src/lib/connections/README
index 6d8db9b..2dd4b7b 100644
--- a/src/lib/connections/README
+++ b/src/lib/connections/README
@@ -10,7 +10,7 @@ for the aviancarrier connection type will be provided by the file:
Files that implement support for a connection type should NOT be
executable. Such files should contain valid Bash code, among which two
functions, namely
On Thu, 27 Feb 2014 14:25:15 +0100
Jouke Witteveen
Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly... Thanks, -- Leonid Isaev GPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
On Thu, 27 Feb 2014 13:03:27 -0500
Dave Reisner
On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
That's what I originally thought, and (in a nutshell) this is what I am currently using. However, networkd config is based on an interface name, not a profile. Hence there are special cases when e.g. 2 wireless networks use different settings (dynamic/static IP, different DNS, etc.). In these scenarios one needs wpa_actiond. As long as the correct profile is selected, one can make use of networkd instead of dhcpcd. Best, -- Leonid Isaev GPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
On Thu, Feb 27, 2014 at 7:20 PM, Leonid Isaev
On Thu, 27 Feb 2014 13:03:27 -0500 Dave Reisner
wrote: On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
That's what I originally thought, and (in a nutshell) this is what I am currently using.
However, networkd config is based on an interface name, not a profile. Hence there are special cases when e.g. 2 wireless networks use different settings (dynamic/static IP, different DNS, etc.). In these scenarios one needs wpa_actiond. As long as the correct profile is selected, one can make use of networkd instead of dhcpcd.
We probably want to improve networkd's [Match] logic, to also work in this case. I.e., to match on SSID. Not on my immediate TODO though, but patches welcome ;-) In general though, I quite like the idea of using networkd as a glorified dhcp client. We probably still lack some features in networkd before to make it support a bit of dynamic configuration before this really makes sense though. Cheers, Tom
On Thu, 27 Feb 2014 19:32:03 +0100
Tom Gundersen
On Thu, Feb 27, 2014 at 7:20 PM, Leonid Isaev
wrote: On Thu, 27 Feb 2014 13:03:27 -0500 Dave Reisner
wrote: On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
That's what I originally thought, and (in a nutshell) this is what I am currently using.
However, networkd config is based on an interface name, not a profile. Hence there are special cases when e.g. 2 wireless networks use different settings (dynamic/static IP, different DNS, etc.). In these scenarios one needs wpa_actiond. As long as the correct profile is selected, one can make use of networkd instead of dhcpcd.
We probably want to improve networkd's [Match] logic, to also work in this case. I.e., to match on SSID. Not on my immediate TODO though, but patches welcome ;-)
So, the SSID is supposed to be exposed by wpa_supplicant via dbus?
In general though, I quite like the idea of using networkd as a glorified dhcp client. We probably still lack some features in networkd before to make it support a bit of dynamic configuration before this really makes sense though.
Yes, but hopefully it won't become another NetworkManager :)
Cheers,
Tom
Thanks, -- Leonid Isaev GPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
On Thu, Feb 27, 2014 at 9:25 PM, Leonid Isaev
We probably want to improve networkd's [Match] logic, to also work in this case. I.e., to match on SSID. Not on my immediate TODO though, but patches welcome ;-)
So, the SSID is supposed to be exposed by wpa_supplicant via dbus?
The kernel exposes it over nl80211. -t
On Thu, Feb 27, 2014 at 7:20 PM, Leonid Isaev
On Thu, 27 Feb 2014 13:03:27 -0500 Dave Reisner
wrote: On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
That's what I originally thought, and (in a nutshell) this is what I am currently using.
However, networkd config is based on an interface name, not a profile. Hence there are special cases when e.g. 2 wireless networks use different settings (dynamic/static IP, different DNS, etc.). In these scenarios one needs wpa_actiond. As long as the correct profile is selected, one can make use of networkd instead of dhcpcd.
Contrary to networkd, netctl is profile based. This makes netctl useful in changing environments. If networkd exposes its dhcp client, this patch makes it easy to add support for it to netctl. Even better, if networkd exposes a lot of its functionality, netctl could potentially drop the dependency on iproute2 (not that there is a problem with iproute2). There are other dhcp clients (such as udhcp) for which support can already be implemented easily after this patch is applied. Regards, - Jouke
On Thu, 27 Feb 2014 20:39:18 +0100
Jouke Witteveen
On Thu, Feb 27, 2014 at 7:20 PM, Leonid Isaev
wrote: On Thu, 27 Feb 2014 13:03:27 -0500 Dave Reisner
wrote: On Thu, Feb 27, 2014 at 12:56:02PM -0500, Leonid Isaev wrote:
On Thu, 27 Feb 2014 14:25:15 +0100 Jouke Witteveen
wrote: Support for additional DHCP clients is now easy to add.
Just a quick question: are there any plans to use networkd as a DHCP backend? Yes, it is config-file-driven, but one can probably generate the .network files in /run on the fly...
This sounds like pointless masturbation. Just use networkd directly.
That's what I originally thought, and (in a nutshell) this is what I am currently using.
However, networkd config is based on an interface name, not a profile. Hence there are special cases when e.g. 2 wireless networks use different settings (dynamic/static IP, different DNS, etc.). In these scenarios one needs wpa_actiond. As long as the correct profile is selected, one can make use of networkd instead of dhcpcd.
Contrary to networkd, netctl is profile based. This makes netctl useful in changing environments.
If networkd exposes its dhcp client, this patch makes it easy to add support for it to netctl.
There are no cli options, only config files. These will need to be generated based on a specific profile. So, the whole situation is similar to the way netctl-auto handles wpa-configsection.
Even better, if networkd exposes a lot of its functionality, netctl could potentially drop the dependency on iproute2 (not that there is a problem with iproute2).
Yes, static things like bridge, bond, and vlan for which netctl profiles are essentially identical to .net{dev,work} files. I think that the only advantage of netctl over networkd in this case is the ability to specify dependencies (via Before= and After=) between the respective units.
There are other dhcp clients (such as udhcp) for which support can already be implemented easily after this patch is applied.
Regards, - Jouke
Thanks, -- Leonid Isaev GPG key fingerprint: C0DF 20D0 C075 C3F1 E1BE 775A A7AE F6CB 164B 5A6D
On Thu, Feb 27, 2014 at 10:11 PM, Leonid Isaev
Even better, if networkd exposes a lot of its functionality, netctl could potentially drop the dependency on iproute2 (not that there is a problem with iproute2).
Yes, static things like bridge, bond, and vlan for which netctl profiles are essentially identical to .net{dev,work} files. I think that the only advantage of netctl over networkd in this case is the ability to specify dependencies (via Before= and After=) between the respective units.
So networkd should sort out all that internally, but please let me know if you notice a usecase we are not covering. Cheers, Tom
participants (4)
-
Dave Reisner
-
Jouke Witteveen
-
Leonid Isaev
-
Tom Gundersen