]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd-network/sd-radv.c
sd-radv: follow our usualy rule that destructors can take NULL
[thirdparty/systemd.git] / src / libsystemd-network / sd-radv.c
index a7bc422db0f06473d20456606415d85f0bba065b..b45e80e4c167f212df1ee32bc4c156efdb91a508 100644 (file)
@@ -88,7 +88,8 @@ static void radv_reset(sd_radv *ra) {
 }
 
 static sd_radv *radv_free(sd_radv *ra) {
-        assert(ra);
+        if (!ra)
+                return NULL;
 
         while (ra->prefixes) {
                 sd_radv_prefix *p = ra->prefixes;
@@ -113,8 +114,7 @@ static sd_radv *radv_free(sd_radv *ra) {
 
 DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(sd_radv, sd_radv, radv_free);
 
-static int radv_send(sd_radv *ra, const struct in6_addr *dst,
-                     const uint32_t router_lifetime) {
+static int radv_send(sd_radv *ra, const struct in6_addr *dst, uint32_t router_lifetime) {
         sd_radv_prefix *p;
         struct sockaddr_in6 dst_addr = {
                 .sin6_family = AF_INET6,
@@ -146,11 +146,13 @@ static int radv_send(sd_radv *ra, const struct in6_addr *dst,
         usec_t time_now;
         int r;
 
+        assert(ra);
+
         r = sd_event_now(ra->event, clock_boottime_or_monotonic(), &time_now);
         if (r < 0)
                 return r;
 
-        if (dst && !in_addr_is_null(AF_INET6, (union in_addr_union*) dst))
+        if (dst && !IN6_IS_ADDR_UNSPECIFIED(dst))
                 dst_addr.sin6_addr = *dst;
 
         adv.nd_ra_type = ND_ROUTER_ADVERT;