]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: make ndisc_router_process_options() propagate error
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Feb 2019 05:34:25 +0000 (14:34 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Feb 2019 07:48:19 +0000 (16:48 +0900)
And its caller ignore the error.

src/network/networkd-ndisc.c

index c3053c007b8cf7e82f0d6f0b911e7265762b0f3f..d99c0670e8bb1abb1688d6e7817cefee36943a05 100644 (file)
@@ -493,7 +493,7 @@ static void ndisc_router_process_dnssl(Link *link, sd_ndisc_router *rt) {
         }
 }
 
-static void ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
+static int ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
         int r;
 
         assert(link);
@@ -503,18 +503,14 @@ static void ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
         for (;;) {
                 uint8_t type;
 
-                if (r < 0) {
-                        log_link_warning_errno(link, r, "Failed to iterate through options: %m");
-                        return;
-                }
+                if (r < 0)
+                        return log_link_warning_errno(link, r, "Failed to iterate through options: %m");
                 if (r == 0) /* EOF */
                         break;
 
                 r = sd_ndisc_router_option_get_type(rt, &type);
-                if (r < 0) {
-                        log_link_warning_errno(link, r, "Failed to get RA option type: %m");
-                        return;
-                }
+                if (r < 0)
+                        return log_link_warning_errno(link, r, "Failed to get RA option type: %m");
 
                 switch (type) {
 
@@ -522,10 +518,8 @@ static void ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
                         uint8_t flags;
 
                         r = sd_ndisc_router_prefix_get_flags(rt, &flags);
-                        if (r < 0) {
-                                log_link_warning_errno(link, r, "Failed to get RA prefix flags: %m");
-                                return;
-                        }
+                        if (r < 0)
+                                return log_link_warning_errno(link, r, "Failed to get RA prefix flags: %m");
 
                         if (link->network->ipv6_accept_ra_use_onlink_prefix)
                                 if (flags & ND_OPT_PI_FLAG_ONLINK)
@@ -555,6 +549,8 @@ static void ndisc_router_process_options(Link *link, sd_ndisc_router *rt) {
 
                 r = sd_ndisc_router_option_next(rt);
         }
+
+        return 0;
 }
 
 static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
@@ -581,8 +577,8 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
                 }
         }
 
-        ndisc_router_process_default(link, rt);
-        ndisc_router_process_options(link, rt);
+        (void) ndisc_router_process_default(link, rt);
+        (void) ndisc_router_process_options(link, rt);
 
         return r;
 }