Commit graph

40 commits

Author SHA1 Message Date
Thomas Graf
3ef7bca6fa bonding: apply bonding settings when setting up bonding device
Adds a new function nm_system_apply_bonding_config() which applies
the parameters specified in the NMSettingBond object via sysfs.

Calls that function after creating/updating the bonding master
device.

If a parameter is not specified in the ifcfg the parameter will be
re-initialized to the default value. This may overwrite changes
which have been done manually via sysfs but it is the only reliable
way of setting up the bond.

Supported parameters for now:
 - mode (default: balance-rr)
 - miimon (default: 100)
 - updelay (default: 0)
 - downdelay (default: 0)
 - arp_interval (default: 0)
 - arp_ip_target (default: none)

Thomas Graf <tgraf@redhat.com>
2011-11-09 23:24:04 -06:00
Thomas Graf
d839e1c817 core: convert nm_system_get_link_type() to return an int
Kills the strdup() and avoids having the caller free the memory. Also renames
the function to nm_system_get_iface_type() since "link" is not a common term
in NM.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:24:04 -06:00
Thomas Graf
b496355b2a bonding: enslave/release bonding slaves in activation/deactivation
Code is written generic enough to allow easy addition of further master/slave
relationships such as bridging relations.

Signed-off-by: Thomas Graf <tgraf@redhat.com>

(whitespace cleanups and libnl compat by dcbw)
2011-11-09 23:24:04 -06:00
Thomas Graf
8d5af59812 bonding: detect virtual bonding devices and create an ethernet device
A bonding device is like a virtual ethernet device. We therefore reuse
nm-device-ethernet and add some special handling to detect bonding
connections.

Changes v2:
 - Fixed memory leak

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:16:31 -06:00
Thomas Graf
095aff0c21 bonding: kernel bonding device creation
Creates virtual kernel devices as needed. Since the manager is
initialized after the connections have been loaded no
CONNECTIONS_ADDED notification is received for connections parsed
at startup.

Therefore walks the loaded connections looking for bonding
connections.

Connections added on the fly are handled via the notifications.

Connection renaming and deleting is not supported yet.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
2011-11-09 23:16:31 -06:00
Dan Williams
6e92c1b606 core: fix leaked return value of nm_netlink_index_to_iface()
This function now returns allocated strings, so we need to make
sure we free them.
2011-10-18 15:28:26 -05: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
Thomas Graf
74349dcdc3 core: Fix leaks if address parsing fails while setting mac
Both 'old' and 'new' are leaked if nl_addr_build() fails to parse
the mac address.
2011-09-13 00:08:30 -05:00
Thomas Graf
360143e42f core: fix leaked address structure after parsing mac address 2011-09-13 00:08:30 -05:00
Alfredo Matos
07cc83fbdb libnl: Move to common route add function interface 2011-08-16 17:16:02 -05:00
Alfredo Matos
2e32003fd2 libnl3: Fix ESRCH return types
ESRCH becomes NLE_OBJ_NOTFOUND. Includes workaround for libnl
  aliased return value where ESRCH is being converted to a generic
  unspecified error by libnl [1].

  [1] http://git.kernel.org/?p=libs/netlink/libnl.git;a=commit;h=7e9d5f
2011-08-16 16:58:19 -05:00
Dan Williams
b562839df8 core: misc style fixes to libnl compat code 2011-07-30 15:47:39 -05:00
Alfredo Matos
a6c6556831 core: add libnl-2 support with libnl-1 compatibility 2011-07-30 15:47:26 -05:00
Dan Williams
73ddc1e307 core: move route creation to nm-netlink-utils.c 2011-07-22 18:10:28 -05:00
Dan Williams
11c2824ef1 core: remove dead libnl code 2011-07-22 18:09:37 -05:00
Dan Williams
abb89a7d2a core: move route iteration to nm-netlink-utils.c 2011-07-22 18:09:32 -05:00
Dan Williams
7461e33ce1 core: move route logging to nm-netlink-utils.c 2011-07-22 16:17:10 -05:00
Dan Williams
8b075fcdf2 core: move route deletion to nm-netlink-utils.c 2011-07-22 16:12:44 -05:00
Dan Williams
2fabdbff15 core: finish conversion of nm-system functions to ifindex not iface name 2011-07-22 14:24:18 -05:00
Dan Williams
efb5735ad1 core: more conversion to ifindex instead of iface 2011-07-22 14:09:16 -05:00
Dan Williams
c742cc83fd core: convert up/down check to netlink and use interface index not iface 2011-07-22 13:49:49 -05:00
Dan Williams
d2d1f2e9e0 core: use interface indexes more 2011-07-22 13:37:29 -05:00
Dan Williams
5e21728e59 core: suppress error messages if addresses/routes already exist 2011-04-05 10:19:08 -05:00
Dan Williams
e050f44ab6 core: flush IPv6 routes even if configuration failed (bgo #641333)
If configuration fails, there won't be an IPv6 config for the device,
thus the route flush when deactivating the device if it fails would
only flush IPv4 routes.  We don't know how far through IPv6 setup
we got, so we do want to flush IPv6 routes on deactivate if we
started IPv6 config at any point.
2011-02-23 17:20:19 -06:00
Dan Williams
03517015cc core: check address family, not route family 2010-10-07 12:09:17 -05:00
Dan Williams
9b2b809aae core: rename NMNamedManager -> NMDnsManager 2010-09-07 22:08:18 -05:00
Dan Williams
17f630d433 ip6: handle DHCPv6 initial routing better
DHCPv6 doesn't really use broadcast; instead clients use reserved
multicast addresses to talk to the server.  ff02::1:2 (link scope)
and ff05::1:3 (site scope) are used.  This means the routing table
has to have a route that can handle outgoing traffic to these
addresses, which is ff00::/8.  The kernel sometimes adds one for us,
so we need to (a) make sure we don't tear that route down, and
(b) that if it's not there before we start DHCPv6, that we add it.

Otherwise dhclient complains about not being able to send outgoing
traffic from it's send_packet6() function with "no route to host".
It will then use an expired lease, which causes NM to assign that
leases IP address to the interface, whcih causes the kernel to
assign the required ff00::/8 route, and then dhclient performs a
renew (since the expired lease has expired of course) and then
everything works out in the end.  But the latency sucks.

So make DHCPv6 faster by ensuring that dhclient has the routes
it needs before we start the DHCP session.
2010-08-10 21:37:47 -05:00
Dan Williams
4e1eb09fed core: quiet annoying libnl error about route deletion (rh #612991) 2010-08-03 17:07:38 -07:00
Jiří Klimeš
1b49f941a6 core: MAC address spoofing/cloning (rh #447827) (bgo #553771)
This commit implements MAC cloning feature in NetworkManager. To support that,
'PermHwAddress' property is added into *.Device.Wired and *.Device.Wireless
interfaces. The permanent MAC address is obtained when creating the device, and
is used for 'locking' connections to the device. If a cloned MAC is specified
in connection to be activated, the MAC is set to the interface in stage1. While
disconecting, the permanent MAC is set back to the interface.
2010-06-22 14:21:25 +02:00
Dan Williams
17b49b957c ip6: don't flush link-local IPv6 routes (rh #587836)
Since a link-local address should pretty much always be
assigned to an active interface, avoid flushing the routes
that allow link-local communication to work.
2010-05-04 20:24:17 -07:00
Dan Williams
1c5236029c core: pass ifindex and address family when flushing routes
Use the interfaces kernel index when we can to avoid unecessary
iface->index lookups; and let callers figure out which address
family they really want to flush.
2010-05-04 20:23:09 -07:00
Dan Williams
dd699c585f core: better logging for interface address syncing 2010-05-03 02:11:59 -07:00
Dan Williams
32b255e128 trivial: remove some debugging leftovers 2010-05-02 00:32:26 -07:00
Dan Williams
28d2c5592b dhcp: ensure getting DHCP IP config fails if the client died early
If the client never delivered any options to NM, make sure we don't
return a valid IP config object to callers when they request one.
2010-05-02 00:24:50 -07:00
Dan Williams
11a6225aac ip6: correctly handle routes with no gateways
For these we don't need to set any gateway at all, and the kernel
assumes that it's a default route without a next hop.
2010-04-26 14:06:58 -07:00
Dan Williams
e218092d62 core: first pass of IPv6 routing and DNS update on IP config change
Mostly the same as the IPv4 bits; dupe them for IPv6.  A lot of
duplicated code, but it's hard to consolidate.
2010-04-23 22:11:22 -07:00
Dan Williams
34793c1fb1 core: use ifindex instead of interface name in a lot of places
Where we can do so, let's use ifindex since that's actually unique
and doesn't change when the interface name changes.  We already use
ifindex in a bunch of places, and netlink *only* uses ifindex, so
this will make it easier later when we move over to ifindexes fully.
2010-04-21 14:58:25 -07:00
Dan Williams
87c6e5db76 netlink: merge nm-netlink.c into nm-netlink-monitor.c 2010-04-20 17:22:58 -07:00
Dan Williams
4e828c1bce system: update logging 2010-04-07 13:10:33 -07:00
Dan Williams
9e627d1bce trivial: rename some CamelCase source files to not-camel-case 2010-03-02 15:06:14 -08:00
Renamed from src/NetworkManagerSystem.c (Browse further)