Skip to content

Commit

Permalink
Merge version 0.6.70 into sle12-sp5
Browse files Browse the repository at this point in the history
  • Loading branch information
cfconrad committed Oct 20, 2022
2 parents a7d1457 + a5762e9 commit f00caa0
Show file tree
Hide file tree
Showing 121 changed files with 10,743 additions and 2,519 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -43,6 +43,7 @@ Makefile.in
/etc/client.xml
/etc/server.xml
/etc/nanny.xml
/etc/scripts/redfish-update
/etc/systemv/wickedd
/etc/systemv/network
/etc/systemv/*.service
Expand All @@ -58,4 +59,7 @@ Makefile.in
/util/mkconst
/util/schema2html
/testing/*-test
testing/*.log
testing/*.trs
/html
test-driver
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
@@ -1,3 +1,3 @@
include:
- project: 'wicked-maintainers/wicked-ci'
- project: '$CI_PROJECT_NAMESPACE/wicked-ci'
file: '/wicked-ci.yml'
1 change: 0 additions & 1 deletion INSTALL
Expand Up @@ -10,7 +10,6 @@ These devel packages should be installed to compile wicked from source:
autoconf
libtool
libnl-devel
libiw-devel
dbus-1-devel
pkg-config
libgcrypt-devel
Expand Down
7 changes: 3 additions & 4 deletions README
Expand Up @@ -96,12 +96,12 @@ These factory interfaces are attached to the
Frequently Asked Questions
==========================

We have a FAQ section hosted in our GitHub's wiki, be sure to check that
We have a FAQ section hosted in our GitHub's wiki, be sure to check that
out for common questions about usage or Wicked in general:

https://github.com/openSUSE/wicked/wiki/FAQ

For any questions not answered on the FAQ, please read our section
For any questions not answered on the FAQ, please read our section
below: "Where to discuss or report bugs"

What's currently supported
Expand Down Expand Up @@ -150,8 +150,7 @@ To build wicked from sources, try following commands:

zypper in git-core rpm-build gcc make pkg-config \
autoconf automake libtool systemd-devel \
libnl3-devel libiw-devel dbus-1-devel \
libgcrypt-devel
libnl3-devel dbus-1-devel libgcrypt-devel
git clone https://github.com/openSUSE/wicked.git
cd wicked
./autogen.sh
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.6.68
0.6.70
2 changes: 1 addition & 1 deletion autoip4/fsm.c
Expand Up @@ -185,7 +185,7 @@ ni_autoip_fsm_build_lease(ni_autoip_device_t *dev)
memset(&addr, 0, sizeof(addr));
addr.sin.sin_family = AF_INET;
addr.sin.sin_addr = dev->autoip.candidate;
ni_address_new(AF_INET, 16, &addr, &lease->addrs);
ni_address_create(AF_INET, 16, &addr, &lease->addrs);

ni_sockaddr_parse(&addr, "169.254.0.0", AF_INET);
ni_route_create(16, &addr, NULL, 0, &lease->routes);
Expand Down
2 changes: 2 additions & 0 deletions client/Makefile.am
Expand Up @@ -32,6 +32,7 @@ if wicked_compat_redhat
wicked_CPPFLAGS += -DCOMPAT_REDHAT
endif
endif
wicked_CPPFLAGS += -DWICKED_EXTENSIONSDIR=\"$(wicked_extensionsdir)\"

wicked_CFLAGS = $(LIBNL_CFLAGS) \
$(LIBDBUS_CFLAGS) \
Expand Down Expand Up @@ -68,6 +69,7 @@ wicked_SOURCES = \
main.c \
nanny.c \
reachable.c \
redfish.c \
tester.c

noinst_HEADERS = \
Expand Down
85 changes: 61 additions & 24 deletions client/compat.c
Expand Up @@ -137,6 +137,7 @@ ni_compat_netdev_new(const char *ifname)
compat->dhcp6.mode = NI_BIT(NI_DHCP6_MODE_AUTO);
compat->dhcp6.rapid_commit = TRUE;
compat->dhcp6.recover_lease = TRUE;
compat->dhcp6.refresh_lease = FALSE;
compat->dhcp6.release_lease = FALSE;
ni_dhcp_fqdn_init(&compat->dhcp6.fqdn);

Expand Down Expand Up @@ -199,6 +200,16 @@ ni_compat_netdev_free(ni_compat_netdev_t *compat)
ni_string_free(&compat->dhcp6.client_id);
ni_dhcp6_prefix_req_list_destroy(&compat->dhcp6.prefix_reqs);
ni_string_array_destroy(&compat->dhcp6.request_options);
switch(compat->port.type) {
case NI_IFTYPE_TEAM:
ni_team_port_config_destroy(&compat->port.conf.team);
break;
case NI_IFTYPE_OVS_BRIDGE:
ni_ovs_bridge_port_config_destroy(&compat->port.conf.ovsbr);
break;
default:
break;
}

free(compat);
}
Expand Down Expand Up @@ -841,6 +852,28 @@ __ni_compat_generate_team_link_watch(xml_node_t *tnode, const ni_team_link_watch
return TRUE;
}

static ni_bool_t
__ni_compat_generate_team_port_config(xml_node_t *port, const ni_team_port_config_t *config)
{

if (config->queue_id != -1U)
xml_node_new_element("queue_id", port, ni_sprint_uint(config->queue_id));

if (config->ab.prio)
xml_node_new_element("prio", port, ni_sprint_uint(config->ab.prio));

if (config->ab.sticky)
xml_node_new_element("sticky", port, ni_format_boolean(config->ab.sticky));

if (config->lacp.prio)
xml_node_new_element("lacp_prio", port, ni_sprint_uint(config->lacp.prio));

if (config->lacp.key)
xml_node_new_element("lacp_key", port, ni_sprint_uint(config->lacp.key));

return TRUE;
}

static ni_bool_t
__ni_compat_generate_team_ports(xml_node_t *tnode, const ni_team_port_array_t *array)
{
Expand All @@ -863,20 +896,7 @@ __ni_compat_generate_team_ports(xml_node_t *tnode, const ni_team_port_array_t *a

port = xml_node_new("port", ports);
xml_node_new_element("device", port, p->device.name);

if (p->config.queue_id != -1U)
xml_node_new_element("queue_id", port, ni_sprint_uint(p->config.queue_id));

if (p->config.ab.prio)
xml_node_new_element("prio", port, ni_sprint_uint(p->config.ab.prio));
if (p->config.ab.sticky)
xml_node_new_element("sticky", port, ni_format_boolean(p->config.ab.sticky));

if (p->config.lacp.prio)
xml_node_new_element("lacp_prio", port, ni_sprint_uint(p->config.lacp.prio));
if (p->config.lacp.key)
xml_node_new_element("lacp_key", port, ni_sprint_uint(p->config.lacp.key));

__ni_compat_generate_team_port_config(port, &p->config);
}

return TRUE;
Expand Down Expand Up @@ -1429,16 +1449,13 @@ __ni_compat_generate_wireless_network(xml_node_t *parent, ni_wireless_network_t
xml_node_free(wep);
}

if (net->keymgmt_proto & NI_BIT(NI_WIRELESS_KEY_MGMT_PSK)) {
if (!ni_string_empty(net->wpa_psk.passphrase)) {
if (!(wpa_psk = xml_node_new("wpa-psk", network))) {
goto error;
}

if (!ni_string_empty(net->wpa_psk.passphrase)) {
/* To be secured */
xml_node_new_element("passphrase", wpa_psk,
net->wpa_psk.passphrase);
}
xml_node_new_element("passphrase", wpa_psk,
net->wpa_psk.passphrase);

if ((value = ni_format_bitmap(&buf, ni_wireless_auth_proto_map(),
net->auth_proto, ","))) {
Expand All @@ -1455,9 +1472,13 @@ __ni_compat_generate_wireless_network(xml_node_t *parent, ni_wireless_network_t
xml_node_new_element("group-cipher", wpa_psk, value);
ni_stringbuf_destroy(&buf);
}

if (net->pmf != NI_WIRELESS_PMF_NOT_SPECIFIED &&
(value = ni_wireless_pmf_to_name(net->pmf)))
xml_node_new_element("pmf", wpa_psk, value);
}

if (net->keymgmt_proto & NI_BIT(NI_WIRELESS_KEY_MGMT_EAP)) {
if (net->wpa_eap.method) {
if (!(wpa_eap = xml_node_new("wpa-eap", network))) {
goto error;
}
Expand All @@ -1482,6 +1503,10 @@ __ni_compat_generate_wireless_network(xml_node_t *parent, ni_wireless_network_t
ni_stringbuf_destroy(&buf);
}

if (net->pmf != NI_WIRELESS_PMF_NOT_SPECIFIED &&
(value = ni_wireless_pmf_to_name(net->pmf)))
xml_node_new_element("pmf", wpa_eap, value);

if (!ni_string_empty(net->wpa_eap.identity)) {
xml_node_new_element("identity", wpa_eap, net->wpa_eap.identity);
}
Expand Down Expand Up @@ -2416,6 +2441,8 @@ __ni_compat_generate_dhcp6_addrconf(xml_node_t *ifnode, const ni_compat_netdev_t

xml_node_dict_set(dhcp, "recover-lease",
ni_format_boolean(compat->dhcp6.recover_lease));
xml_node_dict_set(dhcp, "refresh-lease",
ni_format_boolean(compat->dhcp6.refresh_lease));
xml_node_dict_set(dhcp, "release-lease",
ni_format_boolean(compat->dhcp6.release_lease));

Expand Down Expand Up @@ -2899,10 +2926,20 @@ ni_compat_generate_ifnode_content(xml_node_t *ifnode, const ni_compat_netdev_t *
xml_node_t *port;

xml_node_new_element("master", linknode, dev->link.masterdev.name);
if (compat->link_port.ovsbr.bridge.name) {
if (compat->port.type != NI_IFTYPE_UNKNOWN) {
port = xml_node_new("port", linknode);
xml_node_add_attr(port, "type", ni_linktype_type_to_name(NI_IFTYPE_OVS_BRIDGE));
xml_node_new_element("bridge", port, compat->link_port.ovsbr.bridge.name);
xml_node_add_attr(port, "type", ni_linktype_type_to_name(compat->port.type));

switch(compat->port.type) {
case NI_IFTYPE_OVS_BRIDGE:
xml_node_new_element("bridge", port, compat->port.conf.ovsbr.bridge.name);
break;
case NI_IFTYPE_TEAM:
__ni_compat_generate_team_port_config(port, &compat->port.conf.team);
break;
default:
break;
}
}
}
if (dev->link.mtu)
Expand Down
2 changes: 1 addition & 1 deletion client/dracut/cmdline.c
Expand Up @@ -713,7 +713,7 @@ parse_ip3(ni_compat_netdev_array_t *nda, char *val, const char *client_ip)
ipv6 = ni_netdev_get_ipv6(nd->dev);
ni_tristate_set(&ipv6->conf.enabled, TRUE);
}
ni_address_new(client_addr.ss_family, client_prefixlen, &client_addr, &nd->dev->addrs);
ni_address_create(client_addr.ss_family, client_prefixlen, &client_addr, &nd->dev->addrs);

// Add the default gw
if (!ni_route_create(0, NULL, &gateway_addr, RT_TABLE_MAIN, &nd->dev->routes))
Expand Down
36 changes: 29 additions & 7 deletions client/ifdown.c
Expand Up @@ -106,22 +106,26 @@ ni_ifdown_fire_nanny(ni_ifworker_array_t *array)
int
ni_do_ifdown(int argc, char **argv)
{
enum { OPT_HELP, OPT_FORCE, OPT_DELETE, OPT_NO_DELETE, OPT_TIMEOUT };
enum { OPT_HELP, OPT_FORCE, OPT_DELETE, OPT_NO_DELETE, OPT_TIMEOUT,
OPT_RELEASE, OPT_NO_RELEASE };
static struct option ifdown_options[] = {
{ "help", no_argument, NULL, OPT_HELP },
{ "force", required_argument, NULL, OPT_FORCE },
{ "delete", no_argument, NULL, OPT_DELETE },
{ "no-delete", no_argument, NULL, OPT_NO_DELETE },
{ "delete", no_argument, NULL, OPT_DELETE },
{ "no-delete", no_argument, NULL, OPT_NO_DELETE },
{ "release", no_argument, NULL, OPT_RELEASE },
{ "no-release", no_argument, NULL, OPT_NO_RELEASE },
{ "timeout", required_argument, NULL, OPT_TIMEOUT },
{ NULL }
};
ni_ifmatcher_t ifmatch;
ni_ifmarker_t ifmarker;
ni_ifworker_array_t ifmarked;
ni_ifworker_array_t ifmarked = NI_IFWORKER_ARRAY_INIT;
ni_string_array_t ifnames = NI_STRING_ARRAY_INIT;
unsigned int nmarked, max_state = NI_FSM_STATE_DEVICE_DOWN;
unsigned int seconds = NI_IFWORKER_DEFAULT_TIMEOUT;
ni_stringbuf_t sb = NI_STRINGBUF_INIT_DYNAMIC;
ni_tristate_t opt_release = NI_TRISTATE_DEFAULT;
ni_fsm_t *fsm;
int c, status = NI_WICKED_RC_USAGE;

Expand All @@ -131,13 +135,11 @@ ni_do_ifdown(int argc, char **argv)

/* Allow ifdown only on non-persistent interfaces previously configured by ifup */
memset(&ifmatch, 0, sizeof(ifmatch));
memset(&ifmarker, 0, sizeof(ifmarker));
memset(&ifmarked, 0, sizeof(ifmarked));

ifmatch.require_configured = TRUE;
ifmatch.allow_persistent = FALSE;
ifmatch.require_config = FALSE;

memset(&ifmarker, 0, sizeof(ifmarker));
ifmarker.target_range.min = NI_FSM_STATE_DEVICE_DOWN;
ifmarker.target_range.max = __NI_FSM_STATE_MAX - 2;

Expand Down Expand Up @@ -172,6 +174,13 @@ ni_do_ifdown(int argc, char **argv)
ifmatch.require_config = FALSE;
break;

case OPT_RELEASE:
opt_release = NI_TRISTATE_ENABLE;
break;
case OPT_NO_RELEASE:
opt_release = NI_TRISTATE_DISABLE;
break;

case OPT_TIMEOUT:
if (ni_parse_seconds_timeout(optarg, &seconds)) {
ni_error("ifdown: cannot parse timeout option \"%s\"", optarg);
Expand All @@ -195,6 +204,8 @@ ni_do_ifdown(int argc, char **argv)
" Delete device. Despite of persistent mode being set\n"
" --no-delete\n"
" Do not attempt to delete a device, neither physical nor virtual\n"
" --[no-]release\n"
" Override active config to (not) release leases\n"
" --timeout <sec>\n"
" Timeout after <sec> seconds\n",
sb.string
Expand Down Expand Up @@ -253,6 +264,17 @@ ni_do_ifdown(int argc, char **argv)
/* Disable devices and delete all related policies from nanny */
ni_ifdown_fire_nanny(&ifmarked);

/* Advise marked workers to (not) release leases */
if (ni_tristate_is_set(opt_release)) {
unsigned int i;

for (i = 0; i < ifmarked.count; ++i) {
ni_ifworker_t *w = ifmarked.data[i];
if (!w->control.persistent)
w->args.release = opt_release;
}
}

/* Start workers to perform actual ifdown */
nmarked = ni_fsm_mark_matching_workers(fsm, &ifmarked, &ifmarker);
}
Expand Down
22 changes: 22 additions & 0 deletions client/ifreload.c
Expand Up @@ -339,13 +339,17 @@ ni_do_ifreload(const char *caller, int argc, char **argv)
OPT_TIMEOUT = 't',
OPT_PERSISTENT = 'P',
OPT_TRANSIENT = 'T',
OPT_RELEASE,
OPT_NO_RELEASE,
};
static struct option ifreload_options[] = {
{ "help", no_argument, NULL, OPT_HELP },
{ "ifconfig", required_argument, NULL, OPT_IFCONFIG },
{ "timeout", required_argument, NULL, OPT_TIMEOUT },
{ "transient", no_argument, NULL, OPT_TRANSIENT },
{ "persistent", no_argument, NULL, OPT_PERSISTENT },
{ "release", no_argument, NULL, OPT_RELEASE },
{ "no-release", no_argument, NULL, OPT_NO_RELEASE },

{ NULL, no_argument, NULL, 0 }
};
Expand All @@ -356,6 +360,7 @@ ni_do_ifreload(const char *caller, int argc, char **argv)
ni_nanny_fsm_monitor_t *monitor = NULL;
ni_bool_t opt_persistent = FALSE;
ni_bool_t opt_transient = FALSE;
ni_tristate_t opt_release = NI_TRISTATE_DEFAULT;
unsigned int seconds = 0;
int c, status = NI_WICKED_RC_USAGE;
char *saved_argv0, *program = NULL;
Expand Down Expand Up @@ -393,6 +398,14 @@ ni_do_ifreload(const char *caller, int argc, char **argv)
}
break;

case OPT_RELEASE:
opt_release = NI_TRISTATE_ENABLE;
break;

case OPT_NO_RELEASE:
opt_release = NI_TRISTATE_DISABLE;
break;

default:
case OPT_HELP:
usage:
Expand All @@ -409,6 +422,8 @@ ni_do_ifreload(const char *caller, int argc, char **argv)
" Timeout after <sec> seconds\n"
" --persistent\n"
" Set interface into persistent mode (no regular ifdown allowed)\n"
" --[no-]release\n"
" Override active config to (not) release leases in ifdown\n"
, program);
goto cleanup;
}
Expand Down Expand Up @@ -498,6 +513,13 @@ ni_do_ifreload(const char *caller, int argc, char **argv)
ni_ifworker_control_set_persistent(w, TRUE);
}
}
if (ni_tristate_is_set(opt_release)) {
for (i = 0; i < down_marked.count; ++i) {
ni_ifworker_t *w = down_marked.data[i];
if (!w->control.persistent)
w->args.release = opt_release;
}
}

if (!down_marked.count && !up_marked.count) {
ni_note("ifreload: no configuration changes to reload");
Expand Down

0 comments on commit f00caa0

Please sign in to comment.