summaryrefslogtreecommitdiff
path: root/usr.sbin/rad
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-03-30 17:47:49 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-03-30 17:47:49 +0000
commit7eaaf1957d5ceab21484b5357fecb1cdf2ce14aa (patch)
treea73a1ca017650e36fc7fd2697b2d0981c5ba6fbc /usr.sbin/rad
parentc91e468f38403508130e714656d0c151152f0f13 (diff)
Use defines instead of raw numbers for intervals specified by RFC
4861. No binary change. While here consistently use #define<tab> instead of #define<space>.
Diffstat (limited to 'usr.sbin/rad')
-rw-r--r--usr.sbin/rad/parse.y6
-rw-r--r--usr.sbin/rad/rad.c4
-rw-r--r--usr.sbin/rad/rad.h26
3 files changed, 19 insertions, 17 deletions
diff --git a/usr.sbin/rad/parse.y b/usr.sbin/rad/parse.y
index bb18c3d9c9c..8f32f11250d 100644
--- a/usr.sbin/rad/parse.y
+++ b/usr.sbin/rad/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.15 2019/10/18 06:03:25 otto Exp $ */
+/* $OpenBSD: parse.y,v 1.16 2020/03/30 17:47:48 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -964,8 +964,8 @@ conf_get_ra_prefix(struct in6_addr *addr, int prefixlen)
if (prefix == NULL)
errx(1, "%s: calloc", __func__);
prefix->prefixlen = prefixlen;
- prefix->vltime = 2592000; /* 30 days */
- prefix->pltime = 604800; /* 7 days */
+ prefix->vltime = ADV_VALID_LIFETIME;
+ prefix->pltime = ADV_PREFERRED_LIFETIME;
prefix->lflag = 1;
prefix->aflag = 1;
diff --git a/usr.sbin/rad/rad.c b/usr.sbin/rad/rad.c
index 93675167b6b..365637d49e7 100644
--- a/usr.sbin/rad/rad.c
+++ b/usr.sbin/rad/rad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rad.c,v 1.21 2019/06/28 13:32:49 deraadt Exp $ */
+/* $OpenBSD: rad.c,v 1.22 2020/03/30 17:47:48 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -754,7 +754,7 @@ config_new_empty(void)
xconf->ra_options.cur_hl = 0;
xconf->ra_options.m_flag = 0;
xconf->ra_options.o_flag = 0;
- xconf->ra_options.router_lifetime = 1800;
+ xconf->ra_options.router_lifetime = ADV_DEFAULT_LIFETIME;
xconf->ra_options.reachable_time = 0;
xconf->ra_options.retrans_timer = 0;
xconf->ra_options.mtu = 0;
diff --git a/usr.sbin/rad/rad.h b/usr.sbin/rad/rad.h
index 2bbf7c8ed5c..823a2a9d633 100644
--- a/usr.sbin/rad/rad.h
+++ b/usr.sbin/rad/rad.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rad.h,v 1.17 2019/03/02 03:40:45 pamela Exp $ */
+/* $OpenBSD: rad.h,v 1.18 2020/03/30 17:47:48 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -18,21 +18,23 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define CONF_FILE "/etc/rad.conf"
+#define CONF_FILE "/etc/rad.conf"
#define RAD_SOCKET "/var/run/rad.sock"
-#define RAD_USER "_rad"
+#define RAD_USER "_rad"
-#define OPT_VERBOSE 0x00000001
-#define OPT_VERBOSE2 0x00000002
-#define OPT_NOACTION 0x00000004
+#define OPT_VERBOSE 0x00000001
+#define OPT_VERBOSE2 0x00000002
+#define OPT_NOACTION 0x00000004
+#define MAX_RTR_ADV_INTERVAL 600
+#define MIN_RTR_ADV_INTERVAL 200
+#define ADV_DEFAULT_LIFETIME 3 * MAX_RTR_ADV_INTERVAL
+#define ADV_PREFERRED_LIFETIME 604800 /* 7 days */
+#define ADV_VALID_LIFETIME 2592000 /* 30 days */
+#define MAX_SEARCH 1025 /* MAXDNAME in arpa/nameser.h */
+#define DEFAULT_RDNS_LIFETIME 600 * 1.5
-#define MAX_RTR_ADV_INTERVAL 600
-#define MIN_RTR_ADV_INTERVAL 200
-#define MAX_SEARCH 1025 /* same as MAXDNAME in arpa/nameser.h */
-#define DEFAULT_RDNS_LIFETIME 600 * 1.5
-
-#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
+#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
enum {
PROC_MAIN,