Compare commits

...

7 Commits

Author SHA1 Message Date
Susant Sahani 12ef8fb6f1 networkctl: Add more bridge properties 2020-03-24 10:08:48 +01:00
Zbigniew Jędrzejewski-Szmek 2e7d6d1d32
Merge pull request #15185 from ssahani/fix-sip-copy-paste
network: DHCP lease load SIP copy paste error
2020-03-24 10:03:57 +01:00
pelzvieh 137d448751 davfs is a network file system 2020-03-24 10:01:25 +01:00
Arusekk 71180f8e57 Fall back to kexec when no kexec binary exists
This may be not a popular setup, but in case kexec resides somewhere different
than the default location for KEXEC (`/usr/sbin/kexec`), don't just reboot and
try doing `reboot(RB_KEXEC)` instead, just like what `kexec -e` normally does.
2020-03-24 09:50:11 +01:00
Susant Sahani 1f807af6de networkctl: Add support to display SIP servers
```
❯ build/networkctl status veth99                                                                                                                                                           ─╯
● 17: veth99
                     Link File: /usr/lib/systemd/network/99-default.link
                  Network File: /usr/lib/systemd/network/veth99.network
                          Type: ether
                         State: routable (configured)
                        Driver: veth
                    HW Address: 1e:04:f8:b8:2f:d4
                           MTU: 1500 (min: 68, max: 65535)
                         QDisc: noqueue
  IPv6 Address Generation Mode: eui64
          Queue Length (Tx/Rx): 1/1
              Auto negotiation: no
                         Speed: 10Gbps
                        Duplex: full
                          Port: tp
                       Address: 192.168.5.35 (DHCP4)
                                fe80::1c04:f8ff:feb8:2fd4
                       Gateway: 192.168.5.1
                           DNS: 192.168.5.1
                           NTP: 192.168.5.1
                           SIP: 192.168.5.4
                                192.168.5.5
                     Time Zone: Europe/Berlin

Mar 21 23:26:32 Zeus systemd-networkd[671]: veth99: Link DOWN
Mar 21 23:26:32 Zeus systemd-networkd[671]: veth99: Lost carrier
Mar 22 10:25:35 Zeus systemd-networkd[671]: veth99: Link UP
Mar 22 10:25:35 Zeus systemd-networkd[671]: veth99: Gained carrier
Mar 22 10:25:36 Zeus systemd-networkd[671]: veth99: Gained IPv6LL
Mar 22 10:29:02 Zeus systemd-networkd[671]: veth99: Link DOWN
Mar 22 10:29:02 Zeus systemd-networkd[671]: veth99: Lost carrier
Mar 22 10:29:13 Zeus systemd-networkd[671]: veth99: Link UP
Mar 22 10:29:13 Zeus systemd-networkd[671]: veth99: Gained carrier
Mar 22 10:29:14 Zeus systemd-networkd[671]: veth99: Gained IPv6LL

```
2020-03-22 15:59:05 +01:00
Susant Sahani eb46288cca sd-network: Provice APIs to access SIP servers given by DHCP4 server 2020-03-22 10:39:23 +01:00
Susant Sahani be1af90585 network: DHCP lease load SIP copy paste error 2020-03-21 18:34:46 +01:00
6 changed files with 44 additions and 4 deletions

View File

@ -310,7 +310,8 @@ bool fstype_is_network(const char *fstype) {
"glusterfs", "glusterfs",
"pvfs2", /* OrangeFS */ "pvfs2", /* OrangeFS */
"ocfs2", "ocfs2",
"lustre"); "lustre",
"davfs");
} }
bool fstype_is_api_vfs(const char *fstype) { bool fstype_is_api_vfs(const char *fstype) {

View File

@ -1175,7 +1175,7 @@ int dhcp_lease_load(sd_dhcp_lease **ret, const char *lease_file) {
if (r < 0) if (r < 0)
log_debug_errno(r, "Failed to deserialize SIP servers %s, ignoring: %m", sip); log_debug_errno(r, "Failed to deserialize SIP servers %s, ignoring: %m", sip);
else else
lease->ntp_size = r; lease->sip_size = r;
} }
if (mtu) { if (mtu) {

View File

@ -240,6 +240,10 @@ _public_ int sd_network_link_get_ntp(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "NTP", ret); return network_link_get_strv(ifindex, "NTP", ret);
} }
_public_ int sd_network_link_get_sip(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "SIP", ret);
}
_public_ int sd_network_link_get_search_domains(int ifindex, char ***ret) { _public_ int sd_network_link_get_search_domains(int ifindex, char ***ret) {
return network_link_get_strv(ifindex, "DOMAINS", ret); return network_link_get_strv(ifindex, "DOMAINS", ret);
} }

View File

@ -7,6 +7,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <linux/if_bridge.h>
#include <linux/if_tunnel.h> #include <linux/if_tunnel.h>
#include "sd-bus.h" #include "sd-bus.h"
@ -145,8 +146,10 @@ typedef struct LinkInfo {
uint32_t max_age; uint32_t max_age;
uint32_t ageing_time; uint32_t ageing_time;
uint32_t stp_state; uint32_t stp_state;
uint32_t cost;
uint16_t priority; uint16_t priority;
uint8_t mcast_igmp_version; uint8_t mcast_igmp_version;
uint8_t port_state;
/* vxlan info */ /* vxlan info */
VxLanInfo vxlan_info; VxLanInfo vxlan_info;
@ -235,8 +238,10 @@ static int decode_netdev(sd_netlink_message *m, LinkInfo *info) {
(void) sd_netlink_message_read_u32(m, IFLA_BR_MAX_AGE, &info->max_age); (void) sd_netlink_message_read_u32(m, IFLA_BR_MAX_AGE, &info->max_age);
(void) sd_netlink_message_read_u32(m, IFLA_BR_AGEING_TIME, &info->ageing_time); (void) sd_netlink_message_read_u32(m, IFLA_BR_AGEING_TIME, &info->ageing_time);
(void) sd_netlink_message_read_u32(m, IFLA_BR_STP_STATE, &info->stp_state); (void) sd_netlink_message_read_u32(m, IFLA_BR_STP_STATE, &info->stp_state);
(void) sd_netlink_message_read_u32(m, IFLA_BRPORT_COST, &info->cost);
(void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority); (void) sd_netlink_message_read_u16(m, IFLA_BR_PRIORITY, &info->priority);
(void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version); (void) sd_netlink_message_read_u8(m, IFLA_BR_MCAST_IGMP_VERSION, &info->mcast_igmp_version);
(void) sd_netlink_message_read_u8(m, IFLA_BRPORT_STATE, &info->port_state);
} if (streq(received_kind, "bond")) { } if (streq(received_kind, "bond")) {
(void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode); (void) sd_netlink_message_read_u8(m, IFLA_BOND_MODE, &info->mode);
(void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon); (void) sd_netlink_message_read_u32(m, IFLA_BOND_MIIMON, &info->miimon);
@ -1221,7 +1226,7 @@ static int link_status_one(
sd_hwdb *hwdb, sd_hwdb *hwdb,
const LinkInfo *info) { const LinkInfo *info) {
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **search_domains = NULL, **route_domains = NULL; _cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL; _cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
_cleanup_free_ char *t = NULL, *network = NULL; _cleanup_free_ char *t = NULL, *network = NULL;
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL; const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
@ -1247,6 +1252,7 @@ static int link_status_one(
(void) sd_network_link_get_search_domains(info->ifindex, &search_domains); (void) sd_network_link_get_search_domains(info->ifindex, &search_domains);
(void) sd_network_link_get_route_domains(info->ifindex, &route_domains); (void) sd_network_link_get_route_domains(info->ifindex, &route_domains);
(void) sd_network_link_get_ntp(info->ifindex, &ntp); (void) sd_network_link_get_ntp(info->ifindex, &ntp);
(void) sd_network_link_get_sip(info->ifindex, &sip);
if (info->sd_device) { if (info->sd_device) {
(void) sd_device_get_property_value(info->sd_device, "ID_NET_LINK_FILE", &link); (void) sd_device_get_property_value(info->sd_device, "ID_NET_LINK_FILE", &link);
@ -1473,10 +1479,29 @@ static int link_status_one(
TABLE_BOOLEAN, info->stp_state > 0, TABLE_BOOLEAN, info->stp_state > 0,
TABLE_EMPTY, TABLE_EMPTY,
TABLE_STRING, "Multicast IGMP Version:", TABLE_STRING, "Multicast IGMP Version:",
TABLE_UINT8, info->mcast_igmp_version); TABLE_UINT8, info->mcast_igmp_version,
TABLE_EMPTY,
TABLE_STRING, "Cost:",
TABLE_UINT32, info->cost);
if (r < 0) if (r < 0)
return table_log_add_error(r); return table_log_add_error(r);
if (info->port_state <= BR_STATE_BLOCKING) {
static const struct {
const char *state;
} state_table[] = {
{ "disabled" },
{ "listening" },
{ "learning" },
{ "forwarding" },
{ "blocking" },
};
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "Port State:",
TABLE_STRING, state_table[info->port_state]);
}
} else if (streq_ptr(info->netdev_kind, "bond")) { } else if (streq_ptr(info->netdev_kind, "bond")) {
static const struct { static const struct {
const char *mode; const char *mode;
@ -1749,6 +1774,9 @@ static int link_status_one(
if (r < 0) if (r < 0)
return r; return r;
r = dump_list(table, "NTP:", ntp); r = dump_list(table, "NTP:", ntp);
if (r < 0)
return r;
r = dump_list(table, "SIP:", sip);
if (r < 0) if (r < 0)
return r; return r;
r = dump_ifindexes(table, "Carrier Bound To:", carrier_bound_to); r = dump_ifindexes(table, "Carrier Bound To:", carrier_bound_to);

View File

@ -547,6 +547,9 @@ int main(int argc, char *argv[]) {
/* Child */ /* Child */
execv(args[0], (char * const *) args); execv(args[0], (char * const *) args);
/* execv failed (kexec binary missing?), so try simply reboot(RB_KEXEC) */
(void) reboot(cmd);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }

View File

@ -118,6 +118,10 @@ int sd_network_link_get_dhcp4_address(int ifindex, char **ret);
* representations of IP addresses */ * representations of IP addresses */
int sd_network_link_get_ntp(int ifindex, char ***ret); int sd_network_link_get_ntp(int ifindex, char ***ret);
/* Get SIP entries for a given link. These are string
* representations of IP addresses */
int sd_network_link_get_sip(int ifindex, char ***ret);
/* Indicates whether or not LLMNR should be enabled for the link /* Indicates whether or not LLMNR should be enabled for the link
* Possible levels of support: yes, no, resolve * Possible levels of support: yes, no, resolve
* Possible return codes: * Possible return codes: