Zbigniew Jędrzejewski-Szmek
00813316b0
sd-dhcp6: constify output arguments in get_{ntp,nds}_addr
...
This matches what we do for ipv4 and is in general better.
2020-05-26 09:47:45 +02:00
Zbigniew Jędrzejewski-Szmek
dddc8d1e1e
sd-network: reduce scope of some variables
2020-05-26 09:47:45 +02:00
Zbigniew Jędrzejewski-Szmek
2206aa5c35
sd-network: fix inverted error message
...
We get -ENOMSG when there is no lease.
2020-05-25 11:14:54 +02:00
Susant Sahani
1eb73422f2
network: Fix crash when SendOption= is invalid
...
```
p11-kit-0.23.20-1.fc32.x86_64 pam-1.3.1-26.fc33.x86_64 xz-libs-5.2.5-1.fc33.x86_64 zlib-1.2.11-21.fc32.x86_64
(gdb) bt
lvalue=0x560e10 "SendOption", ltype=2, rvalue=0x560e1b "11:string", data=0x561e20, userdata=0x561cd0) at ../src/network/networkd-dhcp-common.c:580
table=0x4392e0 <network_network_gperf_lookup>, section=0x560ef0 "DHCPv4", section_line=14, lvalue=0x560e10 "SendOption", rvalue=0x560e1b "11:string", flags=CONFIG_PARSE_WARN,
userdata=0x561cd0) at ../src/shared/conf-parser.c:132
lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, section=0x7fffffffc9f8, section_line=0x7fffffffc9a0,
section_ignored=0x7fffffffc99d, l=0x560e10 "SendOption", userdata=0x561cd0) at ../src/shared/conf-parser.c:270
lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:395
lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>, flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:452
dropin_dirname=0x7fffffffcbd0 "veth99.network.d", sections=0x4f3a18 "Match", lookup=0x7ffff7d2f76d <config_item_perf_lookup>, table=0x4392e0 <network_network_gperf_lookup>,
flags=CONFIG_PARSE_WARN, userdata=0x561cd0) at ../src/shared/conf-parser.c:511
(gdb) q
A debugging session is active.
Inferior 1 [process 118718] will be killed.
```
```
$ printf '[DHCPv4]\nSendOption=1:uint8' >crash
$ ./out/fuzz-network-parser ./crash
INFO: Seed: 1158717610
INFO: Loaded 2 modules (199728 inline 8-bit counters): 136668 [0x7faf3e91a930, 0x7faf3e93bf0c), 63060 [0xadf190, 0xaee7e4),
INFO: Loaded 2 PC tables (199728 PCs): 136668 [0x7faf3e93bf10,0x7faf3eb51cd0), 63060 [0xaee7e8,0xbe4d28),
./out/fuzz-network-parser: Running 1 inputs 1 time(s) each.
Running: ./crash
Assertion 's' failed at src/basic/parse-util.c:458, function int safe_atou8(const char *, uint8_t *)(). Aborting.
==5588== ERROR: libFuzzer: deadly signal
#0 0x51811e in __sanitizer_print_stack_trace (/home/vagrant/systemd/out/fuzz-network-parser+0x51811e)
#1 0x46b921 in fuzzer::PrintStackTrace() (/home/vagrant/systemd/out/fuzz-network-parser+0x46b921)
#2 0x44ded6 in fuzzer::Fuzzer::CrashCallback() (.part.0) (/home/vagrant/systemd/out/fuzz-network-parser+0x44ded6)
#3 0x44df9d in fuzzer::Fuzzer::StaticCrashSignalCallback() (/home/vagrant/systemd/out/fuzz-network-parser+0x44df9d)
#4 0x7faf3d6d7b1f (/lib64/libpthread.so.0+0x14b1f)
#5 0x7faf3d3c2624 in raise (/lib64/libc.so.6+0x3c624)
#6 0x7faf3d3ab8d8 in abort (/lib64/libc.so.6+0x258d8)
#7 0x7faf3e12593a in log_assert_failed_realm /home/vagrant/systemd/build/../src/basic/log.c:819:9
#8 0x7faf3e140ce1 in safe_atou8 /home/vagrant/systemd/build/../src/basic/parse-util.c:458:9
#9 0x68089c in config_parse_dhcp_send_option /home/vagrant/systemd/build/../src/network/networkd-dhcp-common.c:517:21
#10 0x7faf3debed4e in next_assignment /home/vagrant/systemd/build/../src/shared/conf-parser.c:132:32
#11 0x7faf3deb7783 in parse_line /home/vagrant/systemd/build/../src/shared/conf-parser.c:270:16
#12 0x7faf3deb606c in config_parse /home/vagrant/systemd/build/../src/shared/conf-parser.c:395:21
#13 0x7faf3deb85ee in config_parse_many_files /home/vagrant/systemd/build/../src/shared/conf-parser.c:452:21
#14 0x7faf3deb8c57 in config_parse_many /home/vagrant/systemd/build/../src/shared/conf-parser.c:511:16
#15 0x57c2eb in network_load_one /home/vagrant/systemd/build/../src/network/networkd-network.c:470:13
#16 0x543490 in LLVMFuzzerTestOneInput /home/vagrant/systemd/build/../src/network/fuzz-network-parser.c:26:16
#17 0x44e3e8 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-network-parser+0x44e3e8)
#18 0x433505 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/vagrant/systemd/out/fuzz-network-parser+0x433505)
#19 0x43c449 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/vagrant/systemd/out/fuzz-network-parser+0x43c449)
#20 0x42c4a6 in main (/home/vagrant/systemd/out/fuzz-network-parser+0x42c4a6)
#21 0x7faf3d3ad1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
#22 0x42c4fd in _start (/home/vagrant/systemd/out/fuzz-network-parser+0x42c4fd)
NOTE: libFuzzer has rudimentary signal handlers.
Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
```
2020-05-22 11:57:22 +02:00
Zbigniew Jędrzejewski-Szmek
929d07ddcb
Merge pull request #15274 from ssahani/network-issue-9610
...
DHCP4: Allow lease time to be set when missing from offer
2020-05-20 16:39:41 +02:00
Susant Sahani
ed0d1b2e99
network: DHCPv6 - Add support to send vendor class information
...
Frame 1: 177 bytes on wire (1416 bits), 177 bytes captured (1416 bits) on interface veth-peer, id 0
Ethernet II, Src: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4), Dst: IPv6mcast_01:00:02 (33:33:00:01:00:02)
Internet Protocol Version 6, Src: fe80::1c04:f8ff:feb8:2fd4, Dst: ff02::1:2
User Datagram Protocol, Src Port: 546, Dst Port: 547
DHCPv6
Message type: Solicit (1)
Transaction ID: 0x5ca46b
Rapid Commit
Identity Association for Non-temporary Address
Fully Qualified Domain Name
Vendor Class
Option: Vendor Class (16)
Length: 23
Value: 0000ab11000048656c6c6f3a686f773a6172653a796f75
Enterprise ID: Tom Gundersen (systemd) (43793)
vendor-class-data: Hello:how:are:you
Identity Association for Prefix Delegation
Option Request
Client Identifier
Elapsed time
2020-05-20 07:58:03 +02:00
Susant Sahani
d6463307e0
network: DHCPv4- Allow to set DHCP lease lifetime
2020-05-20 06:32:26 +02:00
Susant Sahani
ffed0205c7
DHCP: Use UINT8_MAX instead of 255
2020-05-19 11:48:37 +02:00
Susant Sahani
f37f2a6b8a
network: DHCPv6 - Add support to send user class
...
Frame 115: 171 bytes on wire (1368 bits), 171 bytes captured (1368 bits) on interface veth-peer, id 0
Ethernet II, Src: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4), Dst: IPv6mcast_01:00:02 (33:33:00:01:00:02)
Internet Protocol Version 6, Src: fe80::1c04:f8ff:feb8:2fd4, Dst: ff02::1:2
User Datagram Protocol, Src Port: 546, Dst Port: 547
DHCPv6
Message type: Solicit (1)
Transaction ID: 0x673257
Rapid Commit
Option: Rapid Commit (14)
Length: 0
Identity Association for Non-temporary Address
Option: Identity Association for Non-temporary Address (3)
Length: 12
Value: d0cc94090000000000000000
IAID: d0cc9409
T1: 0
T2: 0
Fully Qualified Domain Name
Option: Fully Qualified Domain Name (39)
Length: 6
Value: 01045a657573
0000 0... = Reserved: 0x00
.... .0.. = N bit: Server should perform DNS updates
.... ..0. = O bit: Server has not overridden client's S bit preference
.... ...1 = S bit: Server should perform forward DNS updates
Client FQDN: Zeus
User Class
Option: User Class (15)
Length: 17
Value: 000f68656c6c6f30313233343031323334
Identity Association for Prefix Delegation
Option: Identity Association for Prefix Delegation (25)
Length: 12
Value: d0cc94090000000000000000
IAID: d0cc9409
T1: 0
T2: 0
Option Request
Option: Option Request (6)
Length: 10
Value: 001700180038001f000e
Requested Option code: DNS recursive name server (23)
Requested Option code: Domain Search List (24)
Requested Option code: NTP Server (56)
Requested Option code: Simple Network Time Protocol Server (31)
Requested Option code: Rapid Commit (14)
Client Identifier
Option: Client Identifier (1)
Length: 14
Value: 00020000ab11d258482fc7eee651
DUID: 00020000ab11d258482fc7eee651
DUID Type: assigned by vendor based on Enterprise number (2)
Enterprise ID: Tom Gundersen (systemd) (43793)
Identifier: d258482fc7eee651
Elapsed time
Option: Elapsed time (8)
Length: 2
Value: 0bd0
Elapsed time: 30240ms
2020-05-19 11:48:30 +02:00
Lennart Poettering
201fa8f256
Merge pull request #15166 from ssahani/networkctl-ipvlan
...
networkctl: Add support to display ipvlan
2020-05-19 09:29:45 +02:00
Susant Sahani
851ef1ed56
networkctl: Add support to display ipvlan
...
```
build/networkctl status myipvlan1 ─╯
● 26: myipvlan1
Link File: /usr/lib/systemd/network/99-default.link
Network File: n/a
Type: ether
State: off (unmanaged)
Driver: ipvlan
HW Address: 4e:c5:88:28:c1:c0
MTU: 1500 (min: 68, max: 65535)
QDisc: noop
Mode: L2 (bridge)
Queue Length (Tx/Rx): 1/1
```
2020-05-18 19:07:04 +02:00
Zbigniew Jędrzejewski-Szmek
d7d892e694
Merge pull request #15494 from ssahani/dhcpv6-request-options
...
DHCPv6: Allow to add arbitrary request option
2020-05-18 13:14:36 +02:00
Susant Sahani
35f6a5cb44
network: DHCPv6 - Add support set arbitary request options
2020-05-17 11:18:29 +02:00
Susant Sahani
b55818fd12
networkctl: Use bond util common functions
2020-05-17 10:02:03 +02:00
Susant Sahani
5fe5908eed
network: Introduce bond util
2020-05-17 10:02:03 +02:00
Susant Sahani
22ae6c7d9a
networkctl: VXLan - display more properties
2020-05-17 09:54:25 +02:00
Susant Sahani
35072050e6
network: Introduce ipvlan util
...
Move ipvlan common to shared
2020-05-17 05:34:19 +02:00
Lennart Poettering
a0b191b705
condition: add ConditionEnvironment=
...
Prompted by the discussions in #15180 .
This is a bit more complex than I hoped, since for PID 1 we need to pass
in the synethetic environment block in we generate on demand.
2020-05-15 16:05:33 +02:00
Susant Sahani
89fe653544
network: Add support to group links.
...
Link groups are similar to port ranges found in managed switches.
You can add network interfaces to a numbered group and perform operations
on all the interfaces from that group at once.
2020-05-15 15:27:07 +02:00
Rubens Figueiredo
4df4df5b56
network: allow setting VLAN protocol on bridges
...
Signed-off-by: Rubens Figueiredo <rubens.figueiredo@bisdn.de>
2020-05-14 17:59:57 +02:00
Susant Sahani
cf217a0922
networkctl: Add support to display macvlan/macvtap mode
2020-05-14 17:35:56 +02:00
Susant Sahani
d51674806a
network: Introduce macvlan util
2020-05-14 17:35:56 +02:00
Benjamin Robin
243945e95e
test: Add return 0 to main() function (even it is not strictly necessary)
2020-05-13 22:56:42 +02:00
Benjamin Robin
b9c54c4665
tree-wide: Initialize _cleanup_ variables if needed
2020-05-13 22:56:42 +02:00
Andrew Doran
e7d5fe17db
DHCP client: make SendOption work for DHCPv6 too.
2020-05-11 16:31:08 +02:00
Marc-André Lureau
dd1d306058
network: fallback on resolved resolv.conf for DHCP server settings
2020-05-08 12:48:39 +02:00
Vito Caputo
5e55340ad4
Merge pull request #15681 from vcaputo/buslocator
...
*: switch to BusLocator-oriented helpers
2020-05-07 09:46:01 -07:00
Vito Caputo
8a048c8c42
network: switch to BusLocator-oriented helpers
...
Mechanical substitution reducing some verbosity
2020-05-07 08:46:44 -07:00
Zbigniew Jędrzejewski-Szmek
5cea17a177
Merge pull request #15635 from keszybz/set-put-strdup
...
Let set_put_strdup() allocate the set and related changes
2020-05-07 17:01:59 +02:00
Benjamin Robin
0a0e594a26
tree-wide: Mark as _unused_ variables that are only used in assert()
...
Allow to build without any warning with NDEBUG defined
2020-05-06 23:03:25 +02:00
Zbigniew Jędrzejewski-Szmek
be32732168
basic/set: let set_put_strdup() create the set with string hash ops
...
If we're using a set with _put_strdup(), most of the time we want to use
string hash ops on the set, and free the strings when done. This defines
the appropriate a new string_hash_ops_free structure to automatically free
the keys when removing the set, and makes set_put_strdup() and set_put_strdupv()
instantiate the set with those hash ops.
hashmap_put_strdup() was already doing something similar.
(It is OK to instantiate the set earlier, possibly with a different hash ops
structure. set_put_strdup() will then use the existing set. It is also OK
to call set_free_free() instead of set_free() on a set with
string_hash_ops_free, the effect is the same, we're just overriding the
override of the cleanup function.)
No functional change intended.
2020-05-06 16:54:06 +02:00
Lennart Poettering
b2cdefad3a
networkd: don't do lldp rx nor tx on bond devices
...
Fixes : #15146
2020-04-23 20:01:30 +02:00
Zbigniew Jędrzejewski-Szmek
73781de41f
Merge pull request #15530 from ssahani/lpr-dhcpv4-option-9
...
network: add support to DHCPv4 server/client option 9 LPR
2020-04-23 09:10:14 +02:00
Zbigniew Jędrzejewski-Szmek
1943d50e4e
Merge pull request #15507 from poettering/bus-log-api
...
add generic bus interface for setting log level that can be implemented by any daemon
2020-04-22 23:30:09 +02:00
Susant Sahani
828e653c48
networkctl: Add support to display LPR servers
2020-04-22 14:50:27 +02:00
Susant Sahani
d361b3730a
network: Add support send and receive LPR servers
2020-04-22 14:49:27 +02:00
Zbigniew Jędrzejewski-Szmek
2807b68019
Merge pull request #15520 from mrc0mmand/various-codebase-improvements
...
tree-wide: various codebase improvements
2020-04-22 08:41:38 +02:00
Frantisek Sumsal
86b52a3958
tree-wide: fix spelling errors
...
Based on a report from Fossies.org using Codespell.
Followup to #15436
2020-04-21 23:21:08 +02:00
Dan Streetman
244490f5e0
network: honor SetDNSRoutes= even if UseGateway=False
2020-04-21 17:15:07 -04:00
Dan Streetman
589397a277
network: change UseGateway= default to UseRoutes= setting
...
Anyone previously using the UseRoutes=false parameter expected their
dhcp4-provided gateway route to be ignored, as well. However, with
the introduction of the UseGateway= parameter, this is no longer true.
In order to keep backwards compatibility, this sets the UseGateway=
default value to whatever UseRoutes= has been set to.
2020-04-21 16:56:48 -04:00
Lennart Poettering
ac9f55ed40
tree-wide: implement new log control API dbus interface in all our daemons
2020-04-21 17:08:16 +02:00
Lennart Poettering
543d1e7854
Merge pull request #15314 from keszybz/network-server-access-functions
...
Define network server access functions
2020-04-21 09:24:48 +02:00
Zbigniew Jędrzejewski-Szmek
fac2166359
network: use "FooOverUDP" as one word
...
The whole thing is one name, and I think it's confusing to break it
up into separate words.
2020-04-16 17:23:41 +02:00
Zbigniew Jędrzejewski-Szmek
3d58d7328a
network: fix static assertion on IPPROTO_MAX range
...
Builds with recent glibc would fail with:
../src/network/netdev/fou-tunnel.c: In function ‘config_parse_ip_protocol’:
../src/basic/macro.h:380:9: error: static assertion failed: "IPPROTO_MAX-1 <= UINT8_MAX"
380 | static_assert(expr, #expr)
| ^~~~~~~~~~~~~
../src/network/netdev/fou-tunnel.c:161:9: note: in expansion of macro ‘assert_cc’
161 | assert_cc(IPPROTO_MAX-1 <= UINT8_MAX);
| ^~~~~~~~~
This is because f9ac84f92f151e07586c55e14ed628d493a5929d (present in
glibc-2.31.9000-9.fc33.x86_64) added IPPROTO_MPTCP=262, following
v5.5-rc5-1002-gfaf391c382 in the kernel.
2020-04-16 17:21:49 +02:00
Susant Sahani
ac24e418d9
network: Allow DHCPv6 client to be started even if no O or M bit in RA.
2020-04-16 09:32:19 +02:00
Susant Sahani
659f85a519
networkctl: Add support to display VXLan remote address
2020-04-11 16:12:42 +02:00
Susant Sahani
fc1d9c7b0c
network: VXLan - Add support for remote address
2020-04-11 06:11:51 +02:00
Zbigniew Jędrzejewski-Szmek
24e6f45842
network: use a loop for repetitive operation
...
This should hopefully help us avoid c&p mistakes. And there are plans to
add more settings like this, which should then be rather straightforward.
There is a slight functional change: the code got uplink handling wrong
and run manager_find_uplink() repeatedly. That part is fixed.
2020-04-10 17:57:31 +02:00
Zbigniew Jędrzejewski-Szmek
c1997a5bf7
network: add helper to extract server lists
...
This code is repeable enough to define a common implementation.
2020-04-10 17:57:19 +02:00
Zbigniew Jędrzejewski-Szmek
ddc026f303
network: define string lookup table for the DHCP info bits
2020-04-10 17:53:10 +02:00