Commit graph

138 commits

Author SHA1 Message Date
Tom Gundersen 16cd414ba0 networkd: log - only log about udev initalization on debug level 2014-05-17 20:51:37 +02:00
Tom Gundersen 428fd0a758 networkd: keep list of active addresses 2014-05-17 20:51:37 +02:00
Tom Gundersen 3c4cb0645c networkd: log the initialization status of links 2014-05-16 14:52:02 +02:00
Tom Gundersen 3d3d425547 networkd: rename Address and Route list fields 2014-05-16 14:52:02 +02:00
Tom Gundersen 987efa17dd networkd: logging - align messages 2014-05-15 18:16:31 +02:00
Tom Gundersen 5261692fe5 networkd: log ifindices when links and netdevs are added 2014-05-15 18:16:31 +02:00
Tom Gundersen af4e9e2c56 networkd: rename NetDev variable for consistency with Link 2014-05-15 18:15:21 +02:00
Zbigniew Jędrzejewski-Szmek 5ea846cc51 networkd, build-sys: spelling fix 2014-05-15 15:29:59 +02:00
Lennart Poettering 19befb2d5f sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and
creates proper object for unregistering callbacks.

Taking the refernce to the slot is optional. If not taken life time of
the slot will be bound to the underlying bus object (or in the case of
an async call until the reply has been recieved).
2014-05-15 01:15:30 +02:00
Susant Sahani 7951dea209 networkd: introduce ipip tunnel
This patch enables basic ipip tunnel support.
It works with kernel module ipip

example conf:

file: ipip.netdev

[NetDev]
Name=ipip-tun
Kind=ipip
MTUBytes=1480

[Tunnel]
Local=192.168.223.238
Remote=192.169.224.239
TTL=64

file: ipip.network

[Match]
Name=em1

[Network]
Tunnel=ipip-tun

[tomegun:
         - drop unused variable
         - take ref when enslaving]
2014-05-12 17:37:12 +02:00
Tom Gundersen fbbeb65a93 networkd: get preexiting addresses when a link is added 2014-05-11 14:26:10 +02:00
Tom Gundersen 389cc5f743 networkd: link - redo flag change logging
Make the logging less verbose by only printing all the changed flags on one line,
at the same time make it more complete by supporting all flags currently supported
by the kernel.

We still fall back to printing the raw flags in case we get something we do not recognize
This may be useful when running on new kernels.
2014-05-10 20:56:37 +02:00
Tom Gundersen b90b025af1 networkd: link - don't log errors when missing routes/addresses are dropped
We were ignoring the wrong errno.
2014-05-09 14:41:27 +02:00
Tom Gundersen 7619683b46 networkd: link - handle links coming back to life
When enslaving devices, we may receieve DELLINK/NEWLINK for the same ifindex,
let's not be confused by this.
2014-05-09 14:41:27 +02:00
Tom Gundersen d9c67ea112 networkd: reorder bonding and bridging
A link should only ever be part of one, but if we accidentally do both, let's do it
in the right order so the failure is more obvious in the logs.
2014-05-09 14:41:27 +02:00
Tom Gundersen 370e9930c3 networkd: link - introduce LINGER state and link_drop()
We need the LINGER state in case we still have references to the link after it has been dropped.
2014-05-09 14:41:27 +02:00
Tom Gundersen b226d99b04 networkd: link - take refcounts on links
We need to take a refcount on the link whenever we expect a callback. The exceptions
are the ipv4ll/dhcp clients as their lifetimes are guaranteed to be shorter than that
of the link.
2014-05-09 14:41:27 +02:00
Tom Gundersen 14b746f721 networkd: introduce refcounting for Links and NetDevs 2014-05-09 14:41:27 +02:00
Tom Gundersen 68a8723c85 networkd: link - clean up state files
Also keep the path to the lease file around rather than regenarating it all the time.
2014-05-09 14:41:27 +02:00
Tom Gundersen bbf7c04821 sd-network: expose global operational state 2014-05-08 17:21:37 +02:00
Tom Gundersen 75adc2189b networkd: link - operstate is an enum, not a bitmask 2014-05-08 15:27:55 +02:00
Tom Gundersen 99b4cc3e75 networkd: link - always maintain link operstate regardless of admin state 2014-05-07 16:54:02 +02:00
Tom Gundersen deb2e5230b sd-network: expose both admin and operational state directly
Also add a call to check if a link is loopback, as this should commonly be ignored.
2014-05-07 16:54:02 +02:00
Umut Tezduyar Lindskog 8ddbeaa23c networkd: dont configure route if lease doesn't have one 2014-04-30 00:05:28 +02:00
Tom Gundersen 9b86b3930a networkd: link - don't fail a link if RF kill is active 2014-04-28 00:16:46 +02:00
Umut Tezduyar Lindskog d96e629fd7 networkd: do not complain about IFF_RUNNING
Otherwise:
eth0: unknown link flags gained: 0x00040 (ignoring)

[tomegun: hiding these messages is ok, as IFF_RUNNING is redundant
          and can be deduced from operstate and IFF_LOWER_UP]
2014-04-27 23:36:30 +02:00
Tom Gundersen 3a67e927e3 networkd-wait-online: improve interoptability and enable by default
To make sure we don't delay boot on systems where (some) network links are managed by someone else
we don't block if something else has successfully brought up a link.

We will still block until all links we are aware of that are  managed by networkd have been
configured, but if no such links exist, and someone else have configured a link sufficiently
that it has a carrier, it may be that the link is ready so we should no longer block.

Note that in all likelyhood the link is not ready (no addresses/routes configured),
so whatever network managment daemon configured it should provide a similar wait-online
service to block network-online.target until it is ready.

The aim is to block as long as we know networking is not fully configured, but no longer. This
will allow systemd-networkd-wait-online.service to be enabled on any system, even if we don't
know whether networkd is the main/only network manager.

Even in the case networking is fully configured by networkd, the default behavior may not be
sufficient: if two links need to be configured, but the first is fully configured before the
second one appears we will assume the network is up. To work around that, we allow specifying
specific devices to wait for before considering the network up.

This unit is enabled by default, just like systemd-networkd, but will only be pulled in if
anyone pulls in network-online.target.
2014-04-24 00:23:07 +02:00
Thomas Hindoe Paaboel Andersen cc544d5fb4 networkd: link - add missing curly brackets
introduced in 1e9be60bba
2014-04-22 21:45:17 +02:00
Tom Gundersen df9aa406e8 networkd: link - reduce default verbosity a bit 2014-04-22 21:06:00 +02:00
Tom Gundersen 1e9be60bba networkd: link - support IFLA_OPERSTATE
This properly detects the state of the link based on both the link flags and the
operstate.

Moreover, always log state-changes even if we are not yet managing the link.
2014-04-22 21:06:00 +02:00
Tom Gundersen 45ad2c1328 networkd: link - don't react to successfull link up
Avoid having two code-paths racing with eacother to do the same thing. The change
of flags will be detected in the normal way, so only use the link_up_handler
to detect if the 'up' failed and in that case fail the link.
2014-04-22 21:06:00 +02:00
Tom Gundersen 124fa2c601 networkd: link - log when starting clients fail 2014-04-22 21:06:00 +02:00
Tom Gundersen 2139694e82 networkd: link - avoid cycle when failing 2014-04-22 21:06:00 +02:00
Tom Gundersen 111bb8f93a networkd: link - stop clients when failing 2014-04-22 21:06:00 +02:00
Tom Gundersen 57bd6899b3 networkd: link - add explicit unmanaged state 2014-04-20 19:54:35 +02:00
Tom Gundersen 4bb40e8125 networkd: link - set mac addresses when starting clients
MAC addreses are also set when NEWLINK messages are receieved, but only if the clients have
already been initialized.
2014-04-20 19:34:53 +02:00
Tom Gundersen c6a1eb79a5 networkd: link - log changes in some common link flags 2014-04-20 19:20:26 +02:00
Tom Gundersen 75ee87c8c6 networkd: link - use IFF_DORMANT instead of IFF_RUNNING
Should be no functional change, but avoids spurious log
messages when in operstate UNKNOWN and !IFF_LOWER_UP.
2014-04-20 18:02:15 +02:00
Tom Gundersen 069e10a0e0 networkd: link - make debug logging a bit more readable
Drop leading zeros which will never be used when printing the link flags.
2014-04-20 14:42:57 +02:00
Tom Gundersen b8941f74c8 networkd: link - track interface renames 2014-04-19 20:39:29 +02:00
Tom Gundersen 505f8da732 networkd: tie links to rtnl rather than udev
This essentially swaps the roles of rtnl and udev in networkd. After this
change libudev is only used for waiting for udev to initialize devices and
to get udev-specific information needed for some [Match] attributes.

This in particular simplifies the code in containers where udev is not really
useful, but also simplifies things and reduces round-trips in the non-container
case.
2014-04-19 18:41:58 +02:00
Tom Gundersen 3379e257ee networkd: link - make state changing logging a bit less verbose 2014-04-14 17:55:47 +02:00
Tom Gundersen e9189a1f56 networkd: link - ignore missing MAC address from NEWLINK message
The kernel may broadcast such messages, simply discard them.
2014-04-14 17:53:01 +02:00
Tom Gundersen 7cc832b91e networkd: link - require both RUNNING and LOWER_UP before using link
Usually RUNNING implies LOWER_UP, but for drivers that don't support oper state, RUNNING can
also mean that the state is unknown. In that case we should just trust LOWER_UP directly.
2014-04-12 12:48:12 +02:00
Tom Gundersen ffba61663a networkd: wait for IFF_RUNNING rather than IFF_LOWER_UP
The interface is not fully ready until it enterns RUNNING. This was causing
problems with sending out DHCP messages before the interface was ready, so they
would get lost. In particular this affected DHCP INIT-REBOOT, as it relies on
the first package sent being successful (or it will fall back to a full reboot).

Also improve the logging a lot, to make future debugging of link state a lot
easier.
2014-04-12 12:06:28 +02:00
Tom Gundersen 702807365e networkd: add an assert
This error should never happen, so replace the check with an assert. The check
was anyway broken due to an uninitialized return value.

Reported by Thomas Hindoe Paaboel Andersen <phomes@gmail.com>.
2014-04-11 23:57:18 +02:00
Patrik Flykt 56cd007ab8 sd-ipv4ll: Add reference counting for IPv4LL
Similar to DHCP, the IPv4LL library user can decide to free the LL
client any time the callback is called. Guard against freeing the
LL client in the callback by introducing proper reference counting.

Also update code using the IPv4LL library to properly handle a
returned NULL from the notify and stop functions if the IPv4LL
client was freed.
2014-04-11 10:53:52 +03:00
Patrik Flykt e5b04c8de8 sd-dhcp-client: Add reference counting for DHCP
The DHCP library user can decide to free the DHCP client any time
the callback is called. After the callback has been called, other
computations may still be needed - the best example being a full
restart of the DHCP procedure in case of lease expiry.

Fix this by introducing proper reference counting. Properly handle
a returned NULL from the notify and stop functions if the DHCP
client was freed.
2014-04-11 10:53:10 +03:00
Tom Gundersen 7ff8f4b53c networkd: guard against NULL pointers
This should never be a problem, but better be safe than sorry.
2014-04-08 21:26:19 +02:00
Umut Tezduyar Lindskog aba496a58a networkd: smooth transition from ipv4ll to dhcp address
Currently when both ipv4ll and dhcp are enabled, ipv4ll
address (if one has been claimed) is removed when dhcp
address is aquired. This is not the best thing to do
since there might be clients unaware of the removal
trying to communicate.

This patch provides a smooth transition between ipv4ll
and dhcp. If ipv4ll address was claimed [1] before dhcp,
address is marked as deprecated. Deprecated address is still
a valid address and packets can be received on it but address
cannot be selected as a source address. If dhcp lease cannot
be extended, then ipv4ll address is marked as valid again.

[1] If there is no collision, claiming IPv4LL takes between 4 to
7 seconds.
2014-04-03 16:00:25 +02:00