config: fix invalid hoplimit in RA message
authorHans Dedecker <dedeckeh@gmail.com>
Mon, 15 May 2017 18:02:40 +0000 (20:02 +0200)
committerHans Dedecker <dedeckeh@gmail.com>
Mon, 15 May 2017 18:06:23 +0000 (20:06 +0200)
Don't send an invalid hoplimit in RA message when
the interface is shutdown due to a invalid configured
ra_hoplimit.

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
src/config.c

index 9b4fa461068423d504737eabe3631dcbfe92270b..7940095b409f1f2bf5bc7b58649a56dcfba210a7 100644 (file)
@@ -619,9 +619,11 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
        }
 
        if ((c = tb[IFACE_ATTR_RA_HOPLIMIT])) {
-               iface->ra_hoplimit = blobmsg_get_u32(c);
-               if (iface->ra_hoplimit > 255)
+               uint32_t ra_hoplimit = blobmsg_get_u32(c);
+               if (ra_hoplimit > 255)
                        goto err;
+
+               iface->ra_hoplimit = ra_hoplimit;
        }
 
        if ((c = tb[IFACE_ATTR_RA_MTU])) {