diff options
| author | Michael Biebl <biebl@debian.org> | 2025-02-12 13:46:50 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2025-02-12 13:46:50 +0100 |
| commit | 8bdf070ff046f482f6eb5e2b15ebc216f5d1e3da (patch) | |
| tree | f706478d189d54c6532e8863d4b0d5ff5575af60 /src/core/ndisc | |
| parent | 818258cf34b83fbc754633295e1052d4752d7b15 (diff) | |
New upstream version 1.51.90 upstream/1.51.90
Diffstat (limited to 'src/core/ndisc')
| -rw-r--r-- | src/core/ndisc/nm-fake-ndisc.c | 2 | ||||
| -rw-r--r-- | src/core/ndisc/nm-lndp-ndisc.c | 2 | ||||
| -rw-r--r-- | src/core/ndisc/nm-ndisc.c | 37 | ||||
| -rw-r--r-- | src/core/ndisc/nm-ndisc.h | 2 | ||||
| -rw-r--r-- | src/core/ndisc/tests/test-ndisc-linux.c | 2 |
5 files changed, 21 insertions, 24 deletions
diff --git a/src/core/ndisc/nm-fake-ndisc.c b/src/core/ndisc/nm-fake-ndisc.c index f0b6dcf6..b2858848 100644 --- a/src/core/ndisc/nm-fake-ndisc.c +++ b/src/core/ndisc/nm-fake-ndisc.c @@ -161,7 +161,7 @@ nm_fake_ndisc_add_prefix(NMFakeNDisc *self, g_assert(ra); prefix = nm_g_array_append_new(ra->prefixes, FakePrefix); - *prefix = (FakePrefix){ + *prefix = (FakePrefix) { .plen = plen, .expiry_msec = expiry_msec, .expiry_preferred_msec = expiry_preferred_msec, diff --git a/src/core/ndisc/nm-lndp-ndisc.c b/src/core/ndisc/nm-lndp-ndisc.c index eea79373..33e9ebf3 100644 --- a/src/core/ndisc/nm-lndp-ndisc.c +++ b/src/core/ndisc/nm-lndp-ndisc.c @@ -181,7 +181,7 @@ receive_ra(struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) * SHOULD NOT appear on the default router list. * * We handle that by tracking a gateway that expires right now. */ - gateway = (NMNDiscGateway){ + gateway = (NMNDiscGateway) { .address = gateway_addr, .expiry_msec = _nm_ndisc_lifetime_to_expiry(now_msec, ndp_msgra_router_lifetime(msgra)), .preference = _route_preference_coerce(ndp_msgra_route_preference(msgra)), diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index 86b7da6e..ad2edd8d 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -130,7 +130,7 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx, const NMNDiscAddress *ndisc_addr = &rdata->addresses[i]; NMPlatformIP6Address a; - a = (NMPlatformIP6Address){ + a = (NMPlatformIP6Address) { .ifindex = ifindex, .address = ndisc_addr->address, .plen = 64, @@ -151,7 +151,7 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx, const NMNDiscRoute *ndisc_route = &rdata->routes[i]; NMPlatformIP6Route r; - r = (NMPlatformIP6Route){ + r = (NMPlatformIP6Route) { .ifindex = ifindex, .network = ndisc_route->network, .plen = ndisc_route->plen, @@ -205,10 +205,7 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx, } for (i = 0; i < rdata->dns_servers_n; i++) { - nm_l3_config_data_add_nameserver_detail(l3cd, - AF_INET6, - &rdata->dns_servers[i].address, - NULL); + nm_l3_config_data_add_nameserver_addr(l3cd, AF_INET6, &rdata->dns_servers[i].address); } for (i = 0; i < rdata->dns_domains_n; i++) @@ -836,7 +833,7 @@ nm_ndisc_add_dns_domain(NMNDisc *ndisc, const NMNDiscDNSDomain *new_item, gint64 return FALSE; item = nm_g_array_append_new(rdata->dns_domains, NMNDiscDNSDomain); - *item = (NMNDiscDNSDomain){ + *item = (NMNDiscDNSDomain) { .domain = g_strdup(new_item->domain), .expiry_msec = new_item->expiry_msec, }; @@ -991,9 +988,8 @@ announce_router(NMNDisc *ndisc) /* Schedule next initial announcement retransmit. */ priv->send_ra_id = - g_timeout_add_seconds(nm_random_u64_range_full(NM_NDISC_ROUTER_ADVERT_DELAY, - NM_NDISC_ROUTER_ADVERT_INITIAL_INTERVAL, - FALSE), + g_timeout_add_seconds(nm_random_u64_range(NM_NDISC_ROUTER_ADVERT_DELAY, + NM_NDISC_ROUTER_ADVERT_INITIAL_INTERVAL), (GSourceFunc) announce_router, ndisc); } else { @@ -1027,9 +1023,10 @@ announce_router_initial(NMNDisc *ndisc) /* Schedule the initial send rather early. Clamp the delay by minimal * delay and not the initial advert internal so that we start fast. */ if (G_LIKELY(!priv->send_ra_id)) { - priv->send_ra_id = g_timeout_add_seconds(nm_random_u64_range(NM_NDISC_ROUTER_ADVERT_DELAY), - (GSourceFunc) announce_router, - ndisc); + priv->send_ra_id = + g_timeout_add_seconds(nm_random_u64_range(0, NM_NDISC_ROUTER_ADVERT_DELAY), + (GSourceFunc) announce_router, + ndisc); } } @@ -1045,7 +1042,7 @@ announce_router_solicited(NMNDisc *ndisc) nm_clear_g_source(&priv->send_ra_id); if (!priv->send_ra_id) { - priv->send_ra_id = g_timeout_add(nm_random_u64_range(NM_NDISC_ROUTER_ADVERT_DELAY_MS), + priv->send_ra_id = g_timeout_add(nm_random_u64_range(0, NM_NDISC_ROUTER_ADVERT_DELAY_MS), (GSourceFunc) announce_router, ndisc); } @@ -1090,7 +1087,7 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd) if (!lifetime) continue; - a = (NMNDiscAddress){ + a = (NMNDiscAddress) { .address = addr->address, .expiry_msec = _nm_ndisc_lifetime_to_expiry(NM_NDISC_EXPIRY_BASE_TIMESTAMP, lifetime), .expiry_preferred_msec = @@ -1106,14 +1103,14 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd) if (l3cd) strvarr = nm_l3_config_data_get_nameservers(l3cd, AF_INET6, &len); for (i = 0; i < len; i++) { - struct in6_addr a; + NMIPAddr a; NMNDiscDNSServer n; - if (!nm_utils_dnsname_parse_assert(AF_INET6, strvarr[i], NULL, &a, NULL)) + if (!nm_dns_uri_parse_plain(AF_INET6, strvarr[i], NULL, &a)) continue; - n = (NMNDiscDNSServer){ - .address = a, + n = (NMNDiscDNSServer) { + .address = a.addr6, .expiry_msec = _nm_ndisc_lifetime_to_expiry(NM_NDISC_EXPIRY_BASE_TIMESTAMP, NM_NDISC_ROUTER_LIFETIME), }; @@ -1128,7 +1125,7 @@ nm_ndisc_set_config(NMNDisc *ndisc, const NML3ConfigData *l3cd) for (i = 0; i < len; i++) { NMNDiscDNSDomain n; - n = (NMNDiscDNSDomain){ + n = (NMNDiscDNSDomain) { .domain = (char *) strvarr[i], .expiry_msec = _nm_ndisc_lifetime_to_expiry(NM_NDISC_EXPIRY_BASE_TIMESTAMP, NM_NDISC_ROUTER_LIFETIME), diff --git a/src/core/ndisc/nm-ndisc.h b/src/core/ndisc/nm-ndisc.h index b8f8b06e..8f1a12a2 100644 --- a/src/core/ndisc/nm-ndisc.h +++ b/src/core/ndisc/nm-ndisc.h @@ -40,7 +40,7 @@ typedef enum { const char *nm_ndisc_dhcp_level_to_string(NMNDiscDHCPLevel level); -#define NM_NDISC_INFINITY_U32 ((uint32_t) - 1) +#define NM_NDISC_INFINITY_U32 ((uint32_t) -1) /* It's important that this is G_MAXINT64, so that we can meaningfully do * MIN(e1, e2) to find the minimum expiry time (and properly handle if any diff --git a/src/core/ndisc/tests/test-ndisc-linux.c b/src/core/ndisc/tests/test-ndisc-linux.c index 66c7e157..e4184184 100644 --- a/src/core/ndisc/tests/test-ndisc-linux.c +++ b/src/core/ndisc/tests/test-ndisc-linux.c @@ -62,7 +62,7 @@ main(int argc, char **argv) l3cfg = nm_netns_l3cfg_acquire(NM_NETNS_GET, ifindex); - config = (NMNDiscConfig){ + config = (NMNDiscConfig) { .l3cfg = l3cfg, .ifname = nm_l3cfg_get_ifname(l3cfg, TRUE), .stable_type = NM_UTILS_STABLE_TYPE_UUID, |