mirror of
https://github.com/systemd/systemd.git
synced 2025-03-10 16:58:28 +03:00
Merge pull request #14488 from yuwata/networkctl-show-logs
networkctl: status command also shows logs of networkd
This commit is contained in:
commit
629548c405
@ -311,6 +311,25 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-l</option></term>
|
||||
<term><option>--full</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>Do not ellipsize the logs in <command>status</command> command.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-n</option></term>
|
||||
<term><option>--lines=</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>When used with <command>status</command>, controls the number of journal lines to show,
|
||||
counting from the most recent ones. Takes a positive integer argument. Defaults to 10.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="standard-options.xml" xpointer="help" />
|
||||
<xi:include href="standard-options.xml" xpointer="version" />
|
||||
<xi:include href="standard-options.xml" xpointer="no-legend" />
|
||||
|
@ -25,7 +25,7 @@ static int netdev_veth_fill_message_create(NetDev *netdev, Link *link, sd_netlin
|
||||
if (v->ifname_peer) {
|
||||
r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add netlink interface name: %m");
|
||||
return log_netdev_error_errno(netdev, r, "Failed to add netlink interface name: %m");
|
||||
}
|
||||
|
||||
if (v->mac_peer) {
|
||||
@ -53,16 +53,17 @@ static int netdev_veth_verify(NetDev *netdev, const char *filename) {
|
||||
assert(v);
|
||||
|
||||
if (!v->ifname_peer) {
|
||||
log_warning("Veth NetDev without peer name configured in %s. Ignoring",
|
||||
filename);
|
||||
log_netdev_warning(netdev, "Veth NetDev without peer name configured in %s. Ignoring",
|
||||
filename);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!v->mac_peer) {
|
||||
r = netdev_get_mac(v->ifname_peer, &v->mac_peer);
|
||||
if (r < 0) {
|
||||
log_warning("Failed to generate predictable MAC address for %s. Ignoring",
|
||||
v->ifname_peer);
|
||||
log_netdev_warning(netdev,
|
||||
"Failed to generate predictable MAC address for %s. Ignoring",
|
||||
v->ifname_peer);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ static int netdev_vlan_verify(NetDev *netdev, const char *filename) {
|
||||
assert(v);
|
||||
|
||||
if (v->id == VLANID_INVALID) {
|
||||
log_warning("VLAN without valid Id (%"PRIu16") configured in %s.", v->id, filename);
|
||||
log_netdev_warning(netdev, "VLAN without valid Id (%"PRIu16") configured in %s.", v->id, filename);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ static int netdev_vxcan_fill_message_create(NetDev *netdev, Link *link, sd_netli
|
||||
if (v->ifname_peer) {
|
||||
r = sd_netlink_message_append_string(m, IFLA_IFNAME, v->ifname_peer);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add vxcan netlink interface peer name: %m");
|
||||
return log_netdev_error_errno(netdev, r, "Failed to add vxcan netlink interface peer name: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_close_container(m);
|
||||
@ -44,7 +44,7 @@ static int netdev_vxcan_verify(NetDev *netdev, const char *filename) {
|
||||
assert(v);
|
||||
|
||||
if (!v->ifname_peer) {
|
||||
log_warning("VxCan NetDev without peer name configured in %s. Ignoring", filename);
|
||||
log_netdev_warning(netdev, "VxCan NetDev without peer name configured in %s. Ignoring", filename);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "hwdb-util.h"
|
||||
#include "local-addresses.h"
|
||||
#include "locale-util.h"
|
||||
#include "logs-show.h"
|
||||
#include "macro.h"
|
||||
#include "main-func.h"
|
||||
#include "netlink-util.h"
|
||||
@ -46,6 +47,7 @@
|
||||
#include "strv.h"
|
||||
#include "strxcpyx.h"
|
||||
#include "terminal-util.h"
|
||||
#include "unit-def.h"
|
||||
#include "verbs.h"
|
||||
#include "wifi-util.h"
|
||||
|
||||
@ -59,6 +61,8 @@ static PagerFlags arg_pager_flags = 0;
|
||||
static bool arg_legend = true;
|
||||
static bool arg_all = false;
|
||||
static bool arg_stats = false;
|
||||
static bool arg_full = false;
|
||||
static unsigned arg_lines = 10;
|
||||
|
||||
static char *link_get_type_string(unsigned short iftype, sd_device *d) {
|
||||
const char *t, *devtype;
|
||||
@ -1067,6 +1071,69 @@ static int dump_statistics(Table *table, const LinkInfo *info) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static OutputFlags get_output_flags(void) {
|
||||
return
|
||||
arg_all * OUTPUT_SHOW_ALL |
|
||||
(arg_full || !on_tty() || pager_have()) * OUTPUT_FULL_WIDTH |
|
||||
colors_enabled() * OUTPUT_COLOR;
|
||||
}
|
||||
|
||||
static int show_logs(const LinkInfo *info) {
|
||||
_cleanup_(sd_journal_closep) sd_journal *j = NULL;
|
||||
int r;
|
||||
|
||||
if (arg_lines == 0)
|
||||
return 0;
|
||||
|
||||
r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to open journal: %m");
|
||||
|
||||
r = add_match_this_boot(j, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add boot matches: %m");
|
||||
|
||||
if (info) {
|
||||
char m1[STRLEN("_KERNEL_DEVICE=n") + DECIMAL_STR_MAX(int)];
|
||||
const char *m2, *m3;
|
||||
|
||||
/* kernel */
|
||||
xsprintf(m1, "_KERNEL_DEVICE=n%i", info->ifindex);
|
||||
/* networkd */
|
||||
m2 = strjoina("INTERFACE=", info->name);
|
||||
/* udevd */
|
||||
m3 = strjoina("DEVICE=", info->name);
|
||||
|
||||
(void)(
|
||||
(r = sd_journal_add_match(j, m1, 0)) ||
|
||||
(r = sd_journal_add_disjunction(j)) ||
|
||||
(r = sd_journal_add_match(j, m2, 0)) ||
|
||||
(r = sd_journal_add_disjunction(j)) ||
|
||||
(r = sd_journal_add_match(j, m3, 0))
|
||||
);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add link matches: %m");
|
||||
} else {
|
||||
r = add_matches_for_unit(j, "systemd-networkd.service");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add unit matches: %m");
|
||||
|
||||
r = add_matches_for_unit(j, "systemd-networkd-wait-online.service");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to add unit matches: %m");
|
||||
}
|
||||
|
||||
return show_journal(
|
||||
stdout,
|
||||
j,
|
||||
OUTPUT_SHORT,
|
||||
0,
|
||||
0,
|
||||
arg_lines,
|
||||
get_output_flags() | OUTPUT_BEGIN_NEWLINE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static int link_status_one(
|
||||
sd_netlink *rtnl,
|
||||
sd_hwdb *hwdb,
|
||||
@ -1457,7 +1524,11 @@ static int link_status_one(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return table_print(table, NULL);
|
||||
r = table_print(table, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return show_logs(info);
|
||||
}
|
||||
|
||||
static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
|
||||
@ -1520,7 +1591,11 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return table_print(table, NULL);
|
||||
r = table_print(table, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return show_logs(NULL);
|
||||
}
|
||||
|
||||
static int link_status(int argc, char *argv[], void *userdata) {
|
||||
@ -1946,6 +2021,8 @@ static int help(void) {
|
||||
" --no-legend Do not show the headers and footers\n"
|
||||
" -a --all Show status for all links\n"
|
||||
" -s --stats Show detailed link statics\n"
|
||||
" -l --full Do not ellipsize output\n"
|
||||
" -n --lines=INTEGER Number of journal entries to show\n"
|
||||
"\nSee the %s for details.\n"
|
||||
, program_invocation_short_name
|
||||
, ansi_highlight()
|
||||
@ -1971,6 +2048,8 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
|
||||
{ "all", no_argument, NULL, 'a' },
|
||||
{ "stats", no_argument, NULL, 's' },
|
||||
{ "full", no_argument, NULL, 'l' },
|
||||
{ "lines", required_argument, NULL, 'n' },
|
||||
{}
|
||||
};
|
||||
|
||||
@ -1979,7 +2058,7 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
assert(argc >= 0);
|
||||
assert(argv);
|
||||
|
||||
while ((c = getopt_long(argc, argv, "has", options, NULL)) >= 0) {
|
||||
while ((c = getopt_long(argc, argv, "hasln:", options, NULL)) >= 0) {
|
||||
|
||||
switch (c) {
|
||||
|
||||
@ -2005,6 +2084,16 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
arg_stats = true;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
arg_full = true;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
if (safe_atou(optarg, &arg_lines) < 0)
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
|
||||
"Failed to parse lines '%s'", optarg);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
|
@ -125,25 +125,25 @@ int address_label_configure(
|
||||
r = sd_rtnl_message_new_addrlabel(link->manager->rtnl, &req, RTM_NEWADDRLABEL,
|
||||
link->ifindex, AF_INET6);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not allocate RTM_NEWADDR message: %m");
|
||||
return log_link_error_errno(link, r, "Could not allocate RTM_NEWADDR message: %m");
|
||||
|
||||
r = sd_rtnl_message_addrlabel_set_prefixlen(req, label->prefixlen);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set prefixlen: %m");
|
||||
return log_link_error_errno(link, r, "Could not set prefixlen: %m");
|
||||
|
||||
r = sd_netlink_message_append_u32(req, IFAL_LABEL, label->label);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append IFAL_LABEL attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append IFAL_LABEL attribute: %m");
|
||||
|
||||
r = sd_netlink_message_append_in6_addr(req, IFA_ADDRESS, &label->in_addr.in6);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append IFA_ADDRESS attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append IFA_ADDRESS attribute: %m");
|
||||
|
||||
r = netlink_call_async(link->manager->rtnl, NULL, req,
|
||||
callback ?: address_label_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not send rtnetlink message: %m");
|
||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||
|
||||
link_ref(link);
|
||||
|
||||
|
@ -668,7 +668,7 @@ int address_configure(
|
||||
_cleanup_free_ char *pretty = NULL;
|
||||
|
||||
(void) in_addr_to_string(address->family, &address->in_addr, &pretty);
|
||||
log_debug("Starting IPv4ACD client. Probing address %s", strna(pretty));
|
||||
log_link_debug(link, "Starting IPv4ACD client. Probing address %s", strna(pretty));
|
||||
}
|
||||
|
||||
r = sd_ipv4acd_start(address->acd, true);
|
||||
|
@ -45,7 +45,7 @@ static int link_push_uplink_dns_to_dhcp_server(Link *link, sd_dhcp_server *s) {
|
||||
size_t n_addresses = 0, n_allocated = 0;
|
||||
unsigned i;
|
||||
|
||||
log_debug("Copying DNS server information from %s", link->ifname);
|
||||
log_link_debug(link, "Copying DNS server information from %s", link->ifname);
|
||||
|
||||
if (!link->network)
|
||||
return 0;
|
||||
@ -99,7 +99,7 @@ static int link_push_uplink_ntp_to_dhcp_server(Link *link, sd_dhcp_server *s) {
|
||||
if (!link->network)
|
||||
return 0;
|
||||
|
||||
log_debug("Copying NTP server information from %s", link->ifname);
|
||||
log_link_debug(link, "Copying NTP server information from %s", link->ifname);
|
||||
|
||||
STRV_FOREACH(a, link->network->ntp) {
|
||||
union in_addr_union ia;
|
||||
@ -148,7 +148,7 @@ static int link_push_uplink_sip_to_dhcp_server(Link *link, sd_dhcp_server *s) {
|
||||
if (!link->network)
|
||||
return 0;
|
||||
|
||||
log_debug("Copying SIP server information from %s", link->ifname);
|
||||
log_link_debug(link, "Copying SIP server information from %s", link->ifname);
|
||||
|
||||
STRV_FOREACH(a, link->network->sip) {
|
||||
union in_addr_union ia;
|
||||
@ -294,7 +294,7 @@ int dhcp4_server_configure(Link *link) {
|
||||
else {
|
||||
r = get_timezone(&buffer);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine timezone: %m");
|
||||
return log_link_error_errno(link, r, "Failed to determine timezone: %m");
|
||||
|
||||
tz = buffer;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ static int dhcp4_address_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *
|
||||
_cleanup_free_ char *pretty = NULL;
|
||||
|
||||
(void) in_addr_to_string(AF_INET, &addr, &pretty);
|
||||
log_debug("Starting IPv4ACD client. Probing DHCPv4 address %s", strna(pretty));
|
||||
log_link_debug(link, "Starting IPv4ACD client. Probing DHCPv4 address %s", strna(pretty));
|
||||
}
|
||||
|
||||
r = sd_ipv4acd_start(link->network->dhcp_acd, true);
|
||||
|
@ -126,26 +126,26 @@ int fdb_entry_configure(Link *link, FdbEntry *fdb_entry) {
|
||||
/* create new RTM message */
|
||||
r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_NEWNEIGH, link->ifindex, PF_BRIDGE);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m");
|
||||
|
||||
r = sd_rtnl_message_neigh_set_flags(req, fdb_entry->fdb_ntf_flags);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not set neighbor flags: %m");
|
||||
|
||||
/* only NUD_PERMANENT state supported. */
|
||||
r = sd_rtnl_message_neigh_set_state(req, NUD_NOARP | NUD_PERMANENT);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not set neighbor state: %m");
|
||||
|
||||
r = sd_netlink_message_append_data(req, NDA_LLADDR, &fdb_entry->mac_addr, sizeof(fdb_entry->mac_addr));
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not append NDA_LLADDR attribute: %m");
|
||||
|
||||
/* VLAN Id is optional. We'll add VLAN Id only if it's specified. */
|
||||
if (fdb_entry->vlan_id > 0) {
|
||||
r = sd_netlink_message_append_u16(req, NDA_VLAN, fdb_entry->vlan_id);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not append NDA_VLAN attribute: %m");
|
||||
}
|
||||
|
||||
if (!in_addr_is_null(fdb_entry->family, &fdb_entry->destination_addr)) {
|
||||
|
@ -162,15 +162,15 @@ int ipv6_proxy_ndp_address_configure(Link *link, IPv6ProxyNDPAddress *ipv6_proxy
|
||||
/* create new netlink message */
|
||||
r = sd_rtnl_message_new_neigh(rtnl, &req, RTM_NEWNEIGH, link->ifindex, AF_INET6);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not create RTM_NEWNEIGH message: %m");
|
||||
|
||||
r = sd_rtnl_message_neigh_set_flags(req, NLM_F_REQUEST | NTF_PROXY);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not set neighbor flags: %m");
|
||||
|
||||
r = sd_netlink_message_append_in6_addr(req, NDA_DST, &ipv6_proxy_ndp_address->in_addr);
|
||||
if (r < 0)
|
||||
return rtnl_log_create_error(r);
|
||||
return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m");
|
||||
|
||||
r = netlink_call_async(rtnl, NULL, req, set_ipv6_proxy_ndp_address_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
|
@ -126,28 +126,28 @@ int neighbor_configure(Neighbor *neighbor, Link *link, link_netlink_message_hand
|
||||
r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_NEWNEIGH,
|
||||
link->ifindex, neighbor->family);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not allocate RTM_NEWNEIGH message: %m");
|
||||
return log_link_error_errno(link, r, "Could not allocate RTM_NEWNEIGH message: %m");
|
||||
|
||||
r = sd_rtnl_message_neigh_set_state(req, NUD_PERMANENT);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set state: %m");
|
||||
return log_link_error_errno(link, r, "Could not set state: %m");
|
||||
|
||||
r = sd_netlink_message_set_flags(req, NLM_F_REQUEST | NLM_F_CREATE | NLM_F_REPLACE);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set flags: %m");
|
||||
return log_link_error_errno(link, r, "Could not set flags: %m");
|
||||
|
||||
r = sd_netlink_message_append_data(req, NDA_LLADDR, &neighbor->lladdr, neighbor->lladdr_size);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append NDA_LLADDR attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append NDA_LLADDR attribute: %m");
|
||||
|
||||
r = netlink_message_append_in_addr_union(req, NDA_DST, neighbor->family, &neighbor->in_addr);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append NDA_DST attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m");
|
||||
|
||||
r = netlink_call_async(link->manager->rtnl, NULL, req, callback ?: neighbor_configure_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not send rtnetlink message: %m");
|
||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||
|
||||
link->neighbor_messages++;
|
||||
link_ref(link);
|
||||
@ -189,16 +189,16 @@ int neighbor_remove(Neighbor *neighbor, Link *link, link_netlink_message_handler
|
||||
r = sd_rtnl_message_new_neigh(link->manager->rtnl, &req, RTM_DELNEIGH,
|
||||
link->ifindex, neighbor->family);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not allocate RTM_DELNEIGH message: %m");
|
||||
return log_link_error_errno(link, r, "Could not allocate RTM_DELNEIGH message: %m");
|
||||
|
||||
r = netlink_message_append_in_addr_union(req, NDA_DST, neighbor->family, &neighbor->in_addr);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append NDA_DST attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append NDA_DST attribute: %m");
|
||||
|
||||
r = netlink_call_async(link->manager->rtnl, NULL, req, callback ?: neighbor_remove_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not send rtnetlink message: %m");
|
||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||
|
||||
link_ref(link);
|
||||
|
||||
|
@ -511,7 +511,7 @@ int route_expire_handler(sd_event_source *s, uint64_t usec, void *userdata) {
|
||||
|
||||
r = route_remove(route, route->link, NULL);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Could not remove route: %m");
|
||||
log_link_warning_errno(route->link, r, "Could not remove route: %m");
|
||||
else
|
||||
route_free(route);
|
||||
|
||||
|
@ -335,33 +335,33 @@ int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *lin
|
||||
|
||||
r = sd_rtnl_message_new_routing_policy_rule(link->manager->rtnl, &m, RTM_DELRULE, routing_policy_rule->family);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not allocate RTM_DELRULE message: %m");
|
||||
return log_link_error_errno(link, r, "Could not allocate RTM_DELRULE message: %m");
|
||||
|
||||
if (in_addr_is_null(routing_policy_rule->family, &routing_policy_rule->from) == 0) {
|
||||
r = netlink_message_append_in_addr_union(m, FRA_SRC, routing_policy_rule->family, &routing_policy_rule->from);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_SRC attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_SRC attribute: %m");
|
||||
|
||||
r = sd_rtnl_message_routing_policy_rule_set_rtm_src_prefixlen(m, routing_policy_rule->from_prefixlen);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set source prefix length: %m");
|
||||
return log_link_error_errno(link, r, "Could not set source prefix length: %m");
|
||||
}
|
||||
|
||||
if (in_addr_is_null(routing_policy_rule->family, &routing_policy_rule->to) == 0) {
|
||||
r = netlink_message_append_in_addr_union(m, FRA_DST, routing_policy_rule->family, &routing_policy_rule->to);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_DST attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_DST attribute: %m");
|
||||
|
||||
r = sd_rtnl_message_routing_policy_rule_set_rtm_dst_prefixlen(m, routing_policy_rule->to_prefixlen);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set destination prefix length: %m");
|
||||
return log_link_error_errno(link, r, "Could not set destination prefix length: %m");
|
||||
}
|
||||
|
||||
r = netlink_call_async(link->manager->rtnl, NULL, m,
|
||||
callback ?: routing_policy_rule_remove_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not send rtnetlink message: %m");
|
||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||
|
||||
link_ref(link);
|
||||
|
||||
@ -461,102 +461,103 @@ int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, link_netl
|
||||
(void) in_addr_to_string(rule->family, &rule->from, &from);
|
||||
(void) in_addr_to_string(rule->family, &rule->to, &to);
|
||||
|
||||
log_debug("Configuring routing policy rule: %s/%u -> %s/%u, iif: %s, oif: %s, table: %u",
|
||||
from, rule->from_prefixlen, to, rule->to_prefixlen, strna(rule->iif), strna(rule->oif), rule->table);
|
||||
log_link_debug(link,
|
||||
"Configuring routing policy rule: %s/%u -> %s/%u, iif: %s, oif: %s, table: %u",
|
||||
from, rule->from_prefixlen, to, rule->to_prefixlen, strna(rule->iif), strna(rule->oif), rule->table);
|
||||
}
|
||||
|
||||
r = sd_rtnl_message_new_routing_policy_rule(link->manager->rtnl, &m, RTM_NEWRULE, rule->family);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not allocate RTM_NEWRULE message: %m");
|
||||
return log_link_error_errno(link, r, "Could not allocate RTM_NEWRULE message: %m");
|
||||
|
||||
if (in_addr_is_null(rule->family, &rule->from) == 0) {
|
||||
r = netlink_message_append_in_addr_union(m, FRA_SRC, rule->family, &rule->from);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_SRC attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_SRC attribute: %m");
|
||||
|
||||
r = sd_rtnl_message_routing_policy_rule_set_rtm_src_prefixlen(m, rule->from_prefixlen);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set source prefix length: %m");
|
||||
return log_link_error_errno(link, r, "Could not set source prefix length: %m");
|
||||
}
|
||||
|
||||
if (in_addr_is_null(rule->family, &rule->to) == 0) {
|
||||
r = netlink_message_append_in_addr_union(m, FRA_DST, rule->family, &rule->to);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_DST attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_DST attribute: %m");
|
||||
|
||||
r = sd_rtnl_message_routing_policy_rule_set_rtm_dst_prefixlen(m, rule->to_prefixlen);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set destination prefix length: %m");
|
||||
return log_link_error_errno(link, r, "Could not set destination prefix length: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_u32(m, FRA_PRIORITY, rule->priority);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_PRIORITY attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_PRIORITY attribute: %m");
|
||||
|
||||
if (rule->tos > 0) {
|
||||
r = sd_rtnl_message_routing_policy_rule_set_tos(m, rule->tos);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set ip rule tos: %m");
|
||||
return log_link_error_errno(link, r, "Could not set ip rule tos: %m");
|
||||
}
|
||||
|
||||
if (rule->table < 256) {
|
||||
r = sd_rtnl_message_routing_policy_rule_set_table(m, rule->table);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set ip rule table: %m");
|
||||
return log_link_error_errno(link, r, "Could not set ip rule table: %m");
|
||||
} else {
|
||||
r = sd_rtnl_message_routing_policy_rule_set_table(m, RT_TABLE_UNSPEC);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not set ip rule table: %m");
|
||||
return log_link_error_errno(link, r, "Could not set ip rule table: %m");
|
||||
|
||||
r = sd_netlink_message_append_u32(m, FRA_TABLE, rule->table);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_TABLE attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_TABLE attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->fwmark > 0) {
|
||||
r = sd_netlink_message_append_u32(m, FRA_FWMARK, rule->fwmark);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_FWMARK attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_FWMARK attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->fwmask > 0) {
|
||||
r = sd_netlink_message_append_u32(m, FRA_FWMASK, rule->fwmask);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_FWMASK attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_FWMASK attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->iif) {
|
||||
r = sd_netlink_message_append_string(m, FRA_IFNAME, rule->iif);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_IFNAME attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_IFNAME attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->oif) {
|
||||
r = sd_netlink_message_append_string(m, FRA_OIFNAME, rule->oif);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_OIFNAME attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_OIFNAME attribute: %m");
|
||||
}
|
||||
|
||||
r = sd_netlink_message_append_u8(m, FRA_IP_PROTO, rule->protocol);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_IP_PROTO attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_IP_PROTO attribute: %m");
|
||||
|
||||
if (rule->sport.start != 0 || rule->sport.end != 0) {
|
||||
r = sd_netlink_message_append_data(m, FRA_SPORT_RANGE, &rule->sport, sizeof(rule->sport));
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_SPORT_RANGE attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_SPORT_RANGE attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->dport.start != 0 || rule->dport.end != 0) {
|
||||
r = sd_netlink_message_append_data(m, FRA_DPORT_RANGE, &rule->dport, sizeof(rule->dport));
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FRA_DPORT_RANGE attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FRA_DPORT_RANGE attribute: %m");
|
||||
}
|
||||
|
||||
if (rule->invert_rule) {
|
||||
r = sd_rtnl_message_routing_policy_rule_set_flags(m, FIB_RULE_INVERT);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not append FIB_RULE_INVERT attribute: %m");
|
||||
return log_link_error_errno(link, r, "Could not append FIB_RULE_INVERT attribute: %m");
|
||||
}
|
||||
|
||||
rule->link = link;
|
||||
@ -565,13 +566,13 @@ int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, link_netl
|
||||
callback ?: routing_policy_rule_handler,
|
||||
link_netlink_destroy_callback, link);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not send rtnetlink message: %m");
|
||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||
|
||||
link_ref(link);
|
||||
|
||||
r = routing_policy_rule_add(link->manager, rule, NULL);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Could not add rule: %m");
|
||||
return log_link_error_errno(link, r, "Could not add rule: %m");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ DHCP={}
|
||||
self.assertRegex(out, (r'{}\s+ether\s+[a-z-]+\s+unmanaged'.format(self.if_router)).encode())
|
||||
self.assertRegex(out, (r'{}\s+ether\s+routable\s+configured'.format(self.iface)).encode())
|
||||
|
||||
out = subprocess.check_output(['networkctl', 'status', self.iface])
|
||||
out = subprocess.check_output(['networkctl', '-n', '0', 'status', self.iface])
|
||||
self.assertRegex(out, br'Type:\s+ether')
|
||||
self.assertRegex(out, br'State:\s+routable.*configured')
|
||||
self.assertRegex(out, br'Address:\s+192.168.5.\d+')
|
||||
@ -420,7 +420,7 @@ DHCP={}
|
||||
subprocess.call(['ip', 'a', 'show', 'dev', self.iface])
|
||||
print('---- networkctl status {} ----'.format(self.iface))
|
||||
sys.stdout.flush()
|
||||
rc = subprocess.call(['networkctl', 'status', self.iface])
|
||||
rc = subprocess.call(['networkctl', '-n', '0', 'status', self.iface])
|
||||
if rc != 0:
|
||||
print("'networkctl status' exited with an unexpected code {}".format(rc))
|
||||
self.show_journal('systemd-networkd.service')
|
||||
|
@ -369,7 +369,7 @@ def restart_networkd(sleep_sec=0, show_logs=True, remove_state_files=True):
|
||||
start_networkd(sleep_sec)
|
||||
|
||||
def get_operstate(link, show_status=True, setup_state='configured'):
|
||||
output = check_output(*networkctl_cmd, 'status', link, env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', link, env=env)
|
||||
if show_status:
|
||||
print(output)
|
||||
for line in output.splitlines():
|
||||
@ -392,14 +392,14 @@ class Utilities():
|
||||
check_output(*args, env=env)
|
||||
except subprocess.CalledProcessError:
|
||||
for link in links_with_operstate:
|
||||
output = check_output(*networkctl_cmd, 'status', link.split(':')[0], env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env)
|
||||
print(output)
|
||||
raise
|
||||
if not bool_any and setup_state:
|
||||
# check at least once now, then once per sec for setup_timeout secs
|
||||
for secs in range(setup_timeout + 1):
|
||||
for link in links_with_operstate:
|
||||
output = check_output(*networkctl_cmd, 'status', link.split(':')[0])
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0])
|
||||
print(output)
|
||||
if not re.search(rf'(?m)^\s*State:.*({setup_state}).*$', output):
|
||||
# this link isn't in the right state; break into the sleep below
|
||||
@ -458,7 +458,7 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'dummy98', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
|
||||
self.assertRegex(output, 'hogehogehogehogehogehoge')
|
||||
|
||||
def test_reconfigure(self):
|
||||
@ -529,11 +529,11 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
self.assertNotRegex(output, '1 lo ')
|
||||
self.assertRegex(output, 'test1')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'te*', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'te*', env=env)
|
||||
self.assertNotRegex(output, '1: lo ')
|
||||
self.assertRegex(output, 'test1')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'tes[a-z][0-9]', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'tes[a-z][0-9]', env=env)
|
||||
self.assertNotRegex(output, '1: lo ')
|
||||
self.assertRegex(output, 'test1')
|
||||
|
||||
@ -543,7 +543,7 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
|
||||
self.wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'test1', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
|
||||
self.assertRegex(output, 'MTU: 1600')
|
||||
|
||||
def test_type(self):
|
||||
@ -551,11 +551,11 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'test1', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Type: ether')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'lo', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Type: loopback')
|
||||
|
||||
@ -565,12 +565,12 @@ class NetworkctlTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['test1:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'test1', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link')
|
||||
self.assertRegex(output, r'Network File: /run/systemd/network/11-dummy.network')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'lo', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'lo', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'Link File: (/usr)?/lib/systemd/network/99-default.link')
|
||||
self.assertRegex(output, r'Network File: n/a')
|
||||
@ -797,7 +797,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output('networkctl status dummy98')
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Network File: /run/systemd/network/14-match-udev-property')
|
||||
|
||||
@ -827,7 +827,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertEqual(1, int(read_link_attr('bridge99', 'bridge', 'stp_state')))
|
||||
self.assertEqual(3, int(read_link_attr('bridge99', 'bridge', 'multicast_igmp_version')))
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'bridge99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'bridge99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Priority: 9')
|
||||
self.assertRegex(output, 'STP: yes')
|
||||
@ -1394,7 +1394,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
||||
self.assertRegex(output, '00:11:22:33:44:66 dst 10.0.0.6 self permanent')
|
||||
self.assertRegex(output, '00:11:22:33:44:77 dst 10.0.0.7 self permanent')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'vxlan99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'vxlan99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'VNI: 999')
|
||||
self.assertRegex(output, 'Destination Port: 5555')
|
||||
@ -1665,7 +1665,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['test1:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'test1', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'test1', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.0.15')
|
||||
self.assertRegex(output, '192.168.0.1')
|
||||
@ -1759,7 +1759,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'dummy98', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
|
||||
print(output)
|
||||
|
||||
print('### ip -6 route show dev dummy98')
|
||||
@ -2122,7 +2122,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'dummy98', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Address: 192.168.42.100')
|
||||
self.assertRegex(output, 'DNS: 192.168.42.1')
|
||||
@ -2602,7 +2602,7 @@ class NetworkdRATests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['veth99:routable', 'veth-peer:degraded'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '2002:da8:1:0')
|
||||
|
||||
@ -2630,7 +2630,7 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5.*')
|
||||
self.assertRegex(output, 'Gateway: 192.168.5.1')
|
||||
@ -2642,7 +2642,7 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
|
||||
start_networkd()
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Gateway: 192.168.5.*')
|
||||
self.assertRegex(output, '192.168.5.*')
|
||||
@ -2712,7 +2712,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
start_dnsmasq()
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '2600::')
|
||||
self.assertNotRegex(output, '192.168.5')
|
||||
@ -2730,7 +2730,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
start_dnsmasq(additional_options='--dhcp-option=option:dns-server,192.168.5.6,192.168.5.7', lease_time='2m')
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertNotRegex(output, '2600::')
|
||||
self.assertRegex(output, '192.168.5')
|
||||
@ -2753,7 +2753,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertNotRegex(output, '2600::')
|
||||
self.assertRegex(output, '192.168.5')
|
||||
@ -2781,7 +2781,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24 brd 192.168.5.255 scope global dynamic', ipv='-4')
|
||||
self.wait_address('veth99', r'inet6 2600::[0-9a-f]*/128 scope global (dynamic noprefixroute|noprefixroute dynamic)', ipv='-6')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '2600::')
|
||||
self.assertRegex(output, '192.168.5')
|
||||
@ -2990,7 +2990,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
@ -3006,7 +3006,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
@ -3017,7 +3017,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
@ -3029,7 +3029,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.*')
|
||||
|
||||
@ -3179,7 +3179,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
start_dnsmasq()
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5')
|
||||
|
||||
@ -3373,7 +3373,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
||||
start_dnsmasq('--dhcp-option=option:domain-search,example.com')
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, 'status', 'veth99', env=env)
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
|
||||
print(output)
|
||||
self.assertRegex(output, 'Search Domains: example.com')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user