Commit graph

361 commits

Author SHA1 Message Date
Tom Gundersen c9e738b911 networkd: bridge - use USEC_PER_MSEC macros
Lennart said:
> We have these nice USEC_PER_MSEC-style macro definitions which make it a
> little bit clearer what we are converting here from what into
> what... please use that instead of writing "1000"...
>
> (we stole those from gstreamer btw)
2014-07-21 20:54:09 +02:00
Susant Sahani d9c52fa045 networkd: add support for bond options
The following bond options are supported by this patch.

MIIMonitorSec:
Specifies the frequency in milli-seconds that MII link
monitoring will occur.

UpDelaySec:
Specifies the delay time in milli-seconds to enable a link
after a link up status has been detected.

DownDelaySec:
Specifies the delay time in milli-seconds to disable a link
after a link failure has been detected.

changes:
1. Added gconf variables.
2. man page

conf:

[NetDev]
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad
TransmitHashPolicy=layer2+3
LacpduTransmitRate=fast
MIIMonitorSec=1s
UpDelaySec=2s
DownDelaySec=8s

cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2+3 (2)
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 2000
Down Delay (ms): 8000

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
bond bond1 has no active aggregator

[tomegun: rephrased manpage, dropped bond_ prefix from variables]
2014-07-21 20:35:21 +02:00
Susant Sahani fb1021a26d networkd: bond add support for lacp rate
LacpduTransmitRate
option specifies the rate in which link partner to transmit
LACPDU packets in 802.3ad mode.  Possible values
slow : Request partner to transmit LACPDUs every 30 seconds
fast : Request partner to transmit LACPDUs every 1 second
The default is slow.

chages:
1. Added enum bond_lacp_rate_table
2. gperf LacpduTransmitRate

Test:
conf file:
[NetDev]
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad
LacpduTransmitRate=fast

test:
cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2+3 (2)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
bond bond1 has no active aggregator

[tomegun: renamed from LacpduTransmitRate to LACPTransmitRate, manpage fixes and
dropped bond_ prefix from variables]
2014-07-21 20:35:21 +02:00
Susant Sahani 227cdf2c7c networkd: add support for bond transmit hash policy
This patch adds support  the transmit hash policy to use
for slave selection in balance-xor, 802.3ad, and tlb modes

layer2, layer3+4, layer2+3, encap3+4, encap3+4

Added:
1. BondXmitHashPolicy
2. conf param TransmitHashPolicy

Test conf:
[NetDev]
Name=bond1
Kind=bond

[Bond]
Mode=802.3ad
TransmitHashPolicy=layer2+3

test output:
cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2+3 (2)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
bond bond1 has no active aggregator

[tomegun: dropped bond_ prefix from new Bond variable, drop repeated man-page section]
2014-07-21 20:35:21 +02:00
Tom Gundersen aa9f114058 networkd: netdev - split NetDev struct into per-kind structs
Similarly to how unit types work.
2014-07-21 13:32:27 +02:00
Tom Gundersen 653912918f sd-network: drop get_ifindices
People should use rtnl for this, and then only query sd-network by the ifindices it finds.
2014-07-21 13:32:27 +02:00
Lennart Poettering 0dd25fb9f0 change type for address family to "int"
Let's settle on a single type for all address family values, even if
UNIX is very inconsitent on the precise type otherwise. Given that
socket() is the primary entrypoint for the sockets API, and that uses
"int", and "int" is relatively simple and generic, we settle on "int"
for this.
2014-07-18 16:10:51 +02:00
Tom Gundersen d243773263 networkd-wait-online: fix comilation warning
sd_rtnl_message_read_string() was changed to take a const argument, update the users.
2014-07-18 13:25:18 +02:00
Lennart Poettering ca4e095ab9 sd-rtnl: make string returned by sd_rtnl_message_read_string() const 2014-07-18 12:38:32 +02:00
Tom Gundersen 6dcaa6f59a sd-network: fixup api
Do not expose link_is_loopback, people should just get this from rtnl directly.
Do not expose NTP servers as IP addresses, these must be strings.
Expose ifindex as int, not unsigned. This is what the kernel (mostly) and glibc uses.
2014-07-17 22:53:35 +02:00
Tom Gundersen 7de12ae764 networkd-wait-online: track links
Rather than refetching the link information on ever event, we liston to
rtnl to track them. Much code stolen from resolved.

This will allow us to simplify the sd-network api and don't expose
information available over rtnl.
2014-07-17 22:53:35 +02:00
Tom Gundersen 560852ced0 sd-network: expose 'unmanaged' as a regular state
This is useful to save in the consumer of the lib, unlike ENODATA/EBUSY which
means that the user should wait until a useful state is available.
2014-07-17 22:53:35 +02:00
Zbigniew Jędrzejewski-Szmek 6eb33ab207 networkd: fix colud typo
sztanpet> if your already there, might fixing "Colud" to Could in 53af3b7
2014-07-17 08:14:15 -04:00
Lennart Poettering 8b9652a711 sd-network: if a boolean is mising, we should just take it as false
That way, we can deprecate fields later on without problems
2014-07-17 01:42:26 +02:00
Lennart Poettering a2ba62c719 sd-network: remove redundant array size parameter from functions that return arrays
As long as the number of array entries is relatively small it's nicer to
simply return the number of entries directly, instead of using a size_t*
return parameter for it.
2014-07-17 01:42:26 +02:00
Lennart Poettering 0014a4ad50 sd-network: fix parameter order for sd_network_monitor_new()
Constructors should return the object they created as first parameter,
except when they are generated as a child/member object of some other
object in which case that should be first.
2014-07-17 01:41:52 +02:00
Zbigniew Jędrzejewski-Szmek 86bbe5bfbc test-tables: add new entries
One missing string found.

A few things had to be moved around to make it possible to test them.
2014-07-16 19:00:03 -04:00
Zbigniew Jędrzejewski-Szmek e46eab86cd tty-ask-password-agent: modernization 2014-07-16 19:00:03 -04:00
Zbigniew Jędrzejewski-Szmek ed88bcfb7c Be more careful when checking for empty files
If we want to avoid reading a totally empty file, it seems better
to check after we have opened the file, not before.
2014-07-16 19:00:03 -04:00
Zbigniew Jędrzejewski-Szmek 36f822c4bd Let config_parse open file where applicable
Special care is needed so that we get an error message if the
file failed to parse, but not when it is missing. To avoid duplicating
the same error check in every caller, add an additional 'warn' boolean
to tell config_parse whether a message should be issued.
This makes things both shorter and more robust wrt. to error reporting.
2014-07-16 18:47:20 -04:00
Zbigniew Jędrzejewski-Szmek e9f3d2d508 Constify ConfigTableItem tables 2014-07-15 22:34:40 -04:00
Thomas Hindoe Paaboel Andersen 337ede5693 networkd: remove unused variable 2014-07-15 20:38:49 +02:00
Tom Gundersen 53af3b7564 networkd: netdev - set mac for bond/bridge devicse
Suggested by poma.
2014-07-15 19:07:35 +02:00
Tom Gundersen f5de5b0020 sd-dhcp-client: make request broadcasts opt-in
It appears there is no good way to decide whether or not broadcasts should be enabled,
there is hardware that must have broadcast, and there are networks that only allow
unicast. So we give up and make this configurable.

By default, unicast is used, but if the kernel were to inform us abotu certain
interfaces requiring broadcast, we could change this to opt-in by default in
those cases.
2014-07-15 18:55:31 +02:00
Tom Gundersen 679b3605f0 networkd: link - fix memory leak
Make link_initialized() idempotent to avoid taking refs on several udev_device
objects.
2014-07-14 16:50:01 +02:00
Tom Gundersen 5347925a59 test: network - skip if we don't have permissions to create netdevs 2014-07-14 16:49:41 +02:00
Tom Gundersen 3be1d7e0c5 networkd: netdev - introduce vtable for netdev kinds
Split each netdev kind into its own .h/.c.
2014-07-14 16:49:41 +02:00
Tom Gundersen 2023dc8a9a networkd: netdev - rework load_one
We now:
 - parse config
 - match on environment
 - verify and complement config
 - create netdev
2014-07-14 16:47:04 +02:00
Tom Gundersen 6235b3def8 networkd: netdev - split out bridge creation 2014-07-14 16:47:04 +02:00
Tom Gundersen 3f26503776 networkd: netdev - rename 'enslave' to 'join'
Enslave only really makes sense when referring to bridges and bonds, so try to be
a bit more neutral.
2014-07-14 16:47:04 +02:00
Tom Gundersen dde2efef37 networkd: add back route destination support
This was accidentally dropped when adding metric support.
2014-07-14 12:14:23 +02:00
Tom Gundersen b621239e29 networkd: bond - explicitly map to kernel mode values 2014-07-14 12:13:45 +02:00
Susant Sahani edb85f0d8d networkd: dhcp add vendor class indentifier option 60
Vendor Class Identifier be used by DHCP clients to identify
their vendor type and configuration. When using this option,
vendors can define their own specific identifier values, such
as to convey a particular hardware or operating system
configuration or other identifying information.

Vendor-specified DHCP options—features that let administrators assign
separate options to clients with similar configuration requirements.
For example, if DHCP-aware clients for example we want to separate
different gateway and option for different set of people
(dev/test/hr/finance) in a org or devices for example web/database
servers or let's say in a embedded device etc and require a different
default gateway or DNS server than the rest of clients.
2014-07-14 11:39:20 +02:00
Susant Sahani 5d8e593dce networkd: make metric of routes configurable
Now route metric can be configuted via conf file:

example conf:

[Match]
Name=em1

[Route]
Gateway=192.168.1.12
Metric=10

Test:
ip route output
default via 192.168.1.12 dev em1 metric 10

[tomegun: squash TODO update and reword man page a bit]
2014-07-14 11:39:20 +02:00
Tom Gundersen 5bdd314cd9 networkd: return 1 from successful event handlers 2014-07-14 11:04:13 +02:00
Lennart Poettering 4faefc7ff8 networkd: always prefer dhcp routes over ipv4ll routes 2014-07-10 21:32:44 +02:00
Lennart Poettering 3b653205cf shared: split out in_addr related calls from socket-util.[ch] into its private in-addr-util.[ch]
These are enough calls for a new file, and they are sufficiently
different from the sockaddr-related calls, hence let's split this out.
2014-07-10 21:15:26 +02:00
Lennart Poettering 186fe1db20 networkd: simplify signal handling of SIGTERM/SIGINT
sd-event makes handling SIGTERM/SIGINT a lot easier than it used to,
let's make use of this
2014-07-07 23:11:03 +02:00
Susant Sahani fe8ac65b68 networkd: add support for mode
This patch adds supports networkd to configure bond mode
during creation via persistent conf. Mode can be configured
with conf param 'Mode'. A new section Bond is added to the
conf to support bond mode.

These modes can be configured now.

balance-rr
active-backup
balance-xor
broadcast
802.3ad
balance-tlb
balance-alb

Example conf file: test-bond.conf
[NetDev]
Name=bond1
Kind=bond

[Bond]
Mode=balance-xor

Test case:
1. start networkd service:

12: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc
noqueue state UNKNOWN mode DEFAULT group default
link/ether 22:89:6c:47:23:d2 brd ff:ff:ff:ff:ff:ff

2. find bond mode:

cat /proc/net/bonding/bond1
    Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
    Bonding Mode: load balancing (xor)
    Transmit Hash Policy: layer2 (0)
    MII Status: up
    MII Polling Interval (ms): 0
    Up Delay (ms): 0
    Down Delay (ms): 0

Changes:
       1. Added file networkd-bond.c
       2. Bond mode enum BondMode
       3. conf section [Bond]

[tomegun: whitespace]
2014-07-07 21:52:01 +02:00
Susant Sahani 948a6f8eb4 networkd veth: Make kind assert
It's more appropriate to make it's assert than -ENOTSUP
2014-07-07 21:49:14 +02:00
Tom Gundersen e04468dec0 networkd: netdev - add missing refs
Without this, the underlying device would get freed (and hence
fail).
2014-07-07 14:18:33 +02:00
Susant Sahani c081882f07 networkd: add support for peer address
This patch adds peer address support for
networkd . In the  [Address]  a new configurable
param is Peer.

[Match]
Name=ipip-tun

[Address]
Address=10.0.0.1/32
Peer=10.0.0.2/32
2014-07-07 13:32:14 +02:00
Steven Noonan c38d2eb828 networkd: accept section DHCP in systemd.network files 2014-07-04 11:34:43 +02:00
Tom Gundersen 4958aee497 networkd: properly track addresses when first added
When doing a NEWADDR, the reply we get back is the NEWADDR itself, rather
than just an empty ack (unlike how NEWLINK works). For this reason, the
process that did the NEWADDR does not get the broadcast message.

We were only listening for broadcast messages, and hence not tracking the
addresses we added ourselves. This went unnoticed as the kernel will usually
send NEWADDR messages from time to time anyway, so things would mostly work,
but in the worst case we would not notice that a routable address was available
and consider ourselves offline.
2014-07-03 22:55:05 +02:00
Tom Gundersen 393c0c5e64 networkd: link - improve link tracking logging 2014-07-03 22:55:05 +02:00
Tom Gundersen ffd488e272 networkd: tuntap - default to no packet information
Susant says:
> ip tuntap turns this off by default.

Let's follow ip(8) here as that should be the least surprising.
2014-07-03 12:19:26 +02:00
Susant Sahani 853284abdd networkd vxlan: Pass correct type
The group argument is a union. We need to
pass the correct type
2014-07-03 11:39:12 +02:00
Tom Gundersen 63dadd9075 networkd: tuntap - enable PacketInfo by default 2014-07-03 11:37:54 +02:00
Tom Gundersen 6ef892fc05 networkd: netdev - move tunnel address parsing to networkd-tunnel.c 2014-07-03 11:00:36 +02:00
Tom Gundersen 4826dd6850 networkd: tunnels - make tunnel address parsing generic
It had a bug in the typing, fix that and also make it save the address family so we
can print proper error messages.
2014-07-03 11:00:36 +02:00