Commit graph

107 commits

Author SHA1 Message Date
Guido Günther
92a3bc9e4c ifupdown: cleanup indentation
and remove unused variables.
2011-12-12 20:09:16 -06:00
Dan Williams
80852aa96a ifnet: make testcases happy
ifnet_plugin_get_conf_file() needs to be defined for the testcases.
2011-12-12 20:07:54 -06:00
Dan Williams
1d0c27590e ifnet: use SYSCONFDIR not /etc 2011-12-12 20:04:25 -06:00
Dan Williams
c579bf95a5 trivial: spacing fixes 2011-12-12 20:02:56 -06:00
Mu Qiao
6d09316b6f ifnet: support writing openrc style 2011-12-12 20:02:00 -06:00
Mu Qiao
76619e4529 ifnet: support reading openrc style
IP configuration like 192.168.1.{2..4} is not supported anymore.
2011-12-12 19:44:03 -06:00
Guido Günther
6dcd9114cb ifupdown: add testcase to verify parsing into NMConnection 2011-12-07 17:58:44 -06:00
Guido Günther
e4fbf5363e ifupdown: support dns-search entries
as used by resolvconf and openresolv.
2011-12-07 17:58:24 -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
Thomas Graf
5b7503e95e core: use nm_connection_get_setting_<type>() whenever possible
Leads to shorter, easier to read code and improves type casting safety.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-12-06 16:06:43 -06:00
Dan Williams
8a16af2bd8 keyfile: add support for Infiniband connections 2011-12-02 13:09:16 -06:00
Dan Winship
730f034a6c ifcfg-rh: add support for infiniband 2011-12-02 13:09:16 -06:00
Jiří Klimeš
0dc11be8da trivial: remove unnecessary always-true check 2011-11-22 09:52:42 +01:00
Evan Broder
9fc134ee83 keyfile: Read and write the new 8021x.password-raw field 2011-11-21 23:51:01 -06:00
Dan Williams
9dd270966e ifcfg-rh: revert some bits of a2b1afb1e4
Revert the DEVICE and suffix bits for the connection name; there's
a few problems with this.  It adds the DEVICE value for connections
regardless of what type they, even in cases where it's not hugely
useful (ie basic wired).  We used to do this, but stopped doing it
because it has zero relevance to a large number of users.  Instead,
the UI itself should do this where appropriate.  That probably means
that 'nmcli' and other tools should give more information about
the components of a connection (like a slave device's master) and
GUI tools would show that in detailed connection information but
not in the at-a-glance status or tooltips.  Second, if more
more advanced users wish this information to show up in the name
they can always set the name themselves, or name the ifcfg file
something like "ifcfg-bond1-slave-of-eth0" too.
2011-11-17 18:05:35 -06:00
Evan Broder
9f86b44a52 ifupdown: fix build 2011-11-17 16:24:56 -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
Jiří Klimeš
7b7e426b65 settings: pass config file name to settings plugins
Thus plugins will use the correct configuration file, even in case the name
is specified on command line with --config.
2011-11-16 08:56:29 +01:00
Thomas Graf
a2b1afb1e4 bonding: prefix bonding connections with "Bond" and append slave suffix
Moves the logic of naming connections into its own function. Allows each
connection type to provide a "hard" prefix which will always be used.
Bonding uses this to prefix all bonding connections with "Bond".

If a DEVICE= line is available, append it to the end of connection name
for easier identification of the real device behind it.

Appends the suffix "[slave-of <MASTER>]" to all connections which are
configured as a slave of a bond.

Examples:

  myName                  -> myName (eth0)
  System eth0             -> System eth0
  myName2                 -> Bond myName2 (bond0)
  System bond0            -> Bond bond0
  myName                  -> myName (eth0) [slave-of bond0]
  System eth0             -> System eth0 [slave-of bond0]

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-14 18:37:37 -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
Thomas Graf
a2a0d78818 bonding: settings parser for ifcfg plugin + NMSettingBond class
Introduced a new TYPE=bond for ifcfg-rh configuration files.
Alternatively BONDING_MASTER=yes can be specified instead of
setting the type explicitely to maintain backwards compatibility
with existing configuration files.

Bonding device files require a DEVICE= line to be present which
specifies the virtual bonding interface in the kernel. We do not
allow auto-generation of the name in order to keep confusion to
a minimum when reusing existing bonding interfaces.

The BONDING_OPTS= parameter can be used to specify various bonding
related options, such as:
  - mode
  - miimon
  - updelay
  - downdelay
  - arp_interval
  - arp_ip_target

By default, the NMSettingBond class uses a miimon value of 100 which
seems like a sensible default value for 99% of all configurations.
If this is not suitable, an arp_ip_target needs to be specified
manually.

A writer is not yet implemented.

Changes v2:
 - renamed DeviceName property to InterfaceName
 - moved code to validate device name to dev_valid_name() for future use

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:16:31 -06:00
Jiri Popelka
3e11682ddc ifcfg-rh: read/write zone name from/to ZONE key 2011-11-09 21:40:13 -06:00
Florian Echtler
2938243e25 keyfile: call correct scheme function when writing certificates (bgo #662836) 2011-11-01 16:32:51 +01:00
Dan Williams
d8437ffaf1 core: fix deprecated usage of g_value_[get|set]_char() (bgo #662694) 2011-10-28 11:35:59 -05:00
Jiří Klimeš
2e872d8e93 keyfile: add another testcase for intlist-like SSID (bgo #660232) 2011-10-18 17:01:17 +02:00
Jiří Klimeš
50e329a92f keyfile: fix reading/writing SSIDs for all cases (bgo #660232)
Even with the previous fix some cases were still undistinguishable. For example,SSID like '11;12;' is both valid an intlist and a string.
So this commit:
- escapes ';' character with '\' when writing, and removes '\' while reading
  This clearly differentiates between intlist x strings.
- changes regex pattern to allow spaces before ';' in intlist format
2011-10-18 16:13:39 +02:00
Dan Williams
965d5860ab keyfile: fix reading intlist-like SSIDs (ie "101") (lp:874328)
Intlists have to end with a ';' since that's how they are written
out, and that's the only way we can actually distinguish between
intlist SSIDs and string SSIDs, really.
2011-10-14 11:33:14 -05:00
Dan Williams
65bcc4719a keyfile: add testcase for intlist-like SSID (lp:874328) 2011-10-14 11:17:12 -05:00
Jiří Klimeš
3049511f47 ifcfg-rh: fix changing WPA connections to WEP
When connection was changed with the editor from WPA to WEP, KEY_MGMT was
not cleared. This resulted in infinite loop of ifcfg plugin under some
circumstances ("Available to all users" unchecked, I think).
The re-read connection was regarded as WPA and thus it differed from the
stored one.
2011-10-11 18:10:26 +02:00
Thomas Jarosch
5bbafdc632 ifnet: fix possible use of uninitialized variable
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2011-10-05 12:41:52 -05:00
Thomas Jarosch
d7ad91d1b4 ifcfg-rh: use correct g_free() function
Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>

(dcbw: fix more occurances)
2011-10-05 12:40:01 -05:00
Jiří Klimeš
dce6a071a8 ifcfg-rh: don't use spaces in ifcfg file names (rh #742273) 2011-10-03 10:30:50 +02:00
Thomas Graf
00f2b0a9bb core: Include <linux/if.h> instead of <net/if.h>
NM already includes <linux/if.h> in some places, f.e. nm-netlink-monitor and
we can't mix usage of the two. Stick to using <linux/if.h> as it provides
additional flag definitions such as operational link state and link mode.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-09-30 00:18:24 -05:00
Dan Williams
156f403f31 keyfile: fix confusion about NULL termination for uchar arrays
SSIDs don't want NULL termination, but some of the certificate code
checked for it.  New-style plain strings would never be NULL
terminated (by accident) so fix that and make the code simpler too.

Found by Gary Ching-Pang Lin <chingpang@gmail.com>
2011-09-29 23:52:17 -05:00
Jiří Klimeš
1c767dd541 fcfg-rh: remove newlines when writing to ifcfg files (CVE-2011-3364) (rh #737338) 2011-09-27 09:26:40 +02:00
Jiří Klimeš
f44959890b ifcfg-rh: change iscsiadm path to /sbin/iscsiadm (rh #740753)
Using SBINDIR appears to be wrong as it expands to /usr/sbin.
2011-09-26 15:51:49 +02:00
Dan Williams
f082e243c6 ifcfg-rh: fix crash when system bus isn't around 2011-09-19 17:38:58 -05:00
Jiří Klimeš
f3d4cd385e keyfile: fix two bugs for updating/writting a keyfile
* When a connection name (ID) was changed via nm-connection-editor, a new file
  path was created, but the old one was not removed. That resulted in two files
  and in turn in duplicated connections.
* When two connections with the same name (ID) were present, e.g. files ABC and
  ABC-70656842-98ac-4221-aa8b-0d4174770, and nm-connection-editor was used to
  edit ABC-70656842-98ac-4221-aa8b-0d4174770, the operation failed.
2011-09-12 18:41:59 +02:00
Jiří Klimeš
4bb50e4380 ifnet: add testcase for incorrect config
Missing config_<name> line (containing method, i.e. dhcp, ...) should
fail with error 'Unknown config for <name>'.
2011-09-01 11:29:32 +02:00
Jiří Klimeš
9f026283c6 ifnet: fix tests 2011-08-31 19:05:21 +02:00
Jiří Klimeš
379d9044fb ifnet: fix GError handling in ifnet_update_connection_from_config_block() 2011-08-31 17:27:27 +02:00
Jiří Klimeš
adc7ec170d ifcfg-rh: make NM_CONTROLLED changes function properly (rh #727501)
Changing NM_CONTROLED from "no" to "yes" worked just the first time.
Fix that by storing unmanaged spec when interface becomes unmanaged
and adjust condition identifying "no-change" updates to the ifcfg
file.
2011-08-02 12:18:52 +02:00
Jiří Klimeš
312c7c952c ifcfg-rh: emit "updated" signal when connection file is changed (rh #727501)
Chain up to parent's commit_changes() even if in-memory and on-disk data are the
same; they are the same when another process changes the on-disk file. Just make
sure not to write out the data needlessly when same.

This fixes a regression caused by 9cba854fa0.
It exhibits e.g. by not auto-activating connection when ONBOOT is changed from
"no" to "yes". Connection "updated" signal was not emitted and listeners like
NMPolicy was not prodded.
2011-08-02 12:18:43 +02:00
Dan Williams
9cdc5021ab keyfile: fix integer list SSID parsing after 30c41a4b80
The regex was capturing integers larger than 3 digits, which aren't
valid SSID integer list items because each byte of the SSID cannot be
larger than 255.  Add an explicit testcase for intlist SSIDs too.
The previous regex was causing a testcase failure with an SSID of
'1337' which it was interpreting as a single element intlist, but
should have been interpreted as a string since it's clear > 255.
2011-07-20 17:44:14 -05:00
Dan Williams
ba390d2430 ifcfg-rh: add testcase for PEAP anonymous identity (rh #708436) 2011-07-18 22:40:45 -05:00
Jiří Klimeš
3c0bf572c4 ifcfg-rh: read IEEE_8021X_ANON_IDENTITY for PEAP too (rh #708436) 2011-07-15 11:28:27 +02:00
Jiří Klimeš
30c41a4b80 keyfile: distinguish better between string x int list formats (bgo #649422)
This commit enhances get_uchar_array() to better differentiate between string
ad integer list formats. This allows using ';' character in SSIDs.
2011-07-07 15:25:11 +02:00
Jiří Klimeš
2f421bc779 keyfile: correct a warning message 2011-07-07 14:50:35 +02:00
Dan Williams
8e929b1e1b ifcfg-rh: fix for three-digit prefixes
The regex only caught prefixes up to 99; anything over that was
truncated to two digits.
2011-07-05 23:27:50 -05:00
Dan Williams
50867cc461 ifcfg-rh: don't try to set a prefix of 0
It's not a valid prefix since NM determines the default routes
automatically, and thus routes and addresses with a prefix of
zero should not be used in config files.
2011-07-05 23:17:14 -05:00