Commit graph

26 commits

Author SHA1 Message Date
Vito Caputo 313cefa1d9 tree-wide: make ++/-- usage consistent WRT spacing
Throughout the tree there's spurious use of spaces separating ++ and --
operators from their respective operands.  Make ++ and -- operator
consistent with the majority of existing uses; discard the spaces.
2016-02-22 20:32:04 -08:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Thomas Hindoe Paaboel Andersen cf0fbc49e6 tree-wide: sort includes
Sort the includes accoding to the new coding style.
2015-11-16 22:09:36 +01:00
Susant Sahani 022833c897 bond: port to extract_first_word 2015-11-10 22:17:58 +05:30
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 8b43440b7e util-lib: move string table stuff into its own string-table.[ch] 2015-10-27 13:25:56 +01:00
Tom Gundersen 1e23792147 Merge pull request #1668 from ssahani/net1
networkd: fix asserts
2015-10-25 14:35:40 +01:00
Susant Sahani ae185f4857 bond: fix assert 2015-10-25 09:30:59 +05:30
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Lennart Poettering 12ca818ffd tree-wide: clean up log_syntax() usage
- Rely everywhere that we use abs() on the error code passed in anyway,
  thus don't need to explicitly negate what we pass in

- Never attach synthetic error number information to log messages. Only
  log about errors we *receive* with the error number we got there,
  don't log any synthetic error, that don#t even propagate, but just eat
  up.

- Be more careful with attaching exactly the error we get, instead of
  errno or unrelated errors randomly.

- Fix one occasion where the error number and line number got swapped.

- Make sure we never tape over OOM issues, or inability to resolve
  specifiers
2015-09-30 22:26:16 +02:00
Lennart Poettering ece174c543 tree-wide: drop {} from one-line if blocks
Patch via coccinelle.
2015-09-09 08:20:20 +02:00
David Herrmann dd906398dd sd-netlink: don't export internal type-system details
The kernel bonding layer allows passing an array of ARP IP targets as
bond-configuration. Due to the weird implementation of arrays in netlink
(which we haven't figure out a generic way to support, yet), we usually
hard-code the supported array-sizes. However, this should not be exported
from sd-netlink.

Instead, make sure the caller just uses it's current hack of enumerating
the types, and the sd-netlink core will have it's own list of supported
array-sizes (to be removed in future extensions, btw!). If either does not
match, we will just return a normal error.

Note that we provide 2 constants for ARP_IP_TARGETS_MAX now. However, both
have very different reasons:
 - the constant in netdev-bond.c is used to warn the user that the given
   number of targets might not be supported by the kernel (even though the
   kernel might increase that number at _any_ time)
 - the constant in sd-netlink is solely used due to us missing a proper
   array implementation. Once that's supported in the type-system, it can
   be removed without notice

Last but not least, this patch turns the log_error() into a log_warning().
Given that the previous condition was off-by-one, anyway, it never hit at
the right time. Thus, it was probably of no real use.
2015-06-24 13:46:15 +02:00
Tom Gundersen 1c4baffc18 sd-netlink: rename from sd-rtnl 2015-06-13 19:52:54 +02:00
Tom Gundersen 76f0a56790 networkd: bond - only set packets_per_slave on balance-rr mode
Otherwise the creation of the bond fails.
2015-06-10 19:39:02 +02:00
Susant Sahani a668086ec7 networkd: bond improve logging
Replaces a lof of strerror() usage with log_netdev_error_errno()
2015-06-10 11:57:28 +05:30
Susant Sahani 81bd37a85f networkd: Add support for bond option.
This patch adds configurational support for bond option.

Test conf:

bond.netdev

 ---
[NetDev]
Name=bond1
Kind=bond

[Bond]
ArpAllTargets=all
PrimaryReselect=better
ArpIntervalSec=10s
ArpIpTargets= 192.168.8.102 192.168.8.101 192.168.8.102
 ---

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

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
ARP Polling Interval (ms): 10000
ARP IP target/s (n.n.n.n form): 192.168.8.100, 192.168.8.101, 192.168.8.102
2015-04-20 20:14:34 +02:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Lennart Poettering 79008bddf6 log: rearrange log function naming
- Rename log_meta() → log_internal(), to follow naming scheme of most
  other log functions that are usually invoked through macros, but never
  directly.

- Rename log_info_object() to log_object_info(), simply because the
  object should be before any other parameters, to follow OO-style
  programming style.
2014-11-27 22:05:24 +01:00
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
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
Tom Gundersen 53af3b7564 networkd: netdev - set mac for bond/bridge devicse
Suggested by poma.
2014-07-15 19:07:35 +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
Renamed from src/network/networkd-bond.c (Browse further)