Re: [PATCH] wifi: allow autoconnect on AP/AdHoc mode connections with manual IP configuration
On Thu, 2016-02-11 at 14:39 -0600, Dan Williams wrote: > On Thu, 2016-02-11 at 13:21 +0100, Thomas Haller wrote: > > > > Patch lgtm, but it doesn't apply anywhere. > > Sorry, patch was against 1.0. I actually tried it on 1.0. But somehow I messed up, because now the patch cleanly applies there... Thomas signature.asc Description: This is a digitally signed message part ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[PATCH 1/1] shared: add nm_streq() and nm_streq0() macro
Using strcmp() to test for string equality is a well known pattern. However the inverse logic still hurts my brain every single time, especially in more complex expressions. nm_streq() should be preferred over strcmp(). And there is a counterpart nm_streq0() which uses g_strcmp0(). Kernel and systemd have also streq() macros. --- shared/nm-macros-internal.h | 5 + 1 file changed, 5 insertions(+) diff --git a/shared/nm-macros-internal.h b/shared/nm-macros-internal.h index 4b43b58..2612cff 100644 --- a/shared/nm-macros-internal.h +++ b/shared/nm-macros-internal.h @@ -242,6 +242,11 @@ _NM_IN_STRSET_streq (const char *x, const char *s) /*/ +#define nm_streq(s1, s2) (strcmp (s1, s2) == 0) +#define nm_streq0(s1, s2) (g_strcmp0 (s1, s2) == 0) + +/*/ + #define NM_PRINT_FMT_QUOTED(cond, prefix, str, suffix, str_else) \ (cond) ? (prefix) : "", \ (cond) ? (str) : (str_else), \ -- 2.5.0 ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
[PATCH 1/1] all/trivial: rename STRLEN() macro to NM_STRLEN()
We should not have defines/macros in header files without a nm/NM prefix. STRLEN() was one of the few offendors. --- clients/cli/settings.c| 8 ++--- libnm-core/nm-keyfile-reader.c| 12 libnm-core/nm-setting-8021x.c | 8 ++--- libnm-core/nm-utils.c | 2 +- libnm-core/tests/test-keyfile.c | 4 +-- libnm-util/nm-setting-8021x.c | 8 ++--- libnm-util/nm-utils.c | 2 +- shared/nm-macros-internal.h | 2 +- src/NetworkManagerUtils.c | 36 +++ src/dhcp-manager/nm-dhcp-client.c | 2 +- src/dhcp-manager/nm-dhcp-dhclient-utils.c | 6 ++-- src/dhcp-manager/nm-dhcp-systemd.c| 4 +-- src/dhcp-manager/tests/test-dhcp-dhclient.c | 4 +-- src/nm-config-data.c | 10 +++ src/nm-config.c | 10 +++ src/nm-dispatcher.c | 2 +- src/nm-logging.c | 2 +- src/nm-route-manager.c| 2 +- src/platform/nm-linux-platform.c | 4 +-- src/platform/nm-platform-utils.c | 4 +-- src/platform/nm-platform.c| 6 ++-- src/settings/nm-settings.c| 4 +-- src/settings/plugins/ibft/reader.c| 4 +-- src/settings/plugins/ifcfg-rh/reader.c| 2 +- src/settings/plugins/ifcfg-rh/utils.c | 8 ++--- src/settings/plugins/ifnet/net_utils.c| 2 +- src/settings/plugins/keyfile/tests/test-keyfile.c | 6 ++-- src/tests/test-general.c | 4 +-- 28 files changed, 84 insertions(+), 84 deletions(-) diff --git a/clients/cli/settings.c b/clients/cli/settings.c index baf0a92..fc7e0c6 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -3328,8 +3328,8 @@ nmc_property_connection_set_lldp (NMSetting *setting, const char *prop, char *p = val_strip; \ gboolean success; \ \ - if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ - p += STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ + if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ + p += NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ \ success = set_func (NM_SETTING_802_1X (setting), \ p, \ @@ -3350,8 +3350,8 @@ nmc_property_connection_set_lldp (NMSetting *setting, const char *prop, const char *path, *password; \ gboolean success; \ \ - if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ - p += STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ + if (strncmp (val_strip, NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ + p += NM_STRLEN (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ \ strv = nmc_strsplit_set (p, " \t,", 2); \ path = strv[0]; \ diff --git a/libnm-core/nm-keyfile-reader.c b/libnm-core/nm-keyfile-reader.c index 6a0584a..41cd9a7 100644 --- a/libnm-core/nm-keyfile-reader.c +++ b/libnm-core/nm-keyfile-reader.c @@ -874,17 +874,17 @@ handle_as_scheme (KeyfileReaderInfo *info, GBytes *bytes, NMSetting *setting, co /* It's the PATH scheme, can just set plain data. * In this case, @data_len includes */ - if ( data_len >= STRLEN (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH) + if ( data_len >= NM_STRLEN (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH) && g_str_has_prefix (data, NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)) { if (nm_setting_802_1x_check_cert_scheme (data, data_len + 1, NULL) == NM_SETTING_802_1X_CK_SCHEME_PATH) { - const char *path = [STRLEN (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)]; + const char *path = [NM_STRLEN (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)]; gs_free char *path_free = NULL; if (path[0] != '/') { /* we want to read absolute paths because we use keyfile as exchange * between different processes which might not have the same cwd. */ path = path_free = get_cert_path (info->base_dir, (const guint8 *) path, - data_len -
Re: Problems with gobi 4000 connecting via QMI
Hi, i was able to establish a connection via qmicli, but still not with NetworkManager/ModemManager, maybe this information can help to solve the problem: ThinClient,initial:root:/sys/devices/pci:00/:00:14.0/usb3/3-11 $ qmicli -d /dev/cdc-wdm0 --wds-start-network=web.vodafone.de --client-no-release-cid [/dev/cdc-wdm0] Network started Packet data handle: '1138180728' [/dev/cdc-wdm0] Client ID not released: Service: 'wds' CID: '9' ThinClient,initial:root:/sys/devices/pci:00/:00:14.0/usb3/3-11 $ /usr/sbin/dhcpcd -B -K -L -A -G -c /usr/libexec/nm-dhcp-helper -4 wwan0 wwan0: soliciting a DHCP lease wwan0: offered 109.46.87.132 from 109.46.87.129 wwan0: leased 109.46.87.132 for 7200 seconds wwan0: adding route to 109.46.87.128/29 ThinClient,initial:root:~ $ ifconfig wwan0 wwan0 Link encap:Ethernet HWaddr 1A:84:89:C5:C6:76 inet addr:109.46.87.132 Bcast:109.46.87.135 Mask:255.255.255.248 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:954 (954.0 B) TX bytes:1223 (1.1 KiB Harald ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: Problems with gobi 4000 connecting via QMI
On Fri, 2016-02-12 at 13:10 +0100, Harald Jung wrote: > Hi, > > i was able to establish a connection via qmicli, but still not with > NetworkManager/ModemManager, maybe this information can help to > solve > the problem: Good info actually; perhaps it's the IPv6 requests. If you set IPv6 method to "ignore" in NetworkManager does that make things work? Or with nmcli, something like: nmcli con mod ipv6.method ignore That should cause NM to stop requesting an IPV4V6 context. But also, what version of NetworkManager do you have? Recent versions of NM have fallback logic to try only IPV4 if V4V6 fails. Dan > > > ThinClient,initial:root:/sys/devices/pci:00/:00:14.0/usb3/3- > 11 $ > qmicli -d /dev/cdc-wdm0 --wds-start-network=web.vodafone.de > --client-no-release-cid > [/dev/cdc-wdm0] Network started > Packet data handle: '1138180728' > [/dev/cdc-wdm0] Client ID not released: > Service: 'wds' > CID: '9' > > ThinClient,initial:root:/sys/devices/pci:00/:00:14.0/usb3/3- > 11 $ > /usr/sbin/dhcpcd -B -K -L -A -G -c /usr/libexec/nm-dhcp-helper -4 > wwan0 > wwan0: soliciting a DHCP lease > wwan0: offered 109.46.87.132 from 109.46.87.129 > wwan0: leased 109.46.87.132 for 7200 seconds > wwan0: adding route to 109.46.87.128/29 > > ThinClient,initial:root:~ $ ifconfig wwan0 > wwan0 Link encap:Ethernet HWaddr 1A:84:89:C5:C6:76 > inet addr:109.46.87.132 Bcast:109.46.87.135 > Mask:255.255.255.248 > UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 > RX packets:3 errors:0 dropped:0 overruns:0 frame:0 > TX packets:4 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:954 (954.0 B) TX bytes:1223 (1.1 KiB > > > Harald ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list
Re: [PATCH 1/1] all/trivial: rename STRLEN() macro to NM_STRLEN()
On Fri, 2016-02-12 at 12:34 +0100, Thomas Haller wrote: > We should not have defines/macros in header files without a nm/NM > prefix. > STRLEN() was one of the few offendors. > --- LGTM. Dan > clients/cli/settings.c| 8 ++--- > libnm-core/nm-keyfile-reader.c| 12 > libnm-core/nm-setting-8021x.c | 8 ++--- > libnm-core/nm-utils.c | 2 +- > libnm-core/tests/test-keyfile.c | 4 +-- > libnm-util/nm-setting-8021x.c | 8 ++--- > libnm-util/nm-utils.c | 2 +- > shared/nm-macros-internal.h | 2 +- > src/NetworkManagerUtils.c | 36 +++ > > src/dhcp-manager/nm-dhcp-client.c | 2 +- > src/dhcp-manager/nm-dhcp-dhclient-utils.c | 6 ++-- > src/dhcp-manager/nm-dhcp-systemd.c| 4 +-- > src/dhcp-manager/tests/test-dhcp-dhclient.c | 4 +-- > src/nm-config-data.c | 10 +++ > src/nm-config.c | 10 +++ > src/nm-dispatcher.c | 2 +- > src/nm-logging.c | 2 +- > src/nm-route-manager.c| 2 +- > src/platform/nm-linux-platform.c | 4 +-- > src/platform/nm-platform-utils.c | 4 +-- > src/platform/nm-platform.c| 6 ++-- > src/settings/nm-settings.c| 4 +-- > src/settings/plugins/ibft/reader.c| 4 +-- > src/settings/plugins/ifcfg-rh/reader.c| 2 +- > src/settings/plugins/ifcfg-rh/utils.c | 8 ++--- > src/settings/plugins/ifnet/net_utils.c| 2 +- > src/settings/plugins/keyfile/tests/test-keyfile.c | 6 ++-- > src/tests/test-general.c | 4 +-- > 28 files changed, 84 insertions(+), 84 deletions(-) > > diff --git a/clients/cli/settings.c b/clients/cli/settings.c > index baf0a92..fc7e0c6 100644 > --- a/clients/cli/settings.c > +++ b/clients/cli/settings.c > @@ -3328,8 +3328,8 @@ nmc_property_connection_set_lldp (NMSetting > *setting, const char *prop, > char *p = val_strip; \ > gboolean success; \ > \ > - if (strncmp (val_strip, > NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ > - p += STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ > + if (strncmp (val_strip, > NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ > + p += NM_STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ > \ > success = set_func (NM_SETTING_802_1X (setting), \ > p, \ > @@ -3350,8 +3350,8 @@ nmc_property_connection_set_lldp (NMSetting > *setting, const char *prop, > const char *path, *password; \ > gboolean success; \ > \ > - if (strncmp (val_strip, > NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ > - p += STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ > + if (strncmp (val_strip, > NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH, NM_STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH)) == 0) \ > + p += NM_STRLEN > (NM_SETTING_802_1X_CERT_SCHEME_PREFIX_PATH); \ > \ > strv = nmc_strsplit_set (p, " \t,", 2); \ > path = strv[0]; \ > diff --git a/libnm-core/nm-keyfile-reader.c b/libnm-core/nm-keyfile- > reader.c > index 6a0584a..41cd9a7 100644 > --- a/libnm-core/nm-keyfile-reader.c > +++ b/libnm-core/nm-keyfile-reader.c > @@ -874,17 +874,17 @@ handle_as_scheme (KeyfileReaderInfo *info, > GBytes *bytes, NMSetting *setting, co > > /* It's the PATH scheme, can just set plain data. > * In this case, @data_len includes */ > - if ( data_len >= STRLEN > (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH) > + if ( data_len >= NM_STRLEN > (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH) > && g_str_has_prefix (data, > NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)) { > if (nm_setting_802_1x_check_cert_scheme (data, > data_len + 1, NULL) == NM_SETTING_802_1X_CK_SCHEME_PATH) { > - const char *path = [STRLEN > (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)]; > + const char *path = [NM_STRLEN > (NM_KEYFILE_CERT_SCHEME_PREFIX_PATH)]; > gs_free char *path_free = NULL; > > if (path[0] != '/') { > /* we want to read absolute paths > because we use keyfile as exchange > * between different processes which > might not have the
Re: [PATCH 1/1] shared: add nm_streq() and nm_streq0() macro
On Fri, 2016-02-12 at 12:34 +0100, Thomas Haller wrote: > Using strcmp() to test for string equality is a well known pattern. > However the inverse logic still hurts my brain every single time, > especially in more complex expressions. > > nm_streq() should be preferred over strcmp(). And there is a > counterpart > nm_streq0() which uses g_strcmp0(). > > Kernel and systemd have also streq() macros. Yeah, I like this. +1 Dan > --- > shared/nm-macros-internal.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/shared/nm-macros-internal.h b/shared/nm-macros- > internal.h > index 4b43b58..2612cff 100644 > --- a/shared/nm-macros-internal.h > +++ b/shared/nm-macros-internal.h > @@ -242,6 +242,11 @@ _NM_IN_STRSET_streq (const char *x, const char > *s) > > /*** > **/ > > +#define nm_streq(s1, s2) (strcmp (s1, s2) == 0) > +#define nm_streq0(s1, s2) (g_strcmp0 (s1, s2) == 0) > + > +/*** > **/ > + > #define NM_PRINT_FMT_QUOTED(cond, prefix, str, suffix, str_else) \ > (cond) ? (prefix) : "", \ > (cond) ? (str) : (str_else), \ ___ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list