src: fix whitespace issues
authorÁlvaro Fernández Rojas <[email protected]>
Mon, 10 Nov 2025 12:36:33 +0000 (13:36 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Tue, 11 Nov 2025 11:46:15 +0000 (12:46 +0100)
- Remove double whitespaces.
- Convert whitespace alignments to tabs.
- Fix code comments using whitespaces.

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
15 files changed:
src/config.c
src/dhcpv4.c
src/dhcpv4.h
src/dhcpv6-ia.c
src/dhcpv6-ia.h
src/dhcpv6-pxe.c
src/dhcpv6.c
src/dhcpv6.h
src/ndp.c
src/netlink.c
src/odhcpd.c
src/odhcpd.h
src/router.c
src/router.h
src/ubus.c

index 6130b5f72400cd20e08eeb41ab485c6e8b8a1120..055cd5d81a514cf65d546e827af9695f49f64ba2 100644 (file)
@@ -49,7 +49,7 @@ struct config config = {
        .log_level_cmdline = false,
        .log_syslog = true,
        .default_duid = { 0 },
-       .default_duid_len  = 0,
+       .default_duid_len = 0,
 };
 
 struct sys_conf sys_conf = {
@@ -1179,7 +1179,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                else
                        error("Invalid %s value configured for interface '%s'",
                              iface_attrs[IFACE_ATTR_LEASETIME].name, iface->name);
-
        }
 
        if ((c = tb[IFACE_ATTR_MAX_PREFERRED_LIFETIME])) {
@@ -1470,7 +1469,6 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
                if(ra_hoplimit > AdvCurHopLimit)
                        warn("Clamped invalid %s value configured for interface '%s' to %d",
                             iface_attrs[IFACE_ATTR_RA_HOPLIMIT].name, iface->name, iface->ra_hoplimit);
-
        }
 
        iface->if_mtu = odhcpd_get_interface_config(iface->ifname, "mtu");
index 49fc76c43b5055cc2561f0b862268d13a1f57270..4c574af64716f6dad5acbaf611ebe5f2899ce2ca 100644 (file)
@@ -8,10 +8,9 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
- *
  */
 
 #include <time.h>
@@ -564,9 +563,9 @@ dhcpv4_lease(struct interface *iface, enum dhcpv4_msg req_msg, const uint8_t *re
 
                ubus_bcast_dhcp_event("dhcp.release", req_mac,
                                      (struct in_addr *)&lease->addr,
-                                      lease->hostname, iface->ifname);
-                dhcpv4_free_lease(lease);
-                lease = NULL;
+                                     lease->hostname, iface->ifname);
+               dhcpv4_free_lease(lease);
+               lease = NULL;
                break;
 
        case DHCPV4_MSG_DECLINE:
@@ -1395,13 +1394,13 @@ static int dhcpv4_setup_addresses(struct interface *iface)
        if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffff00) {           /* /24, 150 of 256, [100..249] */
                iface->dhcpv4_start_ip.s_addr = start | htonl(100);
                iface->dhcpv4_end_ip.s_addr = end | htonl(100 + 150 - 1);
-       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffff80) {    /* /25, 100 of 128, [20..119] */
+       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffff80) {    /* /25, 100 of 128, [20..119] */
                iface->dhcpv4_start_ip.s_addr = start | htonl(20);
                iface->dhcpv4_end_ip.s_addr = end | htonl(20 + 100 - 1);
-       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffffc0) {    /* /26, 50 of 64, [10..59] */
+       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffffc0) {    /* /26, 50 of 64, [10..59] */
                iface->dhcpv4_start_ip.s_addr = start | htonl(10);
                iface->dhcpv4_end_ip.s_addr = end | htonl(10 + 50 - 1);
-       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffffe0) {    /* /27, 20 of 32, [10..29] */
+       } else if (ntohl(iface->dhcpv4_mask.s_addr) <= 0xffffffe0) {    /* /27, 20 of 32, [10..29] */
                iface->dhcpv4_start_ip.s_addr = start | htonl(10);
                iface->dhcpv4_end_ip.s_addr = end | htonl(10 + 20 - 1);
        } else {                                                        /* /28, 10 of 16, [3..12] */
index 6599acf67b6c0b6c6017b689da61dcfc53b3bdb9..c120f7f6a92deb0722e7b763d6ca66de725cd43f 100644 (file)
@@ -1,15 +1,15 @@
 /**
- *   Copyright (C) 2012 Steven Barth <[email protected]>
- *   Copyright (C) 2016 Hans Dedecker <[email protected]>
+ * Copyright (C) 2012 Steven Barth <[email protected]>
+ * Copyright (C) 2016 Hans Dedecker <[email protected]>
  *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2
- *   as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License version 2 for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License version 2 for more details.
  *
  */
 
@@ -19,7 +19,7 @@
 #define DHCPV4_CLIENT_PORT 68
 #define DHCPV4_SERVER_PORT 67
 
-#define DHCPV4_FLAG_BROADCAST  0x8000
+#define DHCPV4_FLAG_BROADCAST 0x8000
 
 // RFC951, §3; RFC1542, §2.1; RFC2131, §2
 #define DHCPV4_MIN_PACKET_SIZE 300
index de9abd915e497fe34d27fc88a89b50b57961426e..3af3e42954e21c55c5c20ea6a219dc3c59d3c9ec 100644 (file)
@@ -8,7 +8,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -188,7 +188,7 @@ static int send_reconf(struct dhcpv6_lease *assign)
                .len = htons(1),
                .id = DHCPV6_MSG_RENEW,
        };
-       struct dhcpv6_auth_reconfigure auth =  {
+       struct dhcpv6_auth_reconfigure auth = {
                .type = htons(DHCPV6_OPT_AUTH),
                .len = htons(sizeof(struct dhcpv6_auth_reconfigure)),
                .protocol = 3,
@@ -383,8 +383,8 @@ static bool assign_pd(struct interface *iface, struct dhcpv6_lease *assign)
 }
 
 /* Check iid against reserved IPv6 interface identifiers.
-   Refer to:
    http://www.iana.org/assignments/ipv6-interface-ids */
+ * Refer to: http://www.iana.org/assignments/ipv6-interface-ids
+ */
 static bool is_reserved_ipv6_iid(uint64_t iid)
 {
        if (iid == 0x0000000000000000)
@@ -393,7 +393,8 @@ static bool is_reserved_ipv6_iid(uint64_t iid)
 
        if ((iid & 0xFFFFFFFFFF000000) == 0x02005EFFFE000000)
                /* Reserved IPv6 Interface Identifiers corresponding
-                  to the IANA Ethernet Block [RFC4291] */
+                * to the IANA Ethernet Block [RFC4291]
+                */
                return true;
 
        if ((iid & 0xFFFFFFFFFFFFFF80) == 0xFDFFFFFFFFFFFF80)
@@ -473,7 +474,7 @@ static void handle_addrlist_change(struct netevent_handler_info *info)
 
        list_for_each_entry_safe(c, d, &iface->ia_assignments, head) {
                if (c->clid_len == 0 ||
-                   !(c->flags & OAF_DHCPV6_PD) ||
+                   !(c->flags & OAF_DHCPV6_PD) ||
                    (!INFINITE_VALID(c->valid_until) && c->valid_until < now))
                        continue;
 
@@ -1018,7 +1019,7 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac
 
                        /*
                         * A requesting router can include a desired prefix length for its
-                        * delegation.  The delegating router (us) is not required to honor
+                        * delegation. The delegating router (us) is not required to honor
                         * the hint (RFC3633, section 11.2, we MAY choose to use the
                         * information in the option; RFC8168, section 3.2 has several SHOULDs
                         * about desired choices for selecting a prefix to delegate).
@@ -1028,17 +1029,17 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac
                         *
                         * If the minimum prefix length is set in this interface's
                         * configuration, we use it as a floor for the requested (hinted)
-                        * prefix length.  This allows us to conserve prefix space so that
-                        * any single router can't grab too much of it.  Consider if we have
-                        * an interface with a /56 prefix.  A requesting router could ask for
-                        * a /58 and take 1/4 of our total address space.  But if we set a
+                        * prefix length. This allows us to conserve prefix space so that
+                        * any single router can't grab too much of it. Consider if we have
+                        * an interface with a /56 prefix. A requesting router could ask for
+                        * a /58 and take 1/4 of our total address space. But if we set a
                         * minimum of /60, we can limit each requesting router to get only
                         * 1/16 of our total address space.
                         */
                        if (iface->dhcpv6_pd_min_len && reqlen < iface->dhcpv6_pd_min_len) {
-                           info("clamping requested PD from %d to %d", reqlen,
-                                iface->dhcpv6_pd_min_len);
-                           reqlen = iface->dhcpv6_pd_min_len;
+                               info("clamping requested PD from %d to %d", reqlen,
+                                    iface->dhcpv6_pd_min_len);
+                               reqlen = iface->dhcpv6_pd_min_len;
                        }
                } else if (is_na) {
                        uint8_t *sdata;
@@ -1068,7 +1069,7 @@ ssize_t dhcpv6_ia_handle_IAs(uint8_t *buf, size_t buflen, struct interface *ifac
 
                        /* Does the DUID match? */
                        if (c->clid_len != clid_len || memcmp(c->clid_data, clid_data, clid_len))
-                              continue;
+                               continue;
 
                        /* Does the IAID match? */
                        if (c->iaid != ia->iaid) {
@@ -1149,8 +1150,8 @@ proceed:
                                                        a->assigned_host_id = lease_cfg ? lease_cfg->hostid : 0;
                                                else
                                                        a->assigned_subnet_id = reqhint;
-                                               a->valid_until =  now;
-                                               a->preferred_until =  now;
+                                               a->valid_until = now;
+                                               a->preferred_until = now;
                                                a->iface = iface;
                                                a->flags = (is_pd ? OAF_DHCPV6_PD : OAF_DHCPV6_NA);
 
index e0618043d0c723edbb0fa6cd51b0cdc08d12df14..c75195bde79605baabc4095b1dd5088ad9721173 100644 (file)
@@ -8,7 +8,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -17,8 +17,9 @@
 #define _DHCPV6_IA_H_
 
 #define ADDR_ENTRY_VALID_IA_ADDR(iface, i, m, addrs) \
-    ((iface)->dhcpv6_assignall || (i) == (m) || \
-     (addrs)[(i)].prefix > 64)
+       ((iface)->dhcpv6_assignall || \
+        (i) == (m) || \
+        (addrs)[(i)].prefix > 64)
 
 size_t get_preferred_addr(const struct odhcpd_ipaddr *addrs, const size_t addrlen);
 
index e72a3174b7f3b06ed064d735baef8b94f3e7c83f..10f82dc37aa651d5e00624bee17e3bac190e5b13 100644 (file)
@@ -82,10 +82,10 @@ void ipv6_pxe_dump(void) {
                info("IPv6 PxE URLs:\n");
 
                list_for_each_entry(entry, &ipv6_pxe_list, list)
-                       info("    arch %04d = %s\n", entry->arch, entry->bootfile_url.payload);
+                       info("\tarch %04d = %s\n", entry->arch, entry->bootfile_url.payload);
 
                if (ipv6_pxe_default)
-                       info("    Default   = %s\n", ipv6_pxe_default->bootfile_url.payload);
+                       info("\tDefault   = %s\n", ipv6_pxe_default->bootfile_url.payload);
        }
 }
 
index 2cbcbbc9db65c9c326219dd9262c7a70262160e8..223c8a3fa0cfb97384bc876abdea4dc5d307b199 100644 (file)
@@ -8,10 +8,9 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
- *
  */
 
 #include <errno.h>
@@ -525,13 +524,13 @@ static void handle_client_request(void *addr, void *data, size_t len,
                case DHCPV6_OPT_NEW_POSIX_TIMEZONE:
                        posix_want = true;
                        posix_tz.type = htons(DHCPV6_OPT_NEW_POSIX_TIMEZONE);
-                       posix_tz.len  = htons(posix_len);
+                       posix_tz.len = htons(posix_len);
                        break;
 
                case DHCPV6_OPT_NEW_TZDB_TIMEZONE:
                        tzdb_want = true;
                        tzdb_tz.type = htons(DHCPV6_OPT_NEW_TZDB_TIMEZONE);
-                       tzdb_tz.len  = htons(tzdb_len);
+                       tzdb_tz.len = htons(tzdb_len);
                        break;
 
                case DHCPV6_OPT_DNR:
index de0362f63bc8510468be52ef47c633368688191b..af175c9549bd6df4828b6e06d525c468fe5f3c8b 100644 (file)
@@ -1,14 +1,14 @@
 /**
- *   Copyright (C) 2012 Steven Barth <[email protected]>
+ * Copyright (C) 2012 Steven Barth <[email protected]>
  *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2
- *   as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
  *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License version 2 for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License version 2 for more details.
  *
  */
 
@@ -86,7 +86,7 @@
 #define DHCPV6_STATUS_NOPREFIXAVAIL 6
 
 // I just remembered I have an old one lying around...
-#define DHCPV6_ENT_NO  30462
+#define DHCPV6_ENT_NO 30462
 #define DHCPV6_ENT_TYPE 1
 
 
index 25cc831a811c0a39e0cca410d5be634652685f96..58ed5f4c548df2a7ab6319635d46f01345fef3fc 100644 (file)
--- a/src/ndp.c
+++ b/src/ndp.c
@@ -7,7 +7,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -121,7 +121,7 @@ int ndp_setup_interface(struct interface *iface, bool enable)
                }
 
                if (setsockopt(iface->ndp_ping_fd, IPPROTO_RAW, IPV6_CHECKSUM,
-                               &val, sizeof(val)) < 0) {
+                              &val, sizeof(val)) < 0) {
                        error("setsockopt(IPV6_CHECKSUM): %m");
                        ret = -1;
                        goto out;
index 6de9ae74c807a4be97e31797abf70d6dd1eb1be1..393678d8b0bddd63407ba152343811e452edd54c 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
index 49912eda4ac87f12cfc314fcff9cfe16a71996fb..d41e4cd651b97574953e86fcc1b9304dac121492 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -587,14 +587,14 @@ time_t odhcpd_time(void)
 
 static const char hexdigits[] = "0123456789abcdef";
 static const int8_t hexvals[] = {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -2, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+       -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -2, -1, -1,
+       -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+       -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
+       -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+       -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+       -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+       -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
 };
 
 ssize_t odhcpd_unhexlify(uint8_t *dst, size_t len, const char *src)
index 04aa7ce5a0c6344901243badbcd1f980feeee258..520c27f87d66b585280f10822c87d7a0fa8238db 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -69,7 +69,7 @@
 #define ADDR_MATCH_PIO_FILTER(_addr, iface) (odhcpd_bmemcmp(&(_addr)->addr, \
                                                            &(iface)->pio_filter_addr, \
                                                            (iface)->pio_filter_length) != 0 || \
-                                            (_addr)->prefix < (iface)->pio_filter_length)
+                                            (_addr)->prefix < (iface)->pio_filter_length)
 
 struct interface;
 struct nl_sock;
@@ -77,13 +77,13 @@ extern struct config config;
 extern struct sys_conf sys_conf;
 
 void __iflog(int lvl, const char *fmt, ...);
-#define debug(fmt, ...)     __iflog(LOG_DEBUG, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define info(fmt, ...)      __iflog(LOG_INFO, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define notice(fmt, ...)    __iflog(LOG_NOTICE, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define warn(fmt, ...)      __iflog(LOG_WARNING, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define error(fmt, ...)     __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define critical(fmt, ...)  __iflog(LOG_CRIT, fmt __VA_OPT__(, ) __VA_ARGS__)
-#define alert(fmt, ...)     __iflog(LOG_ALERT, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define debug(fmt, ...) __iflog(LOG_DEBUG, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define info(fmt, ...) __iflog(LOG_INFO, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define notice(fmt, ...) __iflog(LOG_NOTICE, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define warn(fmt, ...) __iflog(LOG_WARNING, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define error(fmt, ...) __iflog(LOG_ERR, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define critical(fmt, ...) __iflog(LOG_CRIT, fmt __VA_OPT__(, ) __VA_ARGS__)
+#define alert(fmt, ...) __iflog(LOG_ALERT, fmt __VA_OPT__(, ) __VA_ARGS__)
 #define emergency(fmt, ...) __iflog(LOG_EMERG, fmt __VA_OPT__(, ) __VA_ARGS__)
 
 
index a2e95a5abc6d83eaa184891d66492c73306bb2be..621a0cdb1597e2c82931c3fa53021e5f0e9a1b39 100644 (file)
@@ -8,7 +8,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -349,10 +349,11 @@ static int calc_adv_interval(struct interface *iface, uint32_t lowest_found_life
        msecs = (labs(msecs) % ((*maxival != minival) ? (*maxival - minival)*1000 : 500)) +
                        minival*1000;
 
-       /* RFC 2461 6.2.4 For the first MAX_INITIAL_RTR_ADVERTISEMENTS advertisements */
-       /* if the timer is bigger than MAX_INITIAL_RTR_ADVERT_INTERVAL it should be   */
-       /* set to MAX_INITIAL_RTR_ADVERT_INTERVAL                                     */
-       /* Off by one as an initial interval timer has already expired                */
+       /* RFC 2461 6.2.4 For the first MAX_INITIAL_RTR_ADVERTISEMENTS advertisements
+        * if the timer is bigger than MAX_INITIAL_RTR_ADVERT_INTERVAL it should be
+        * set to MAX_INITIAL_RTR_ADVERT_INTERVAL
+        * Off by one as an initial interval timer has already expired
+        */
        if ((iface->ra_sent + 1) < MaxInitialRtAdvs && msecs > MaxInitialRtrAdvInterval*1000)
                msecs = MaxInitialRtrAdvInterval*1000;
 
@@ -474,7 +475,7 @@ static void router_add_ra_pio(struct interface *iface,
 
        new_pios = realloc(iface->pios, sizeof(struct ra_pio) * (iface->pio_cnt + 1));
        if (!new_pios)
-        return;
+               return;
 
        iface->pios = new_pios;
        pio = &iface->pios[iface->pio_cnt];
@@ -882,7 +883,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
                pref64->type = ND_OPT_PREF64;
                pref64->len = 2;
                pref64->lifetime_plc = htons((0xfff8 & pref64_lifetime) |
-                                               (0x7 & iface->pref64_plc));
+                                            (0x7 & iface->pref64_plc));
                memcpy(pref64->prefix, iface->pref64_prefix, sizeof(pref64->prefix));
        }
        iov[IOV_RA_PREF64].iov_base = (char *)pref64;
@@ -941,7 +942,7 @@ static int send_router_advert(struct interface *iface, const struct in6_addr *fr
         *    L-3:   An IPv6 CE router MUST advertise itself as a router for the
         *           delegated prefix(es) (and ULA prefix if configured to provide
         *           ULA addressing) using the "Route Information Option" specified
-        *           in Section 2.3 of [RFC4191].  This advertisement is
+        *           in Section 2.3 of [RFC4191]. This advertisement is
         *           independent of having or not having IPv6 connectivity on the
         *           WAN interface.
         */
@@ -1181,7 +1182,7 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t
                if (c->ra_mtu && mtu_opt) {
                        if (ingress_mtu_val != c->ra_mtu) {
                                debug("Rewriting RA MTU from %u to %u on %s",
-                                      ingress_mtu_val, c->ra_mtu, c->name);
+                                     ingress_mtu_val, c->ra_mtu, c->name);
                                mtu_opt->nd_opt_mtu_mtu = htonl(c->ra_mtu);
                        }
                }
index 5502a0d56042e56bc13ee2c5d5827f3e14b4b555..6577667d07a5c6d54adce3ef922c95b4c24c3d2d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU General Public License for more details.
  *
  */
@@ -35,60 +35,60 @@ struct icmpv6_opt {
 #define MaxInitialRtrAdvInterval       16
 #define MaxInitialRtAdvs               3
 /* RFC8319 §4
      This document updates §4.2 and 6.2.1 of [RFC4861] to change
      the following router configuration variables.
-
      In §6.2.1, inside the paragraph that defines
      MaxRtrAdvInterval, change 1800 to 65535 seconds.
-
      In §6.2.1, inside the paragraph that defines
      AdvDefaultLifetime, change 9000 to 65535 seconds.
-*/
* This document updates §4.2 and 6.2.1 of [RFC4861] to change
* the following router configuration variables.
+ *
* In §6.2.1, inside the paragraph that defines
* MaxRtrAdvInterval, change 1800 to 65535 seconds.
+ *
* In §6.2.1, inside the paragraph that defines
* AdvDefaultLifetime, change 9000 to 65535 seconds.
+ */
 #define MaxRtrAdvInterval                              65535
 #define MinRtrAdvInterval                              3
 #define AdvDefaultLifetime                             65535
 /* RFC8319 §4
      This document updates §4.2 and 6.2.1 of [RFC4861] to change
      the following router configuration variables.
-
      In §4.2, inside the paragraph that defines Router Lifetime,
      change 9000 to 65535 seconds.
-
      Note: this is 16 bit Router Lifetime field in RA packets
-*/
* This document updates §4.2 and 6.2.1 of [RFC4861] to change
* the following router configuration variables.
+ *
* In §4.2, inside the paragraph that defines Router Lifetime,
* change 9000 to 65535 seconds.
+ *
* Note: this is 16 bit Router Lifetime field in RA packets
+ */
 /* RFC9096 defines recommended option lifetimes configuration values
      ND_PREFERRED_LIMIT 2700
      ND_VALID_LIMIT 5400
-
      RFC9096  §3.4
      CE routers SHOULD set the "Router Lifetime" of Router Advertisement
      (RA) messages to ND_PREFERRED_LIMIT.
-
      Note: while the RFC recommends SHOULD of ND_PREFERRED_LIMIT, this
      define is used to cap values to a sane ceiling, i.e. ND_VALID_LIMIT.
-*/
* ND_PREFERRED_LIMIT 2700
* ND_VALID_LIMIT 5400
+ *
* RFC9096 §3.4
* CE routers SHOULD set the "Router Lifetime" of Router Advertisement
* (RA) messages to ND_PREFERRED_LIMIT.
+ *
* Note: while the RFC recommends SHOULD of ND_PREFERRED_LIMIT, this
* define is used to cap values to a sane ceiling, i.e. ND_VALID_LIMIT.
+ */
 #define RouterLifetime                                 5400
 /* RFC4861 §6.2.1 : AdvReachableTime :
  * MUST be no greater than 3,600,000 msec
  */
 #define AdvReachableTime                               3600000
 /* RFC4861 §6.2.1 : AdvCurHopLimit
      The value should be set to the current
      diameter of the Internet.  The value zero means
      unspecified (by this router).
-
      Note: this value is an 8 bit int, so max 255.
-*/
* The value should be set to the current
* diameter of the Internet. The value zero means
* unspecified (by this router).
+ *
* Note: this value is an 8 bit int, so max 255.
+ */
 #define AdvCurHopLimit                                 255
 /* RFC4861 §10 - constants
      Node constants:
              RETRANS_TIMER                 1,000 milliseconds
-*/
* Node constants:
*     RETRANS_TIMER 1,000 milliseconds
+ */
 #define RETRANS_TIMER_MAX                              60000
 /* RFC2460 §5
  IPv6 requires that every link in the internet have an MTU of 1280
  octets or greater.
-*/
* IPv6 requires that every link in the internet have an MTU of 1280
* octets or greater.
+ */
 #define RA_MTU_MIN                                             1280
 #define RA_MTU_MAX                                             65535
 
index e589d4e00a7586cb32a5d26f90eb87a7f53467d8..7378f0a9fd673c6e8fb2c2af3d1bd97f29e6ef2c 100644 (file)
@@ -247,13 +247,13 @@ static struct ubus_method main_object_methods[] = {
 };
 
 static struct ubus_object_type main_object_type =
-               UBUS_OBJECT_TYPE("dhcp", main_object_methods);
+       UBUS_OBJECT_TYPE("dhcp", main_object_methods);
 
 static struct ubus_object main_object = {
-        .name = "dhcp",
-        .type = &main_object_type,
-        .methods = main_object_methods,
-        .n_methods = ARRAY_SIZE(main_object_methods),
+       .name = "dhcp",
+       .type = &main_object_type,
+       .methods = main_object_methods,
+       .n_methods = ARRAY_SIZE(main_object_methods),
 };
 
 
@@ -413,8 +413,9 @@ void ubus_bcast_dhcp_event(const char *type, const uint8_t *mac,
        ubus_notify(ubus, &main_object, type, b.head, -1);
 }
 
-static void handle_event(_unused struct ubus_context *ctx, _unused struct ubus_event_handler *ev,
-                _unused const char *type, struct blob_attr *msg)
+static void handle_event(_unused struct ubus_context *ctx,
+                        _unused struct ubus_event_handler *ev,
+                        _unused const char *type, struct blob_attr *msg)
 {
        struct blob_attr *tb[OBJ_ATTR_MAX];
        blobmsg_parse(obj_attrs, OBJ_ATTR_MAX, tb, blob_data(msg), blob_len(msg));