Thomas Haller 2021-05-11 14:00:17 +02:00
commit 17f45689bf
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
20 changed files with 195 additions and 121 deletions

View file

@ -1591,7 +1591,7 @@ ip4_config_to_iwd_config(GKeyFile *file, NMSettingIPConfig *s_ip, GError **error
if (num) {
NMIPAddress *addr = nm_setting_ip_config_get_address(s_ip, 0);
guint prefix = nm_ip_address_get_prefix(addr);
in_addr_t netmask = htonl(0xffffffffu << (32 - prefix));
in_addr_t netmask = _nm_utils_ip4_prefix_to_netmask(prefix);
char buf[INET_ADDRSTRLEN];
nm_ip_address_get_address_binary(addr, &ip);

View file

@ -85,29 +85,29 @@ lease_to_ip4_config(NMDedupMultiIndex *multi_idx,
const struct in_addr * addr_list;
char addr_str[NM_UTILS_INET_ADDRSTRLEN];
const char * s;
nm_auto_free_gstring GString *str = NULL;
gs_free sd_dhcp_route **routes = NULL;
const char *const * search_domains = NULL;
guint16 mtu;
int i, num;
const void * data;
gsize data_len;
gboolean metered = FALSE;
gboolean has_router_from_classless = FALSE;
gboolean has_classless_route = FALSE;
gboolean has_static_route = FALSE;
const gint32 ts = nm_utils_get_monotonic_timestamp_sec();
gint64 ts_time = time(NULL);
struct in_addr a_address;
struct in_addr a_netmask;
struct in_addr a_next_server;
struct in_addr server_id;
struct in_addr broadcast;
const struct in_addr * a_router;
guint32 a_plen;
guint32 a_lifetime;
guint32 renewal;
guint32 rebinding;
nm_auto_free_gstring GString *str = NULL;
nm_auto_free sd_dhcp_route **routes = NULL;
const char *const * search_domains = NULL;
guint16 mtu;
int i, num;
const void * data;
gsize data_len;
gboolean metered = FALSE;
gboolean has_router_from_classless = FALSE;
gboolean has_classless_route = FALSE;
gboolean has_static_route = FALSE;
const gint32 ts = nm_utils_get_monotonic_timestamp_sec();
gint64 ts_time = time(NULL);
struct in_addr a_address;
struct in_addr a_netmask;
struct in_addr a_next_server;
struct in_addr server_id;
struct in_addr broadcast;
const struct in_addr * a_router;
guint32 a_plen;
guint32 a_lifetime;
guint32 renewal;
guint32 rebinding;
gs_free nm_sd_dhcp_option *private_options = NULL;
nm_assert(lease != NULL);

View file

@ -445,7 +445,7 @@ static NMAuthPolkitMode
_config_data_get_main_auth_polkit(const NMConfigData *self, gboolean *out_invalid_config)
{
NMAuthPolkitMode auth_polkit_mode;
const char * str;
gs_free char * str = NULL;
str = nm_config_data_get_value(self,
NM_CONFIG_KEYFILE_GROUP_MAIN,

View file

@ -16,6 +16,7 @@
#include <stdio.h>
#include "libnm-glib-aux/nm-enum-utils.h"
#include "libnm-glib-aux/nm-str-buf.h"
#include "libnm-glib-aux/nm-io-utils.h"
#include "nm-manager.h"
#include "nm-setting-connection.h"
@ -1551,36 +1552,40 @@ write_team_setting(NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
static gboolean
write_bridge_vlans(NMSetting * setting,
const char *property_name,
gboolean is_port,
shvarFile * ifcfg,
const char *key,
GError ** error)
{
gs_unref_ptrarray GPtrArray *vlans = NULL;
NMBridgeVlan * vlan;
GString * string;
guint i;
GPtrArray * vlans;
NMBridgeVlan * vlan;
nm_auto_str_buf NMStrBuf strbuf = NM_STR_BUF_INIT(0, FALSE);
guint i;
g_object_get(setting, property_name, &vlans, NULL);
if (is_port)
vlans = _nm_setting_bridge_port_get_vlans(NM_SETTING_BRIDGE_PORT(setting));
else
vlans = _nm_setting_bridge_get_vlans(NM_SETTING_BRIDGE(setting));
if (!vlans || !vlans->len)
return TRUE;
string = g_string_new("");
for (i = 0; i < vlans->len; i++) {
gs_free char *vlan_str = NULL;
vlan = vlans->pdata[i];
vlan_str = nm_bridge_vlan_to_str(vlan, error);
if (!vlan_str)
return FALSE;
if (string->len > 0)
g_string_append(string, ",");
nm_utils_escaped_tokens_escape_gstr_assert(vlan_str, ",", string);
if (!vlan_str) {
/* nm_bridge_vlan_to_str() cannot fail (for now). */
nm_assert_not_reached();
continue;
}
if (strbuf.len > 0)
nm_str_buf_append_c(&strbuf, ',');
nm_str_buf_append(&strbuf, nm_utils_escaped_tokens_escape_unnecessary(vlan_str, ","));
}
svSetValueStr(ifcfg, key, string->str);
g_string_free(string, TRUE);
svSetValueStr(ifcfg, key, nm_str_buf_get_str(&strbuf));
return TRUE;
}
@ -1816,11 +1821,7 @@ write_bridge_setting(NMConnection *connection, shvarFile *ifcfg, gboolean *wired
svSetValueStr(ifcfg, "BRIDGING_OPTS", opts->str);
g_string_free(opts, TRUE);
if (!write_bridge_vlans((NMSetting *) s_bridge,
NM_SETTING_BRIDGE_VLANS,
ifcfg,
"BRIDGE_VLANS",
error))
if (!write_bridge_vlans((NMSetting *) s_bridge, FALSE, ifcfg, "BRIDGE_VLANS", error))
return FALSE;
svSetValueStr(ifcfg, "TYPE", TYPE_BRIDGE);
@ -1871,11 +1872,7 @@ write_bridge_port_setting(NMConnection *connection, shvarFile *ifcfg, GError **e
svSetValueStr(ifcfg, "BRIDGING_OPTS", string->str);
g_string_free(string, TRUE);
if (!write_bridge_vlans((NMSetting *) s_port,
NM_SETTING_BRIDGE_PORT_VLANS,
ifcfg,
"BRIDGE_PORT_VLANS",
error))
if (!write_bridge_vlans((NMSetting *) s_port, TRUE, ifcfg, "BRIDGE_PORT_VLANS", error))
return FALSE;
return TRUE;

View file

@ -14,6 +14,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "libnm-glib-aux/nm-str-buf.h"
#include "libnm-core-intern/nm-core-internal.h"
#include "nm-core-utils.h"
#include "libnm-glib-aux/nm-enum-utils.h"
@ -318,14 +319,14 @@ _ch_hex_get(char ch)
}
static void
_gstr_init(GString **str, const char *value, gsize i)
_strbuf_init(NMStrBuf *str, const char *value, gsize i)
{
nm_assert(str);
nm_assert(value);
if (!(*str)) {
/* if @str is not yet initialized, it allocates
* a new GString and copies @i characters from
if (str->allocated == 0) {
/* if @str is not yet initialized, it initializes
* a new NMStrBuf and copies @i characters from
* @value over.
*
* Unescaping usually does not extend the length of a string,
@ -335,20 +336,20 @@ _gstr_init(GString **str, const char *value, gsize i)
* (FACTOR*strlen(value) + CONST), which is non trivial to get
* right in all cases. Also, we would have to provision for the
* very unlikely extreme case.
* Instead, use a GString buffer which can grow as needed. But for an
* Instead, use a NMStrBuf buffer which can grow as needed. But for an
* initial guess, strlen(value) is a good start */
*str = g_string_new_len(NULL, strlen(value) + 3);
if (i)
g_string_append_len(*str, value, i);
nm_str_buf_maybe_expand(str, strlen(value) + 3u, FALSE);
nm_str_buf_append_len(str, value, i);
}
}
const char *
svUnescape(const char *value, char **to_free)
{
gsize i, j;
GString *str = NULL;
NMStrBuf str = NM_STR_BUF_INIT(0, FALSE);
int looks_like_old_svescaped = -1;
gsize i;
gsize j;
/* we handle bash syntax here (note that ifup has #!/bin/bash.
* Thus, see https://www.gnu.org/software/bash/manual/html_node/Quoting.html#Quoting */
@ -395,20 +396,20 @@ svUnescape(const char *value, char **to_free)
if (value[i] == '\\') {
/* backslash escape */
_gstr_init(&str, value, i);
_strbuf_init(&str, value, i);
i++;
if (G_UNLIKELY(value[i] == '\0')) {
/* we don't support line continuation */
goto out_error;
}
g_string_append_c(str, value[i]);
nm_str_buf_append_c(&str, value[i]);
i++;
goto loop1_next;
}
if (value[i] == '\'') {
/* single quotes */
_gstr_init(&str, value, i);
_strbuf_init(&str, value, i);
i++;
j = i;
while (TRUE) {
@ -420,14 +421,14 @@ svUnescape(const char *value, char **to_free)
break;
j++;
}
g_string_append_len(str, &value[i], j - i);
nm_str_buf_append_len(&str, &value[i], j - i);
i = j + 1;
goto loop1_next;
}
if (value[i] == '"') {
/* double quotes */
_gstr_init(&str, value, i);
_strbuf_init(&str, value, i);
i++;
while (TRUE) {
if (value[i] == '"') {
@ -466,11 +467,11 @@ svUnescape(const char *value, char **to_free)
if (looks_like_old_svescaped < 0)
looks_like_old_svescaped = _looks_like_old_svescaped(value);
if (!looks_like_old_svescaped)
g_string_append_c(str, '\\');
nm_str_buf_append_c(&str, '\\');
} else
g_string_append_c(str, '\\');
nm_str_buf_append_c(&str, '\\');
}
g_string_append_c(str, value[i]);
nm_str_buf_append_c(&str, value[i]);
i++;
}
goto loop1_next;
@ -478,7 +479,7 @@ svUnescape(const char *value, char **to_free)
if (value[i] == '$' && value[i + 1] == '\'') {
/* ANSI-C Quoting */
_gstr_init(&str, value, i);
_strbuf_init(&str, value, i);
i += 2;
while (TRUE) {
char ch;
@ -552,7 +553,7 @@ svUnescape(const char *value, char **to_free)
}
}
/* like bash, we cut too large numbers off. E.g. A=$'\772' becomes 0xfa */
g_string_append_c(str, (guint8) v);
nm_str_buf_append_c(&str, (guint8) v);
} else if (NM_IN_SET(value[i], 'x', 'u', 'U')) {
const char escape_type = value[i];
int max_digits = escape_type == 'x' ? 2 : escape_type == 'u' ? 4 : 8;
@ -561,8 +562,7 @@ svUnescape(const char *value, char **to_free)
i++;
if (!_ch_hex_is(value[i])) {
/* missing hex value after "\x" escape. This is treated like no escaping. */
g_string_append_c(str, '\\');
g_string_append_c(str, escape_type);
nm_str_buf_append_c(&str, '\\', escape_type);
} else {
v = _ch_hex_get(value[i]);
i++;
@ -574,22 +574,21 @@ svUnescape(const char *value, char **to_free)
i++;
}
if (escape_type == 'x')
g_string_append_c(str, v);
nm_str_buf_append_c(&str, v);
else {
/* we treat the unicode escapes as utf-8 encoded values. */
g_string_append_unichar(str, v);
nm_str_buf_append_unichar(&str, v);
}
}
} else {
g_string_append_c(str, '\\');
g_string_append_c(str, value[i]);
nm_str_buf_append_c(&str, '\\', value[i]);
i++;
}
goto loop_ansic_next;
}
} else
ch = value[i];
g_string_append_c(str, ch);
nm_str_buf_append_c(&str, ch);
i++;
loop_ansic_next:;
}
@ -603,8 +602,8 @@ loop_ansic_next:;
}
/* an unquoted, regular character. Just consume it directly. */
if (str)
g_string_append_c(str, value[i]);
if (str.allocated > 0)
nm_str_buf_append_c(&str, value[i]);
i++;
loop1_next:;
@ -614,18 +613,19 @@ loop1_next:;
out_value:
if (i == 0) {
nm_assert(!str);
nm_assert(str.allocated == 0);
nm_assert(!str._priv_str);
*to_free = NULL;
return "";
}
if (str) {
if (str->len == 0 || str->str[0] == '\0') {
g_string_free(str, TRUE);
if (str.allocated > 0) {
if (str.len == 0 || nm_str_buf_get_str_unsafe(&str)[0] == '\0') {
nm_str_buf_destroy(&str);
*to_free = NULL;
return "";
} else {
*to_free = g_string_free(str, FALSE);
*to_free = nm_str_buf_finalize(&str, NULL);
return *to_free;
}
}
@ -639,8 +639,7 @@ out_value:
return value;
out_error:
if (str)
g_string_free(str, TRUE);
nm_str_buf_destroy(&str);
*to_free = NULL;
return NULL;
}

View file

@ -247,11 +247,11 @@ _test_unbase64mem_mem(const char *base64, const guint8 *expected_arr, gsize expe
{
gs_free char *expected_base64 = NULL;
int r;
gs_free guint8 *exp2_arr = NULL;
gs_free guint8 *exp3_arr = NULL;
gsize exp2_len;
gsize exp3_len;
gsize i;
nm_auto_free guint8 *exp2_arr = NULL;
nm_auto_free guint8 *exp3_arr = NULL;
gsize exp2_len;
gsize exp3_len;
gsize i;
expected_base64 = g_base64_encode(expected_arr, expected_len);

View file

@ -755,8 +755,9 @@ nm_vpn_service_plugin_read_vpn_details(int fd, GHashTable **out_data, GHashTable
gs_unref_hashtable GHashTable *secrets = NULL;
gboolean success = FALSE;
GHashTable * hash = NULL;
GString * key = NULL, *val = NULL;
nm_auto_free_gstring GString *line = NULL;
nm_auto_free_gstring GString *key = NULL;
nm_auto_free_gstring GString *val = NULL;
nm_auto_free_gstring GString *line = NULL;
char c;
GString *str = NULL;

View file

@ -36,6 +36,9 @@ NM_AUTO_DEFINE_FCN0(NMTCQdisc *, _nm_auto_unref_tc_qdisc, nm_tc_qdisc_unref);
#define nm_auto_unref_tc_tfilter nm_auto(_nm_auto_unref_tc_tfilter)
NM_AUTO_DEFINE_FCN0(NMTCTfilter *, _nm_auto_unref_tc_tfilter, nm_tc_tfilter_unref);
#define nm_auto_unref_tc_action nm_auto(_nm_auto_unref_tc_action)
NM_AUTO_DEFINE_FCN0(NMTCAction *, _nm_auto_unref_tc_action, nm_tc_action_unref);
#define nm_auto_unref_bridge_vlan nm_auto(_nm_auto_unref_bridge_vlan)
NM_AUTO_DEFINE_FCN0(NMBridgeVlan *, _nm_auto_unref_bridge_vlan, nm_bridge_vlan_unref);

View file

@ -281,6 +281,14 @@ nm_setting_bridge_port_clear_vlans(NMSettingBridgePort *setting)
}
}
GPtrArray *
_nm_setting_bridge_port_get_vlans(NMSettingBridgePort *setting)
{
nm_assert(NM_IS_SETTING_BRIDGE_PORT(setting));
return NM_SETTING_BRIDGE_PORT_GET_PRIVATE(setting)->vlans;
}
/*****************************************************************************/
static gboolean

View file

@ -910,6 +910,16 @@ nm_setting_bridge_clear_vlans(NMSettingBridge *setting)
}
}
GPtrArray *
_nm_setting_bridge_get_vlans(NMSettingBridge *setting)
{
nm_assert(NM_IS_SETTING_BRIDGE(setting));
return NM_SETTING_BRIDGE_GET_PRIVATE(setting)->vlans;
}
/*****************************************************************************/
/**
* nm_setting_bridge_get_group_address:
* @setting: the #NMSettingBridge

View file

@ -2587,9 +2587,9 @@ nm_utils_tc_action_to_str(NMTCAction *action, GError **error)
NMTCAction *
nm_utils_tc_action_from_str(const char *str, GError **error)
{
const char * kind = NULL;
const char * rest = NULL;
NMTCAction * action = NULL;
const char * kind = NULL;
const char * rest = NULL;
nm_auto_unref_tc_action NMTCAction *action = NULL;
gs_unref_hashtable GHashTable *ht = NULL;
gs_unref_hashtable GHashTable * options = NULL;
GVariant * variant;
@ -2631,23 +2631,20 @@ nm_utils_tc_action_from_str(const char *str, GError **error)
gpointer key, value;
if (!attrs) {
nm_tc_action_unref(action);
g_set_error(error, 1, 0, _("unsupported action option: '%s'."), rest);
return NULL;
}
options = nm_utils_parse_variant_attributes(rest, ' ', ' ', FALSE, attrs, error);
if (!options) {
nm_tc_action_unref(action);
if (!options)
return NULL;
}
g_hash_table_iter_init(&iter, options);
while (g_hash_table_iter_next(&iter, &key, &value))
nm_tc_action_set_attribute(action, key, g_variant_ref_sink(value));
}
return action;
return g_steal_pointer(&action);
}
/*****************************************************************************/
@ -2738,14 +2735,14 @@ static const NMVariantAttributeSpec *const tc_tfilter_attribute_spec[] = {
NMTCTfilter *
nm_utils_tc_tfilter_from_str(const char *str, GError **error)
{
guint32 handle = TC_H_UNSPEC;
guint32 parent = TC_H_UNSPEC;
gs_free char * kind = NULL;
gs_free char * rest = NULL;
NMTCAction * action = NULL;
const char * extra_opts = NULL;
NMTCTfilter * tfilter = NULL;
gs_unref_hashtable GHashTable *ht = NULL;
guint32 handle = TC_H_UNSPEC;
guint32 parent = TC_H_UNSPEC;
gs_free char * kind = NULL;
gs_free char * rest = NULL;
nm_auto_unref_tc_action NMTCAction *action = NULL;
const char * extra_opts = NULL;
NMTCTfilter * tfilter = NULL;
gs_unref_hashtable GHashTable *ht = NULL;
GVariant * variant;
nm_assert(str);
@ -2785,10 +2782,8 @@ nm_utils_tc_tfilter_from_str(const char *str, GError **error)
return NULL;
nm_tc_tfilter_set_handle(tfilter, handle);
if (action) {
if (action)
nm_tc_tfilter_set_action(tfilter, action);
nm_tc_action_unref(action);
}
return tfilter;
}

View file

@ -509,6 +509,12 @@ gboolean _nm_setting_bond_option_supported(const char *option, NMBondMode mode);
/*****************************************************************************/
GPtrArray *_nm_setting_bridge_get_vlans(NMSettingBridge *setting);
GPtrArray *_nm_setting_bridge_port_get_vlans(NMSettingBridgePort *setting);
/*****************************************************************************/
NMSettingBluetooth *_nm_connection_get_setting_bluetooth_for_nap(NMConnection *connection);
/*****************************************************************************/

View file

@ -256,9 +256,15 @@ nm_jansson_json_as_int64(const NMJsonVt *vt, const nm_json_t *elem, gint64 *out_
if (!nm_json_is_integer(elem))
return -EINVAL;
/* assert that this integer is signed. */
G_STATIC_ASSERT_EXPR(((nm_json_int_t) -1) < 0);
v = vt->nm_json_integer_value(elem);
if (v < G_MININT64 || v > G_MAXINT64)
return -ERANGE;
if (sizeof(v) > sizeof(gint64)) {
if (v < G_MININT64 || v > G_MAXINT64)
return -ERANGE;
}
NM_SET_OUT(out_val, v);
return 1;
@ -275,10 +281,18 @@ nm_jansson_json_as_uint64(const NMJsonVt *vt, const nm_json_t *elem, guint64 *ou
if (!nm_json_is_integer(elem))
return -EINVAL;
/* assert that this integer is signed. */
G_STATIC_ASSERT_EXPR(((nm_json_int_t) -1) < 0);
v = vt->nm_json_integer_value(elem);
if (v < 0 || v > G_MAXUINT64)
if (v < 0)
return -ERANGE;
if (sizeof(v) > sizeof(gint64)) {
if (v > G_MAXUINT64)
return -ERANGE;
}
NM_SET_OUT(out_val, v);
return 1;
}

View file

@ -207,6 +207,17 @@ nm_str_buf_append_c_hex(NMStrBuf *strbuf, char ch, gboolean upper_case)
strbuf->_priv_str[strbuf->_priv_len++] = nm_hexchar((guchar) ch, upper_case);
}
static inline void
nm_str_buf_append_unichar(NMStrBuf *strbuf, gunichar wc)
{
int l;
nm_str_buf_maybe_expand(strbuf, 6 + 1, FALSE);
l = g_unichar_to_utf8(wc, &strbuf->_priv_str[strbuf->_priv_len]);
nm_assert(l > 0 && l <= 6);
strbuf->_priv_len += (gsize) l;
}
static inline void
nm_str_buf_append_len(NMStrBuf *strbuf, const char *str, gsize len)
{

View file

@ -2813,7 +2813,7 @@ nmtst_keyfile_get_num_keys(GKeyFile *keyfile, const char *group_name)
{
gs_strfreev char **keys = NULL;
gs_free_error GError *error = NULL;
gsize l;
gsize l = 0;
g_assert(keyfile);
g_assert(group_name);

View file

@ -237,6 +237,34 @@ test_nm_ip4_addr_is_localhost(void)
/*****************************************************************************/
static void
test_nm_utils_ip4_prefix_to_netmask(void)
{
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(0), ==, nmtst_inet4_from_string("0.0.0.0"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(1), ==, nmtst_inet4_from_string("128.0.0.0"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(2), ==, nmtst_inet4_from_string("192.0.0.0"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(16),
==,
nmtst_inet4_from_string("255.255.0.0"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(24),
==,
nmtst_inet4_from_string("255.255.255.0"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(30),
==,
nmtst_inet4_from_string("255.255.255.252"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(31),
==,
nmtst_inet4_from_string("255.255.255.254"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(32),
==,
nmtst_inet4_from_string("255.255.255.255"));
g_assert_cmpint(_nm_utils_ip4_prefix_to_netmask(33),
==,
nmtst_inet4_from_string("255.255.255.255"));
}
/*****************************************************************************/
static void
test_unaligned(void)
{
@ -1279,6 +1307,8 @@ main(int argc, char **argv)
g_test_add_func("/general/test_nm_strdup_int", test_nm_strdup_int);
g_test_add_func("/general/test_nm_strndup_a", test_nm_strndup_a);
g_test_add_func("/general/test_nm_ip4_addr_is_localhost", test_nm_ip4_addr_is_localhost);
g_test_add_func("/general/test_nm_utils_ip4_prefix_to_netmask",
test_nm_utils_ip4_prefix_to_netmask);
g_test_add_func("/general/test_unaligned", test_unaligned);
g_test_add_func("/general/test_strv_cmp", test_strv_cmp);
g_test_add_func("/general/test_strstrip_avoid_copy", test_strstrip_avoid_copy);

View file

@ -867,7 +867,7 @@ request_secrets_from_ui(RequestData *request)
if (nm_connection_is_type(request->connection, NM_SETTING_WIRELESS_SETTING_NAME)) {
NMSettingWireless *s_wireless;
GBytes * ssid;
char * ssid_utf8;
gs_free char * ssid_utf8 = NULL;
s_wireless = nm_connection_get_setting_wireless(request->connection);
ssid = nm_setting_wireless_get_ssid(s_wireless);

View file

@ -108,17 +108,17 @@ nmt_newt_button_build_component(NmtNewtComponent *component, gboolean sensitive)
{
NmtNewtButtonPrivate *priv = NMT_NEWT_BUTTON_GET_PRIVATE(component);
newtComponent co;
char * label = NULL, *label_lc;
gs_free char * label_lc = NULL;
if (sensitive) {
label_lc = nmt_newt_locale_from_utf8(priv->label);
co = newtCompactButton(-1, -1, label_lc);
g_free(label_lc);
} else {
gs_free char *label = NULL;
label = g_strdup_printf(" <%s>", priv->label);
label_lc = nmt_newt_locale_from_utf8(label);
co = newtLabel(-1, -1, label_lc);
g_free(label_lc);
newtLabelSetColors(co, NMT_NEWT_COLORSET_DISABLED_BUTTON);
}

View file

@ -4599,7 +4599,7 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection)
const char * psk = NULL;
const char * type = NULL;
GBytes * ssid_bytes;
char * ssid;
gs_free char * ssid = NULL;
GString * string;
s_wireless = nm_connection_get_setting_wireless(connection);

View file

@ -444,7 +444,7 @@ ip_route_transform_from_dest_string(GBinding * binding,
inet_pton(addr_family, addrstr, &v4);
if (nm_utils_ip_is_site_local(AF_INET, &v4)) {
prefix = nm_utils_ip4_get_default_prefix(v4);
if (v4 & (~nm_utils_ip4_prefix_to_netmask(prefix)))
if (v4 & (~_nm_utils_ip4_prefix_to_netmask(prefix)))
prefix = 32;
} else
prefix = 32;