Commit Graph

128 Commits

Author SHA1 Message Date
Dan Winship
16e824fe34 libnm-util: belatedly export nm_setting_generic_new() 2013-11-01 13:04:11 -04:00
Dan Williams
77e50740a8 libnm-util: add Data Center Bridging (DCB) setting
Includes various fixes & cleanups from Thomas Haller.
2013-10-31 13:28:42 -05:00
Thomas Haller
df4e159728 libnm-util: expose nm_setting_bond_validate_option as public API
Co-Authored-By: Jiří Klimeš <jklimes@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-10-25 22:32:47 +02:00
Jiri Pirko
64cdb1a7f0 libnm-util: add setting for team port
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:54:14 -05:00
Jiri Pirko
3dcb7935a5 libnm-util: add team device setting
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-08-15 10:53:03 -05:00
Dan Williams
00203a8798 libnm-util: add gateway-ping-timeout property to connection setting
To better handle broken hardware, like switches which don't pass
traffic for a few seconds after a carrier has been negotiated,
add a timeout to control how long to wait for successful pings
of the gateway before giving up and proceeding with IP config.
Default is 0, which means don't ping the gateway, just assume
the NIC/switch aren't lying and can pass traffic immediately.
2013-06-21 16:17:18 -05:00
Dan Winship
84468ad653 libnm-util: fix alphabetization in libnm-util.ver
to fix "make check"
2013-06-14 12:24:40 -03:00
Dan Winship
6854481fe8 libnm-util: add P_Key support to NMSettingInfiniband
Add p-key and parent properties to NMSettingInfiniband, for specifying
additional interfaces using alternate IPoIB partitions.
2013-06-13 15:52:51 -03:00
Dan Winship
9a73db17d5 libnm-util: add nm_utils_hwaddr_valid() 2013-06-13 15:52:51 -03:00
Dan Winship
82ac7da754 libnm-util: add hwaddr functions that take length rather than type
Add nm_utils_hwaddr_ntoa_len() and nm_utils_hwaddr_aton_len(), which
take a length rather than a type, which is generally more convenient,
and also necessary if you might be encountering devices of unknown
types.
2013-06-11 09:27:45 -03:00
Jiří Klimeš
ced61dfc7f libnm-util: add access functions for 'mac-address-blacklist' to wired/wireless
nm_setting_wire(d/less)_get_num_mac_blacklist_items()
nm_setting_wire(d/less)_get_mac_blacklist_item()
nm_setting_wire(d/less)_add_mac_blacklist_item()
nm_setting_wire(d/less)_remove_mac_blacklist_item()
2013-05-07 19:38:31 +02:00
Dan Winship
8b823d7c6a libnm-util: add NMSettingGeneric
Add NMSettingGeneric, a dummy L2 NMSetting for creating NMConnections
for devices that are not specifically recognized.
2013-05-07 12:46:56 -04:00
Dan Williams
bafd0d557d libnm-util: add nm_connection_replace_settings_from_connection() (bgo #696387)
Convenience function to replace settings in one conneciton with settings
from another, without having to go through the nm_connection_to_hash()
steps, which are just inefficient and kinda pointless.
2013-04-17 12:23:34 -05:00
Dan Winship
5fec30d98e Revert :carrier-detect properties and associated code
Ignoring carrier is generally something you want at the machine level
(eg, for a server), not at the connection level.
2013-04-03 10:23:49 -04:00
Jiří Klimeš
2109f41cc6 libnm-util: consolidate hex-string <-> bin conversion functions
and move them to libnm-util's nm-utils.s so that they are easily available.
2013-03-28 16:59:58 +01:00
Jiří Klimeš
d7d2015dfd libnm-util: add nm_setting_wired_get_valid_s390_options() 2013-03-19 08:59:50 +01:00
Dan Winship
2d668d763e libnm-util: add NMSettingConnection:interface-name
https://bugzilla.gnome.org/show_bug.cgi?id=693684
2013-03-13 16:45:18 -04:00
Dan Winship
feeafb8cf1 core: Update device activation for :carrier-detect
Add a "need_carrier" argument to nm_device_is_available(), to allow
distinguishing between "device is not available", "device is fully
available", and "device is available except for not having carrier".

Adjust various parts of NMDevice and NMManager to allow for the
possibility of activating a connection with :carrier-detect = "no" on
a device with no carrier, and to avoid auto-disconnecting devices with
:carrier-detect = "on-activate".

https://bugzilla.gnome.org/show_bug.cgi?id=688284
2013-02-15 13:40:39 -05:00
Dan Winship
5266e25e2b libnm-utils: add :carrier-detect properties
For settings corresponding to devices that have a :carrier property
(ie bond, bridge, infiniband, vlan, and wired), add a :carrier-detect
property specifying how that affects the connection:

  yes: The connection can only be activated when the device
      has carrier, and will be deactivated if the device loses
      carrier (for more than 4 seconds).
  no: The connection ignores carrier on the device; it can be
      activated when there is no carrier, and stays activated
      when carrier is lost.
  on-activate: The connection can only be activated when the
      device has carrier, but it will not be deactivated if the
      device loses carrier.

https://bugzilla.gnome.org/show_bug.cgi?id=688284
2013-02-15 13:40:38 -05:00
Jiří Klimeš
bf610255a1 libnm-util: move verify_wep_key() and verify_wpa_psk() to nm-utils.c
and rename them to nm_utils_wep_key_valid(), nm_utils_wpa_psk_valid().
They are general functions and can also be used elsewere usefully.
2013-02-06 13:29:58 +01:00
Dan Williams
d723457ac7 libnm-util: add NMSettingBridgePort 2012-11-30 13:21:50 -06:00
Dan Williams
8ecded9a9b libnm-util: add NMSettingBridge 2012-11-30 13:21:50 -06:00
Gene Czarcinski
90b99522d7 dhcp: fix DHCPv6 to support server-side dynamic DNS (bgo #684242)
This patch makes DHCPv6 support more or less equivalent to that
one of IPv4 DHCP.

(dcbw: fix some formatting, rearrange code so it's less convoluted,
fix up writing hostname to ifcfg files)
2012-11-16 17:26:19 -06:00
Dan Williams
e6bdb8bc55 libnm-util: add methods for AP-mode security filtering
Add a helper like nm_utils_security_valid() except for access point
mode.  We can't use nm_utils_security_valid() without changing the
arguments, hence the new function.  Plus in AP mode all you care about
are the device capabilities, not AP flags since the device *is*
the AP.
2012-10-17 14:07:37 -05:00
Dan Winship
74b6b9c768 libnm-util: move nm_utils_is_uuid() here
This is useful outside the daemon too, so move it into libnm-utils.
2012-09-26 12:14:37 -04:00
Jiří Klimeš
4ee617ddf2 libnm-util: add "secondaries" property containing secondary connection UUIDs
These connections are to be activated with the base connection.
2012-09-21 13:46:54 +02:00
Thomas Graf
b46508b5c6 libnm-util: move dev_valid_name() to libnm-util and make it public
The bridging code needs it as well.
2012-08-29 17:46:54 -05:00
Jiří Klimeš
00297f49fb libnm-util: add nm_utils_file_is_pkcs12() for checking PKCS#12 file format 2012-07-16 14:59:59 +02:00
Pantelis Koukousoulas
8039dd30d8 adsl: add libnm-glib and nmcli code
For the finale, this is the libnm-glib and nmcli part of the support,
with this you can now make a full pppoatm connection from NetworkManager
by configuring it in system scope in a keyfile.

As an example, here is mine:
(password and username snipped for obvious reasons)

[connection]
id=MYISP
uuid=34d04e69-fdd9-4231-af2c-25ed1f34dc1e
type=adsl
timestamp=1304621332

[adsl]
username=user@myisp.com
password=mypassword
vpi=8
vci=35
encapsulation=vcmux
protocol=pppoa

[ipv6]
method=ignore

[ipv4]
method=auto

Extract from logs:
NetworkManager[29155]: <info> Activation (ueagle-atm0) starting connection 'MYISP'
NetworkManager[29155]: <info> (ueagle-atm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 1 of 5 (Device Prepare) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) starting...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: prepare -> config (reason 'none') [40 50 0]
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) successful.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) scheduled.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 2 of 5 (Device Configure) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) started...
NetworkManager[29155]: <info> (ueagle-atm0): device state change: config -> ip-config (reason 'none') [50 70 0]
NetworkManager[29155]: <info> starting PPP connection
NetworkManager[29155]: <debug> [1304671146.590156] [nm-ppp-manager.c:1047] nm_ppp_manager_start(): command line: /usr/sbin/pppd nodetach lock nodefaultroute user user@myisp.com plugin pppoatm.so 8.35 noipdefault noauth usepeerdns lcp-echo-failure 0 lcp-echo-interval 0 ipparam /org/freedesktop/NetworkManager/PPP/0 plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so
NetworkManager[29155]: <info> pppd started with pid 29175
NetworkManager[29155]: <debug> [1304671146.591235] [NetworkManagerUtils.c:816] nm_utils_get_proc_sys_net_value(): (ueagle-atm0): error reading /proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra: (4) Failed to open file '/proc/sys/net/ipv6/conf/ueagle-atm0/accept_ra': No such file or directory
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 3 of 5 (IP Configure Start) complete.
Plugin pppoatm.so loaded.
Plugin /opt/nmadsl/lib/pppd/2.4.5/nm-pppd-plugin.so loaded.
** Message: nm-ppp-plugin: (plugin_init): initializing
** Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
NetworkManager[29155]: <debug> [1304671146.612937] [nm-udev-manager.c:621] handle_uevent(): UDEV event: action 'add' subsys 'net' device 'ppp0'
NetworkManager[29155]: <debug> [1304671146.613134] [nm-udev-manager.c:525] net_add(): ignoring interface with type 512
NetworkManager[29155]: <debug> [1304671146.617308] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x1090
Using interface ppp0
Connect: ppp0 <--> 8.35
** Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
** Message: nm-ppp-plugin: (nm_phasechange): status 6 / phase 'authenticate'
** Message: nm-ppp-plugin: (get_credentials): passwd-hook, requesting credentials...
NetworkManager[29155]: <debug> [1304671149.639511] [nm-agent-manager.c:1044] nm_agent_manager_get_secrets(): Secrets requested for connection /org/freedesktop/NetworkManager/Settings/0 (adsl)
NetworkManager[29155]: <debug> [1304671149.639684] [nm-settings-connection.c:717] nm_settings_connection_get_secrets(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets requested flags 0x1 hint 'password'
NetworkManager[29155]: <debug> [1304671149.640950] [nm-agent-manager.c:959] get_start(): (0x9b4ad10/adsl) system settings secrets sufficient
NetworkManager[29155]: <debug> [1304671149.641332] [nm-settings-connection.c:573] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) existing secrets returned
NetworkManager[29155]: <debug> [1304671149.641541] [nm-settings-connection.c:579] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) secrets request completed
NetworkManager[29155]: <debug> [1304671149.643074] [nm-settings-connection.c:618] agent_secrets_done_cb(): (34d04e69-fdd9-4231-af2c-25ed1f34dc1e/adsl:1) new agent secrets processed
** Message: nm-ppp-plugin: (get_credentials): got credentials from NetworkManager
PAP authentication succeeded
** Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
local  IP address 94.70.90.201
remote IP address 80.106.108.12
primary   DNS address 195.170.0.1
secondary DNS address 195.170.2.2
** Message: nm-ppp-plugin: (nm_phasechange): status 9 / phase 'running'
** Message: nm-ppp-plugin: (nm_ip_up): ip-up event
** Message: nm-ppp-plugin: (nm_ip_up): sending Ip4Config to NetworkManager...
NetworkManager[29155]: <debug> [1304671150.607440] [nm-netlink-monitor.c:117] link_msg_handler(): netlink link message: iface idx 35 flags 0x110D1
NetworkManager[29155]: <info> PPP manager(IP Config Get) reply received.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) started...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) scheduled...
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 4 of 5 (IP4 Configure Get) complete.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) started...
NetworkManager[29155]: <debug> [1304671150.608918] [nm-system.c:222] sync_addresses(): (ppp0): syncing addresses (family 2)
NetworkManager[29155]: <info> (ueagle-atm0): device state change: ip-config -> activated (reason 'none') [70 100 0]
NetworkManager[29155]: <info> Policy set 'MYISP' (ppp0) as default for IPv4 routing and DNS.
NetworkManager[29155]: <info> Activation (ueagle-atm0) successful, device activated.
NetworkManager[29155]: <info> Activation (ueagle-atm0) Stage 5 of 5 (IP Configure Commit) complete.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:56 -05:00
Pantelis Koukousoulas
0e6f5ce38e adsl: settings and initial "scaffolding"
This patch adds the settings code (NMSettingAdsl) and the initial
"scaffolding" i.e., a tiny stub version of NMDeviceAdsl and the
udev handler code to get the device detected.

With this patch you should be able to see an atm device being detected
by networkmanager in the logs, although of course it doesn't
do anything useful yet.

Extract from the logs:

 [1304668252.341354] [nm-udev-manager.c:562] adsl_add(): adsl_add: ATM Device detected from udev. Adding ..
(ueagle-atm0): failed to look up interface index
(ueagle-atm0): new ADSL device (driver: 'ueagle-atm' ifindex: -1)
(ueagle-atm0): exported as /org/freedesktop/NetworkManager/Devices/2
(ueagle-atm0): now managed
(ueagle-atm0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
(ueagle-atm0): deactivating device (reason: 2).
 [1304668252.345102] [nm-system.c:1349] flush_routes(): (ueagle-atm0) failed to lookup interface index
 [1304668252.347821] [nm-device.c:3912] nm_device_state_changed(): (ueagle-atm0): device is available,

In this version, we hack the nm-device.c:nm_device_get_priority() to get better priority
instead of changing the DeviceType enum.

Signed-off-by: Pantelis Koukousoulas <pktoss@gmail.com>
2012-05-18 15:42:55 -05:00
Dan Williams
bbd2c6e2e6 libnm-util: add 'hidden' property to the wireless setting
Used as a hint to indicate the network is not broadcasting the SSID
and that workarounds should be used for more reliable connection.
2012-05-02 17:33:17 -05:00
Dan Williams
b9ddbe58f0 libnm-util: add functions for getting valid bond options and defaults
Since the options are a hash table now there wasn't any way to
determine what options were allowed and what their default values
are.  Add some functions to do that.
2012-03-01 17:40:18 -06:00
Dan Williams
e52bf5e172 libnm-util: add 'parent' property to VLAN setting 2012-03-01 17:39:36 -06:00
Jiří Klimeš
788720abec libnm-util: add a property for IPv6 Privacy Extensions to NMSettingIP6Config
ip6-privacy
2012-02-27 16:28:11 +01:00
Dan Williams
552c9959cc libnm-util: various cleanups and documentation fixes
Add documentation so the API spec generator can do something
for the VLAN setting.  Also enforce validation of the ingress
and egress priority maps; 802.1D priorities are limited to
values from 0 - 7 and Linux SKB values are 32 bits.

Also, the 'slave' property is a duplicate of the 'master'
property added to NMSettingConnection in the bonding work
so we can get rid of it and use 'master' instead.
2012-02-16 15:05:55 -06:00
Weiping Pan
23c1b6ad30 libnm-util: add VLAN setting and properties
Signed-off-by: Weiping Pan <wpan@redhat.com>

(dcbw: formatting cleanups and priority map code simplifications)
2012-02-16 15:05:55 -06:00
Thomas Graf
4f166d719b bonding: convert individual bonding options to a dict
Removes all bonding options properties and adds a "options" dict to hold
them all. Accessible via accessor functions. ifcfg interface is
unchanged.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2012-02-15 21:49:05 -06:00
Dan Winship
839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Jiří Klimeš
0ba66f8272 libnm-util: add 'pac-file' property for 8021x setting (used in EAP-FAST) 2012-01-27 11:46:36 +01:00
Dan Winship
b860c7be4a infiniband: add transport-mode property
Add transport-mode property to NMSettingInfiniband (and parse it
correctly in ifcfg-rh), and set it up properly on the device in
NMDeviceInfiniband.
2012-01-26 09:58:48 -06:00
Jiří Klimeš
3a23cddb37 libnm-util: add functions to get number of data items and secrets
nm_setting_vpn_get_num_data_items()
nm_setting_vpn_get_num_secrets()
2012-01-05 15:44:46 +01:00
Dan Williams
2e858619d3 trivial: fix up libnm-util testcases 2011-12-09 00:13:19 -06:00
Thomas Graf
1cd8d52061 bonding: add nm_connection_get_virtual_iface_name() to abstract kernel interface binding
Some connection types such as bonding, bridging and VLAN require
specific virtual kernel interfaces identified by name to be auto
connected to the connection.

The function nm_connection_get_virtual_iface_name() returns the name
of the kernel interface if the connection type requires this
functionatlity.

Each connection base type settings class can implement the function
get_virtual_iface_name() if the connection needs to be auto connected
to a specific kernel interface.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-08 09:56:47 -06:00
Thomas Graf
86d5a40677 libnm-util: add nm_connection_get_setting_serial()
Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:08:39 -06:00
Dan Williams
1f8090fb58 libnm-util: add nm_utils_hwaddr_type()
Returns the address type given the length.
2011-12-02 13:09:16 -06:00
Dan Winship
d96bf9e866 libnm-util: add NMSettingInfiniband 2011-12-02 13:09:16 -06:00
Evan Broder
dc92d1258d settings: Add new password-raw and password-raw-flags properties to 8021x.
In cases where the actual password is non-ASCII, it may not be
possible to deliver the 802.1x password as a D-Bus string. Instead
provide an alternate field holding the password as a byte array.

In cases where both a password and password-raw are supplied,
password is preferred.
2011-11-21 23:50:48 -06:00
Dan Winship
2510c617ec libnm-util: add ether_ntoa/ether_aton-like utility methods
nm_utils_hwaddr_ntoa() and nm_utils_hwaddr_aton() are like
ether_ntoa()/ether_aton(), but handle IPoIB too.

nm_utils_hwaddr_atoba() is like _aton() but returns a GByteArray,
since that's what's wanted in many places.

Also remove nm_ether_ntop() and replace uses of it with
nm_utils_hwaddr_ntoa().
2011-11-17 13:37:08 -06:00
Dan Williams
c15dea298f core: make testcases work after bonding merge 2011-11-09 23:40:04 -06:00
Thomas Graf
6349151de1 bonding: implement bonding slaves
Adds a MASTER= directive to ifcfg-rh allowing a connection to define
itself as bonding slave.

Adds a connection property "master" which contains the in-kernel device
name or UUID of the master connection.

Adds a connection property "slave-type" which defines the type of slave
this connection represents. Currently this is only set by bonding but
eventually this will be used by VLAN and bridging.

Enforces that no bonding slave connection has any IPv4 or IPv6
configuration set.

Changes make_ip4_setting() to take a universal flag indicating whether
to allow disabling ip4 config or not and use it for both, ip6 and
bonding special case.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:23:21 -06:00