Commit Graph

790 Commits

Author SHA1 Message Date
Tom Gundersen 7ae4ef6d23 sd-dhcp-client: refactor DNS support
Rather than keeping an array of pointers to addresses, just keep an array of addresses.
2014-01-16 20:32:08 +01:00
Tom Gundersen 1346b1f038 sd-dhcp-client/networkd: add transient hostname support 2014-01-16 20:32:08 +01:00
Tom Gundersen 6fc7349894 networkd: dhcp - only set the MTU option once
Only set MTU request when creating the dhcp client, not every time it is restarted.
2014-01-16 20:32:08 +01:00
Tom Gundersen 396945dc1f networkd: link - only save original MTU when necessary 2014-01-16 20:32:08 +01:00
Tom Gundersen 1f6d9bc9ee networkd: improve logging 2014-01-16 20:32:08 +01:00
Tom Gundersen 4f882b2a50 sd-dhcp-client/networkd: add interface MTU support 2014-01-16 01:44:19 +01:00
Tom Gundersen 5be4d38e31 networkd: DHCPv4 - allow opting out of using DNS servers
Setting UseDNS=no will ignore any received DNS servers.
2014-01-13 21:54:57 +01:00
Tom Gundersen 3bef724f7e networkd: generate resolv.conf
This adds support to generate a basic resolv.conf in /run/systemd/network.
This file will not take any effect unless a symlink is created from
/etc/resolv.conf.

Nameservers received over DHCP takes precedence over statically configured ones.

Note: /etc/resolv.conf is severely limited, so in the future we will likely
rather provide a much more powerfull nss plugin (or something to that effect),
but this should allow current users to function without any loss of
functionality.
2014-01-12 15:37:21 +01:00
Tom Gundersen ab47d620b4 networkd: improve logging a bit 2014-01-12 15:37:21 +01:00
Zbigniew Jędrzejewski-Szmek 39032b8777 network: use GNU-ism to simplify macros
Thanks David!
2014-01-11 10:07:22 -05:00
Zbigniew Jędrzejewski-Szmek 628706137e networkd: print the received DHCPv4 address and gateway
It seems that networkd stores in_addr.s_addr contents in reverse
order (little-endian, not network order). This is a bit confusing,
but sd_rtnl evidently likes this order.
2014-01-08 22:15:27 -05:00
Zbigniew Jędrzejewski-Szmek 3333d748fa networkd: use structured logging for links and bridges 2014-01-08 22:15:27 -05:00
Tom Gundersen aa3437a573 networkd: print the ifindex of added links
This debug information may be useful when comapring to dropped rtnetlink messages.
2014-01-03 18:20:11 +01:00
Tom Gundersen 2672953bde networkd: improve logging
This gives a bit better messages when a link is added twice.
2014-01-03 16:56:09 +01:00
Tom Gundersen efbc88b8ed networkd: improve link state change logging 2014-01-03 16:20:10 +01:00
Tom Gundersen ff25413852 networkd: link - explicitly set the link to be up if the call to IFF_UP succeeds
No need to wait for the NEWLINK message to arrive.
2014-01-03 02:18:55 +01:00
Tom Gundersen b1b532f58c networkd: dhcp - avoid null pointer dereference 2014-01-03 01:42:26 +01:00
Tom Gundersen 1746cf2ad7 networkd: add more asserts and ignore all events when link has failed 2014-01-03 01:42:26 +01:00
Tom Gundersen 06a6e59301 networkd: only track state of links we are managing
If a network is not (yet) set for a link, we do not care about its state (as we
anyway don't know what to do with it).
2014-01-02 15:56:10 +01:00
Tom Gundersen 449f755492 networkd: improve logging
Remove redundant messages, add some debugging ones and make wording more uniform.
2014-01-02 15:49:23 +01:00
Kay Sievers be9326ca1d networkd: fix NULL pointer deref 2014-01-02 05:16:14 +01:00
Tom Gundersen 5eb036ca53 networkd: fix getting initial state
We were requesting the state and then ignoring it...
2014-01-02 01:43:05 +01:00
Tom Gundersen f5be560181 networkd: add DHCPv4 support
This adds basic DHCPv4 support. Link-sense is enabled unconditionally,
but the plan is to make that configurable.

I tested this in a VM with lots of NICs and over wifi in the various
coffee shops I found this Christmas, but more testing would definitely
be appreciated.
2014-01-01 16:26:27 +01:00
Tom Gundersen f048a16b46 networkd: distinguish between static and dynamic addresses/routes
Static addresses/routes are associated with a network. Dynamic
addresses/routes are associtade with links (as the corresponding network
may be shared by several links).
2014-01-01 16:23:00 +01:00
Tom Gundersen ef1ba6065c networkd: link - remove useless states
Rework the state-machine a bit.
2013-12-17 22:08:12 +01:00
Tom Gundersen 22936833e1 networkd: rename link_update_flags to link_update
We are likely to track more than the flags in the future.
2013-12-17 22:08:12 +01:00
Tom Gundersen b0d27a2508 networkd: correct logging message 2013-12-17 09:24:57 +01:00
Tom Gundersen 0f49a5f751 network: use SETLINK to bring up interfaces 2013-12-16 17:28:19 +01:00
Tom Gundersen fc25d7f805 rtnl: simplify link_new()
Drop most of the arguments and instead introduce link_set_{flags,type}.
2013-12-16 17:28:18 +01:00
Tom Gundersen dd3efc0993 networkd: add link-sense and simplify state-machine a bit
This listens to rtnetlink for changes to IFF_UP and IFF_LOWER_UP (link sense). The latter
is simply logged at the moment, but will be useful once we add dhcp support.
2013-12-04 14:15:13 +01:00
Tom Gundersen 02b59d57e0 networkd: add bridge support
A bridge is specified in a .netdev file with a section [Bridge]
and at least the entry Name=.

A link may be joined to a bridge if the .network applied to it has
a Bridge= entry giving the name of the bridge in its [Network] section.

We eagerly create all bridges on startup, and links are added to
bridges as soon as they both appear.
2013-11-26 01:32:25 +01:00
Tom Gundersen c166a07055 networkd: minor fixes
In particular, store the ifname, though we should only use it carefully, as
it is not guaranteed to be stable. Using it for logging is fine though.
2013-11-26 01:32:25 +01:00
Dave Reisner a9bc6d2df1 networkd: use correct printf formatter
uint64_t can be formatted correctly with %ju, rather than casting to
unsigned and potentially losing accuracy.
2013-11-25 18:19:49 -05:00
Tom Gundersen 5a3eb5a77d networkd: make sure Network and Link can always be freed
Also, don't fail a link just because we can't find its MAC address.
2013-11-21 21:04:04 +01:00
Tom Gundersen 602cc437e8 networkd: avoid segfault 2013-11-21 20:48:06 +01:00
Tom Gundersen 0617ffabe8 networkd: make sure Links and Networks are freed 2013-11-19 14:39:19 +01:00
Tom Gundersen f882c247ad networkd: make all calls async 2013-11-17 23:12:27 +01:00
Tom Gundersen 8cd11a0f0f networkd: store netmask and mac address explicitly 2013-11-17 23:11:11 +01:00
Tom Gundersen fe4824e065 rtnl: rename rtnl_bus_send_with_reply_and_block() to rtnl_bus_call()
Follow the equivalent rename in sd-bus to stay as similar as possible.
2013-11-13 19:48:44 +01:00
Tom Gundersen f579559b3a networkd: add a basic network daemon
This daemon listens for and configures network devices tagged with
'systemd-networkd'. By default, no devices are tagged so this daemon
can safely run in parallel with existing network daemons/scripts.

Networks are configured in /etc/systemd/network/*.network. The first .network
file that matches a given link is applied. The matching logic is similar to
the one for .link files, but additionally supports matching on interface name.

The mid-term aim is to provide an alternative to ad-hoc scripts currently used
in initrd's and for wired setups that don't change much (e.g., as seen on
servers/and some embedded systems).

Currently, static addresses and a gateway can be configured.

Example .network file:

[Match]
Name=wlp2s0

[Network]
Description=My Network
Gateway=192.168.1.1
Address=192.168.1.23/24
Address=fe80::9aee:94ff:fe3f:c618/64
2013-11-09 23:41:17 +01:00