diff options
Diffstat (limited to 'src/ndisc')
| -rw-r--r-- | src/ndisc/nm-fake-ndisc.c | 1 | ||||
| -rw-r--r-- | src/ndisc/nm-lndp-ndisc.c | 37 | ||||
| -rw-r--r-- | src/ndisc/nm-ndisc.c | 10 | ||||
| -rw-r--r-- | src/ndisc/tests/meson.build | 3 | ||||
| -rw-r--r-- | src/ndisc/tests/test-ndisc-fake.c | 1 | ||||
| -rw-r--r-- | src/ndisc/tests/test-ndisc-linux.c | 1 |
6 files changed, 25 insertions, 28 deletions
diff --git a/src/ndisc/nm-fake-ndisc.c b/src/ndisc/nm-fake-ndisc.c index 6e9a72c6..f4719231 100644 --- a/src/ndisc/nm-fake-ndisc.c +++ b/src/ndisc/nm-fake-ndisc.c @@ -22,7 +22,6 @@ #include "nm-fake-ndisc.h" -#include <string.h> #include <arpa/inet.h> #include "nm-ndisc-private.h" diff --git a/src/ndisc/nm-lndp-ndisc.c b/src/ndisc/nm-lndp-ndisc.c index e1003ad1..2dd7e7d8 100644 --- a/src/ndisc/nm-lndp-ndisc.c +++ b/src/ndisc/nm-lndp-ndisc.c @@ -22,7 +22,6 @@ #include "nm-lndp-ndisc.h" -#include <string.h> #include <arpa/inet.h> #include <netinet/icmp6.h> /* stdarg.h included because of a bug in ndp.h */ @@ -73,7 +72,6 @@ send_rs (NMNDisc *ndisc, GError **error) errsv = ndp_msg_new (&msg, NDP_MSG_RS); if (errsv) { - errsv = errsv > 0 ? errsv : -errsv; g_set_error_literal (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "cannot create router solicitation"); return FALSE; @@ -83,10 +81,10 @@ send_rs (NMNDisc *ndisc, GError **error) errsv = ndp_msg_send (priv->ndp, msg); ndp_msg_destroy (msg); if (errsv) { - errsv = errsv > 0 ? errsv : -errsv; + errsv = nm_errno_native (errsv); g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "%s (%d)", - g_strerror (errsv), errsv); + nm_strerror_native (errsv), errsv); return FALSE; } @@ -259,7 +257,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) /* Pad the lifetime somewhat to give a bit of slack in cases * where one RA gets lost or something (which can happen on unreliable - * links like WiFi where certain types of frames are not retransmitted). + * links like Wi-Fi where certain types of frames are not retransmitted). * Note that 0 has special meaning and is therefore not adjusted. */ if (dns_server.lifetime && dns_server.lifetime < 7200) @@ -281,7 +279,7 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) /* Pad the lifetime somewhat to give a bit of slack in cases * where one RA gets lost or something (which can happen on unreliable - * links like WiFi where certain types of frames are not retransmitted). + * links like Wi-Fi where certain types of frames are not retransmitted). * Note that 0 has special meaning and is therefore not adjusted. */ if (dns_domain.lifetime && dns_domain.lifetime < 7200) @@ -361,7 +359,6 @@ send_ra (NMNDisc *ndisc, GError **error) errsv = ndp_msg_new (&msg, NDP_MSG_RA); if (errsv) { - errsv = errsv > 0 ? errsv : -errsv; g_set_error_literal (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "cannot create a router advertisement"); return FALSE; @@ -469,10 +466,10 @@ send_ra (NMNDisc *ndisc, GError **error) ndp_msg_destroy (msg); if (errsv) { - errsv = errsv > 0 ? errsv : -errsv; + errsv = nm_errno_native (errsv); g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "%s (%d)", - g_strerror (errsv), errsv); + nm_strerror_native (errsv), errsv); return FALSE; } @@ -536,17 +533,17 @@ start (NMNDisc *ndisc) /*****************************************************************************/ -static inline int +static int ipv6_sysctl_get (NMPlatform *platform, const char *ifname, const char *property, int min, int max, int defval) { - char buf[NM_UTILS_SYSCTL_IP_CONF_PATH_BUFSIZE]; - - return (int) nm_platform_sysctl_get_int_checked (platform, - NMP_SYSCTL_PATHID_ABSOLUTE (nm_utils_sysctl_ip_conf_path (AF_INET6, buf, ifname, property)), - 10, - min, - max, - defval); + return nm_platform_sysctl_ip_conf_get_int_checked (platform, + AF_INET6, + ifname, + property, + 10, + min, + max, + defval); } static void @@ -600,10 +597,10 @@ nm_lndp_ndisc_new (NMPlatform *platform, errsv = ndp_open (&priv->ndp); if (errsv != 0) { - errsv = errsv > 0 ? errsv : -errsv; + errsv = nm_errno_native (errsv); g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN, "failure creating libndp socket: %s (%d)", - g_strerror (errsv), errsv); + nm_strerror_native (errsv), errsv); g_object_unref (ndisc); return NULL; } diff --git a/src/ndisc/nm-ndisc.c b/src/ndisc/nm-ndisc.c index 1dd8398c..dd535630 100644 --- a/src/ndisc/nm-ndisc.c +++ b/src/ndisc/nm-ndisc.c @@ -24,7 +24,6 @@ #include <stdlib.h> #include <arpa/inet.h> -#include <string.h> #include "nm-setting-ip6-config.h" @@ -442,7 +441,7 @@ nm_ndisc_add_address (NMNDisc *ndisc, if (from_ra) { /* RFC4862 5.5.3.d, we find an existing address with the same prefix. - * (note that all prefixes at this point have implicity length /64). */ + * (note that all prefixes at this point have implicitly length /64). */ if (memcmp (&item->address, &new->address, 8) == 0) { existing = item; break; @@ -965,7 +964,9 @@ nm_ndisc_dad_failed (NMNDisc *ndisc, const struct in6_addr *address, gboolean em NMNDiscAddress *item = &g_array_index (rdata->addresses, NMNDiscAddress, i); if (IN6_ARE_ADDR_EQUAL (&item->address, address)) { - _LOGD ("DAD failed for discovered address %s", nm_utils_inet6_ntop (address, NULL)); + char sbuf[NM_UTILS_INET_ADDRSTRLEN]; + + _LOGD ("DAD failed for discovered address %s", nm_utils_inet6_ntop (address, sbuf)); changed = TRUE; if (!complete_address (ndisc, item)) { g_array_remove_index (rdata->addresses, i); @@ -1056,10 +1057,11 @@ _config_changed_log (NMNDisc *ndisc, NMNDiscConfigMap changed) } for (i = 0; i < rdata->routes->len; i++) { NMNDiscRoute *route = &g_array_index (rdata->routes, NMNDiscRoute, i); + char sbuf[NM_UTILS_INET_ADDRSTRLEN]; inet_ntop (AF_INET6, &route->network, addrstr, sizeof (addrstr)); _LOGD (" route %s/%u via %s pref %s exp %s", addrstr, (guint) route->plen, - nm_utils_inet6_ntop (&route->gateway, NULL), + nm_utils_inet6_ntop (&route->gateway, sbuf), nm_icmpv6_router_pref_to_string (route->preference, str_pref, sizeof (str_pref)), get_exp (str_exp, now_ns, route)); } diff --git a/src/ndisc/tests/meson.build b/src/ndisc/tests/meson.build index e0dc9aa6..99cf664e 100644 --- a/src/ndisc/tests/meson.build +++ b/src/ndisc/tests/meson.build @@ -9,7 +9,8 @@ exe = executable( test( 'ndisc/' + test_unit, test_script, - args: test_args + [exe.full_path()] + args: test_args + [exe.full_path()], + timeout: default_test_timeout, ) test = 'test-ndisc-linux' diff --git a/src/ndisc/tests/test-ndisc-fake.c b/src/ndisc/tests/test-ndisc-fake.c index 268f3b49..d2291d44 100644 --- a/src/ndisc/tests/test-ndisc-fake.c +++ b/src/ndisc/tests/test-ndisc-fake.c @@ -20,7 +20,6 @@ #include "nm-default.h" -#include <string.h> #include <syslog.h> #include "ndisc/nm-ndisc.h" diff --git a/src/ndisc/tests/test-ndisc-linux.c b/src/ndisc/tests/test-ndisc-linux.c index 2764b6c0..d47c0018 100644 --- a/src/ndisc/tests/test-ndisc-linux.c +++ b/src/ndisc/tests/test-ndisc-linux.c @@ -20,7 +20,6 @@ #include "nm-default.h" -#include <string.h> #include <syslog.h> #include "ndisc/nm-ndisc.h" |