summaryrefslogtreecommitdiff
path: root/src/libsystemd-network
Commit message (Collapse)AuthorAgeFilesLines
* network: support matching based on wifi interfece typeYu Watanabe2019-10-252-0/+26
|
* sd-dhcp-client: do not call assert in public functionsassert-cleanups-and-constificationZbigniew Jędrzejewski-Szmek2019-10-241-5/+5
|
* sd-dhcp-client: remove unnecessary cleanup functionZbigniew Jędrzejewski-Szmek2019-10-241-5/+2
| | | | https://github.com/systemd/systemd/pull/13663#discussion_r335327099
* Merge pull request #13142 from yuwata/network-wifi-ssid-support-nl80211Zbigniew Jędrzejewski-Szmek2019-10-232-2/+16
|\ | | | | network: wifi ssid support with nl80211
| * network: add support matching based on BSSID=Yu Watanabe2019-10-152-2/+9
| |
| * network: support matching based on wifi SSIDYu Watanabe2019-10-152-2/+9
| |
* | network: DHCPv4 client: add support to send arbitary option and dataSusant Sahani2019-10-153-0/+84
|/
* Merge pull request #13696 from keszybz/keep-dhcp-on-restartZbigniew Jędrzejewski-Szmek2019-10-031-36/+28
|\ | | | | Add a way to differentiate restart from stop and keep dhcp config on restart
| * sd-dhcp-client: do not crash if sd_dhcp_client_send_release() is called with ↵Zbigniew Jędrzejewski-Szmek2019-10-021-0/+1
| | | | | | | | | | | | | | | | no lease Again, a public function should not crash if called at an inopportune moment. Also, make sure we don't call the function if we have no lease.
| * sd-dhcp-client: merge client_send_release() into sd_dhcp_client_send_release()Zbigniew Jędrzejewski-Szmek2019-10-021-36/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The public function and the implementation were split into two for no particular reason. We would assert() on the internal state of the client. This should not be done in a function that is directly called from a public function. (I.e., we should not crash if the public function is called at the wrong time.) assert() is changed to assert_return(). And before anyone asks: I put the assert_returns() *above* the internal variables on purpose. This makes it easier to see that the assert_returns() are about the state that is passed in, and if they are not satisfied, the function returns immediately. The compiler doesn't care either way, so the ordering that is clearest to the reader should be chosen.
* | network: DHCPv6 client add support for prefix delegation hintSusant Sahani2019-10-013-10/+37
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for prefix hint lenth and prefix hint address ``` Frame 43: 177 bytes on wire (1416 bits), 177 bytes captured (1416 bits) on interface 0 Ethernet II, Src: f6:c1:08:4d:45:f1 (f6:c1:08:4d:45:f1), Dst: IPv6mcast_01:00:02 (33:33:00:01:00:02) Internet Protocol Version 6, Src: fe80::d250:c82:7f6e:28d6, Dst: ff02::1:2 User Datagram Protocol, Src Port: 546, Dst Port: 547 DHCPv6 Message type: Solicit (1) Transaction ID: 0x5c7902 Rapid Commit Identity Association for Non-temporary Address Fully Qualified Domain Name Identity Association for Prefix Delegation Option: Identity Association for Prefix Delegation (25) Length: 41 Value: 1b97b1690000000000000000001a0019ffffffffffffffff… IAID: 1b97b169 T1: 0 T2: 0 IA Prefix Option: IA Prefix (26) Length: 25 Value: ffffffffffffffff3c000000000000000000000000000000… Preferred lifetime: infinity Valid lifetime: infinity Prefix length: 60 Prefix address: :: Option Request Client Identifier Elapsed time ```
* dhcp4: make IPServiceType configurableSiddharth Chandrasekara2019-09-266-11/+28
| | | | | | | | | | IPServiceType set to CS6 (network control) causes problems on some old network setups that continue to interpret the field as IP TOS. Make DHCP work on such networks by allowing this field to be set to CS4 (Realtime) instead, as this maps to IPTOS_LOWDELAY. Signed-off-by: Siddharth Chandrasekaran <csiddharth@vmware.com>
* Merge pull request #11883 from yuwata/network-dhcp-renewYu Watanabe2019-09-221-4/+14
|\ | | | | network: dhcp renew
| * dhcp: introduce sd_dhcp_client_send_renew()Yu Watanabe2019-07-181-0/+11
| |
| * dhcp: fix minor coding style issueYu Watanabe2019-07-181-4/+3
| |
* | Merge pull request #13605 from cdown/onoChris Down2019-09-201-1/+1
|\ \ | | | | | | Fixes for recent SIP work
| * | dhcp: Log SIP server information correctlyChris Down2019-09-201-1/+1
| | |
* | | sd-radv: if lifetime < SD_RADV_DEFAULT_MAX_TIMEOUT_USEC, adjust timeout (#13491)Georg Müller2019-09-201-0/+11
|/ / | | | | | | | | | | | | | | | | | | | | The RFC states that lifetime (AdvDefaultLifetime) must be at least MaxRtrAdvInterval (which more or less corresponds to SD_RADV_DEFAULT_MAX_TIMEOUT_USEC in systemd). To fulfill this limit, virtually lower MaxRtrAdvInterval and MinRtrAdvInterval accordingly. Also check that min is not lower than 3s and max is not lower than 4s.
* | network: DHCP server Add support to transmit SIP serverSusant Sahani2019-09-205-2/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. DHCP server trasmit 2. Client parses and saves in leases Implements http://www.rfc-editor.org/rfc/rfc3361.txt ``` Frame 134: 348 bytes on wire (2784 bits), 348 bytes captured (2784 bits) on interface 0 Ethernet II, Src: 42:65:85:d6:4e:32 (42:65:85:d6:4e:32), Dst: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) Internet Protocol Version 4, Src: 192.168.5.1, Dst: 192.168.5.11 User Datagram Protocol, Src Port: 67, Dst Port: 68 Dynamic Host Configuration Protocol (ACK) Message type: Boot Reply (2) Hardware type: Ethernet (0x01) Hardware address length: 6 Hops: 0 Transaction ID: 0x7cc87cb4 Seconds elapsed: 0 Bootp flags: 0x0000 (Unicast) Client IP address: 0.0.0.0 Your (client) IP address: 192.168.5.11 Next server IP address: 0.0.0.0 Relay agent IP address: 0.0.0.0 Client MAC address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) Client hardware address padding: 00000000000000000000 Server host name not given Boot file name not given Magic cookie: DHCP Option: (53) DHCP Message Type (ACK) Length: 1 DHCP: ACK (5) Option: (51) IP Address Lease Time Length: 4 IP Address Lease Time: (3600s) 1 hour Option: (1) Subnet Mask (255.255.255.0) Length: 4 Subnet Mask: 255.255.255.0 Option: (3) Router Length: 4 Router: 192.168.5.1 Option: (6) Domain Name Server Length: 4 Domain Name Server: 192.168.5.1 Option: (42) Network Time Protocol Servers Length: 4 Network Time Protocol Server: 192.168.1.1 Option: (120) SIP Servers <=====here Length: 9 SIP Server Encoding: IPv4 Address (1) SIP Server Address: 192.168.1.1 SIP Server Address: 192.168.5.2 Option: (101) TCode Length: 13 TZ TCode: Europe/Berlin Option: (54) DHCP Server Identifier (192.168.5.1) Length: 4 DHCP Server Identifier: 192.168.5.1 Option: (255) End Option End: 255 ``` ``` cat /run/systemd/netif/state  ✔  ⚡  3148  16:40:51 OPER_STATE=routable CARRIER_STATE=carrier ADDRESS_STATE=routable DNS=192.168.94.2 192.168.5.1 NTP=192.168.5.1 SIP=192.168.1.1 192.168.5.2 ``` aa
* | dhcp6: use unaligned_read_be32()Yu Watanabe2019-09-201-1/+1
| | | | | | | | Closes #13591.
* | dhcp6: add missing option length checkYu Watanabe2019-09-171-2/+5
| | | | | | | | Closes #13578.
* | Merge pull request #13559 from ssahani/ipv6ra-routeYu Watanabe2019-09-182-2/+154
|\ \ | | | | | | network: make networkd able to advertise IPv6 routes on links
| * | network: Add support to advertie ipv6 routeSusant Sahani2019-09-172-2/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements https://tools.ietf.org/html/rfc4191 cat veth99.network ``` [Match] Name=veth99 [Network] DHCP=no IPv6PrefixDelegation=yes Address=2001:db8:0:1::1/64 [IPv6Prefix] Prefix=2001:db8:0:1::4/64 [IPv6RoutePrefix] Route=2001:db0:fff::/48 ``` Wireshark ``` Frame 481: 142 bytes on wire (1136 bits), 142 bytes captured (1136 bits) on interface 0 Ethernet II, Src: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4), Dst: IPv6mcast_01 (33:33:00:00:00:01) Internet Protocol Version 6, Src: fe80::1c04:f8ff:feb8:2fd4, Dst: ff02::1 Internet Control Message Protocol v6 Type: Router Advertisement (134) Code: 0 Checksum: 0xec77 [correct] [Checksum Status: Good] Cur hop limit: 0 Flags: 0x00, Prf (Default Router Preference): Medium Router lifetime (s): 0 Reachable time (ms): 0 Retrans timer (ms): 0 ICMPv6 Option (Source link-layer address : 1e:04:f8:b8:2f:d4) Type: Source link-layer address (1) Length: 1 (8 bytes) Link-layer address: 1e:04:f8:b8:2f:d4 (1e:04:f8:b8:2f:d4) ICMPv6 Option (MTU : 1500) Type: MTU (5) Length: 1 (8 bytes) Reserved MTU: 1500 ICMPv6 Option (Prefix information : 2001:db8:0:1::4/64) Type: Prefix information (3) Length: 4 (32 bytes) Prefix Length: 64 Flag: 0xc0, On-link flag(L), Autonomous address-configuration flag(A) Valid Lifetime: 2592000 Preferred Lifetime: 604800 Reserved Prefix: 2001:db8:0:1::4 ICMPv6 Option (Route Information : Medium 2001:db0:fff::/48) Type: Route Information (24) Length: 3 (24 bytes) Prefix Length: 48 Flag: 0x00, Route Preference: Medium ...0 0... = Route Preference: Medium (0) 000. .000 = Reserved: 0 Route Lifetime: 604800 Prefix: 2001:db0:fff:: ```
* | | ndisc: make first solicit delayed randomlyYu Watanabe2019-09-161-1/+1
| | | | | | | | | | | | Closes #13460.
* | | dhcp6: read OPTION_INFORMATION_REFRESH_TIME optionYu Watanabe2019-09-161-1/+20
|/ / | | | | | | Fixes #13460.
* | Revert "shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE ↵Zbigniew Jędrzejewski-Szmek2019-08-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | → EXTRACT_UNQUOTE" This reverts commit 8a07b4033e5d3c86931b3dd2ddbca41118c05c60. The tests are kept. test-networkd-conf is adjusted to pass. This fixes #13276. I think current rules are extremely confusing, as the case in test-networkd-conf shows. We apply some kinds of unescaping (relating to quoting), but not others (related to escaping of special characters). But fixing this is hard, because people have adjusted quoting to match our rules, and if we make the rules "better", things might break in unexpected places.
* | libsystemd-network: make option_append() atomic and make the code a bit clearerZbigniew Jędrzejewski-Szmek2019-08-031-27/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Comparisons are done in the normal order (if (need > available), not if (available < need)), variables have reduced scope and are renamed for clarity. The only functional change is that if we return -ENAMETOOLONG, we do that without modifying the options[] array. I also added an explanatory comment. The use of one offset to point into three buffers is not obvious. Coverity (in CID#1402354) says that sname might be accessed at bad offset, but I cannot see this happening. We check for available space before writing anything.
* | tree-wide: drop netinet/ether.h from socket-util.h and sd-netlink.hYu Watanabe2019-07-245-1/+6
|/
* Merge pull request #13093 from keszybz/two-assert-cc-cleanupsFrantisek Sumsal2019-07-171-1/+1
|\ | | | | Two assert_cc cleanups
| * Drop trailing slash from assert_cc() definitionZbigniew Jędrzejewski-Szmek2019-07-171-1/+1
| | | | | | | | | | | | We use assert_cc(...); almost everywhere. Let's always require that. https://github.com/systemd/systemd/issues/12997#issuecomment-510103988
* | shared/conf-parser,networkd: EXTRACT_UNQUOTE|EXTRACT_RETAIN_ESCAPE → ↵Zbigniew Jędrzejewski-Szmek2019-07-171-1/+1
|/ | | | | | | | | | | | | EXTRACT_UNQUOTE It's hard to even say what exactly this combination means. Escaping is necessary when quoting to have quotes within the string. So the escaping of quote characters is inherently tied to quoting. When unquoting, it seems natural to remove escaping which was done for the quoting purposes. But with both flags we would be expected to re-add this escaping after unqouting? Or maybe keep the escaping which is not necessary for quoting but otherwise present? This all seems too complicated, let's just forbid such usage and always fully unescape when unquoting.
* Merge pull request #12926 from keszybz/urlify-logsLennart Poettering2019-07-118-9/+9
|\ | | | | Urlify CONFIG_FILE and improve SYSTEMD_LOG_LOCATION
| * tree-wide: use PROJECT_FILE instead of __FILE__Zbigniew Jędrzejewski-Szmek2019-07-048-9/+9
| | | | | | | | This replaces the internal uses of __FILE__ with the new macro.
* | dhcp: replace strerror() with %mYu Watanabe2019-07-052-13/+5
| |
* | network,udev: add Property= setting in [Match] sectionYu Watanabe2019-07-012-0/+99
| | | | | | | | Closes #5665.
* | network,udev: make net_match_config() take sd_deviceYu Watanabe2019-07-012-6/+16
| |
* | network,udev: fix multiple invert matching linesYu Watanabe2019-07-012-27/+102
|/ | | | | | | | | | Previously, ``` [Match] Name=!aaa Name=!bbb ``` does not work. This fixes the issue.
* dhcp: use memdup_suffix0() instead of strndup()Yu Watanabe2019-06-191-1/+1
|
* dhcp: fix comparison with previous leaseYu Watanabe2019-06-181-5/+20
| | | | | | Follow-up for f8862395e8f802e4106a07ceaaf02b6a1faa5a6d. Fixes #12816.
* udev: introduce NAMING_STABLE_VIRTUAL_MACS (retroactively)Zbigniew Jędrzejewski-Szmek2019-06-172-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is for 6d3646406560. It turns out that this is causing more problems than expected. Let's retroactively introduce naming scheme v241 to conditionalize this change. Follow-up for #12792 and 6d36464065601f7. See also https://bugzilla.suse.com/show_bug.cgi?id=1136600. $ SYSTEMD_LOG_LEVEL=debug NET_NAMING_SCHEME=v240 build/udevadm test-builtin net_setup_link /sys/class/net/br11 $ SYSTEMD_LOG_LEVEL=debug NET_NAMING_SCHEME=v241 build/udevadm test-builtin net_setup_link /sys/class/net/br11 ... @@ -20,11 +20,13 @@ link_config: could not set ethtool features for br11 Could not set offload features of br11: Operation not permitted br11: Device has name_assign_type=3 -Using interface naming scheme 'v240'. +Using interface naming scheme 'v241'. br11: Policy *keep*: keeping existing userspace name br11: Device has addr_assign_type=1 -br11: No stable identifying information found -br11: Could not generate persistent MAC: No data available +br11: Using "br11" as stable identifying information +br11: Using generated persistent MAC address +Could not set Alias=, MACAddress= or MTU= on br11: Operation not permitted +br11: Could not apply link config, ignoring: Operation not permitted Unload module index Unloaded link configuration context. ID_NET_DRIVER=bridge
* libsystemd-network: rename net_get_name() to net_get_name_persistent()Zbigniew Jędrzejewski-Szmek2019-06-173-6/+6
| | | | | | | This reflect its role better. (I didn't use …_persistent_name(), because which name is actually used depends on the policy. So it's better not to make this sound like it returns *the* persistent name.)
* dhcp4: use memdup_suffix0() instead of strndup() for binary dataYu Watanabe2019-05-301-1/+1
| | | | | | C.f. ac0a94f7438b49a0890d9806db1fa211a5bca10a. Fixes #12693.
* networkd: DHCP client add support to send RELEASE packetSusant Sahani2019-05-141-3/+46
| | | | closes #10820
* networkd: Add support for blacklisting serversSusant Sahani2019-05-102-5/+12
| | | | | | closes #6260 fuzzer: Add DHCP support for blacklisting servers
* Merge pull request #12475 from yuwata/network-fix-12452Zbigniew Jędrzejewski-Szmek2019-05-071-0/+1
|\ | | | | network: add network_ref/_unref() and make Link object take a reference of Network object
| * sd-radv: fix memleakYu Watanabe2019-05-071-0/+1
| | | | | | | | Fixes one memleak found in #12452.
* | networkd: Allow DHCP4 client to set the number to attempt to reconfigure.Susant Sahani2019-05-071-11/+17
| | | | | | | | Otherwise current value is 6 and after 6 it will give up.
* | sd-dhcp: store number of trial in sd_dhcp_client::attemptYu Watanabe2019-05-071-10/+9
|/ | | | Calling 2^n as attempt is misleading.
* networkd: Option to use LinkLocalAddressing only when DHCP failsSusant Sahani2019-05-041-4/+8
| | | | | | | When LinkLocalAddressing=fallback or LinkLocalAddressing=ipv4-fallback then IPv4LL will be started only when DHCP fails. Closes #9648.
* Merge pull request #12420 from mrc0mmand/coccinelle-tweaksLennart Poettering2019-04-301-1/+1
|\ | | | | Coccinelle improvements