diff --git a/src/confd/src/core.c b/src/confd/src/core.c index ea6bd8a9d..a0569b688 100644 --- a/src/confd/src/core.c +++ b/src/confd/src/core.c @@ -439,7 +439,7 @@ static confd_dependency_t dep_radio_components(struct lyd_node **diff, struct ly class = lyd_get_value(class_node); } - if (strcmp(class, "infix-hardware:wifi")) + if (!class || strcmp(class, "infix-hardware:wifi")) continue; /* Find all interfaces that reference this radio */ diff --git a/src/confd/src/hardware.c b/src/confd/src/hardware.c index 06629d364..816396bdc 100644 --- a/src/confd/src/hardware.c +++ b/src/confd/src/hardware.c @@ -237,7 +237,7 @@ static const char *wifi_find_higher_band_twin(struct lyd_node *config, { struct lyd_node *cifs, *cif; - if (strcmp(current_band, "2.4GHz")) + if (!current_band || !current_ssid || strcmp(current_band, "2.4GHz")) return NULL; cifs = lydx_get_descendant(config, "interfaces", "interface", NULL); @@ -252,13 +252,13 @@ static const char *wifi_find_higher_band_twin(struct lyd_node *config, if (!ap) continue; ssid = lydx_get_cattr(ap, "ssid"); - if (strcmp(ssid, current_ssid)) + if (!ssid || strcmp(ssid, current_ssid)) continue; radio = lydx_get_cattr(wifi, "radio"); radio_node = lydx_get_xpathf(config, "/hardware/component[name='%s']/wifi-radio", radio); band = lydx_get_cattr(radio_node, "band"); - if (!strcmp(band, "5GHz") || !strcmp(band, "6GHz")) + if (band && (!strcmp(band, "5GHz") || !strcmp(band, "6GHz"))) return lydx_get_cattr(cif, "name"); } diff --git a/src/confd/src/ieee802-ethernet-interface.c b/src/confd/src/ieee802-ethernet-interface.c index 18d03bcec..87eed1c76 100644 --- a/src/confd/src/ieee802-ethernet-interface.c +++ b/src/confd/src/ieee802-ethernet-interface.c @@ -237,7 +237,7 @@ static int netdag_gen_ethtool_autoneg(struct dagger *net, struct lyd_node *cif) err = -EINVAL; goto out; } - if (n != 1) { + if (n != 1 || !forced) { sr_session_set_error_message(net->session, "%s: auto-negotiation/enable=false requires exactly one " "advertised-pmd-types entry (have %d)", ifname, n); diff --git a/src/confd/src/if-wifi.c b/src/confd/src/if-wifi.c index 3c8bea5d2..21baf77c8 100644 --- a/src/confd/src/if-wifi.c +++ b/src/confd/src/if-wifi.c @@ -283,7 +283,7 @@ static int wifi_center_chan_160(int ch) */ static int wifi_chan_to_freq(int channel, const char *band) { - if (!strcmp(band, "6GHz")) + if (band && !strcmp(band, "6GHz")) return 5950 + channel * 5; if (channel >= 1 && channel <= 13) @@ -392,7 +392,7 @@ int wifi_gen_mesh(struct lyd_node *cif) int center = wifi_center_chan_80(channel); fprintf(wpa_supplicant, " ht40=1\n"); - if (!strcmp(band, "6GHz")) + if (band && !strcmp(band, "6GHz")) fprintf(wpa_supplicant, " he=1\n"); else fprintf(wpa_supplicant, " vht=1\n"); @@ -403,7 +403,7 @@ int wifi_gen_mesh(struct lyd_node *cif) int center = wifi_center_chan_160(channel); fprintf(wpa_supplicant, " ht40=1\n"); - if (!strcmp(band, "6GHz")) + if (band && !strcmp(band, "6GHz")) fprintf(wpa_supplicant, " he=1\n"); else fprintf(wpa_supplicant, " vht=1\n");