diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 18:37:10 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2017-05-27 18:37:10 +0000 |
commit | a27a86629c83682b6c957268d16221361322f40c (patch) | |
tree | 4903c4807fea1b4a7c4421b5bdf3655847751ed9 /usr.sbin | |
parent | c057bd099d1772caf7431bd49806af94edb13563 (diff) |
print router preference
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/slaacctl/slaacctl.c | 3 | ||||
-rw-r--r-- | usr.sbin/slaacd/engine.c | 12 | ||||
-rw-r--r-- | usr.sbin/slaacd/slaacd.h | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/slaacctl/slaacctl.c b/usr.sbin/slaacctl/slaacctl.c index 8e7565bfdcc..5d2e8df619b 100644 --- a/usr.sbin/slaacctl/slaacctl.c +++ b/usr.sbin/slaacctl/slaacctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacctl.c,v 1.4 2017/05/27 10:53:59 florian Exp $ */ +/* $OpenBSD: slaacctl.c,v 1.5 2017/05/27 18:37:09 florian Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -221,6 +221,7 @@ show_interface_msg(struct imsg *imsg) printf("\t\tCur Hop Limit: %3u, M: %d, O: %d, Router Lifetime:" " %5us\n", cei_ra->curhoplimit, cei_ra->managed ? 1: 0, cei_ra->other ? 1 : 0, cei_ra->router_lifetime); + printf("\t\tDefault Router Preference: %s\n", cei_ra->rpref); printf("\t\tReachable Time: %9ums, Retrans Timer: %9ums\n", cei_ra->reachable_time, cei_ra->retrans_time); break; diff --git a/usr.sbin/slaacd/engine.c b/usr.sbin/slaacd/engine.c index 0657af14115..71a79482c77 100644 --- a/usr.sbin/slaacd/engine.c +++ b/usr.sbin/slaacd/engine.c @@ -1,4 +1,4 @@ -/* $OpenBSD: engine.c,v 1.17 2017/05/27 16:16:49 florian Exp $ */ +/* $OpenBSD: engine.c,v 1.18 2017/05/27 18:37:09 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -115,6 +115,12 @@ const char* proposal_state_name[] = { "WITHDRAWN", }; +const char* rpref_name[] = { + "Low", + "Medium", + "High", +}; + struct radv_prefix { LIST_ENTRY(radv_prefix) entries; struct in6_addr prefix; @@ -673,7 +679,9 @@ send_interface_info(struct slaacd_iface *iface, pid_t pid) cei_ra.curhoplimit = ra->curhoplimit; cei_ra.managed = ra->managed; cei_ra.other = ra->other; - cei_ra.rpref = ra->rpref; + if (strlcpy(cei_ra.rpref, rpref_name[ra->rpref], sizeof( + cei_ra.rpref)) >= sizeof(cei_ra.rpref)) + log_warn("truncated router preference"); cei_ra.router_lifetime = ra->router_lifetime; cei_ra.reachable_time = ra->reachable_time; cei_ra.retrans_time = ra->retrans_time; diff --git a/usr.sbin/slaacd/slaacd.h b/usr.sbin/slaacd/slaacd.h index 547e9740389..09b93f6c6ed 100644 --- a/usr.sbin/slaacd/slaacd.h +++ b/usr.sbin/slaacd/slaacd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: slaacd.h,v 1.12 2017/05/27 16:16:49 florian Exp $ */ +/* $OpenBSD: slaacd.h,v 1.13 2017/05/27 18:37:09 florian Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -101,7 +101,7 @@ struct ctl_engine_info_ra { uint8_t curhoplimit; int managed; int other; - enum rpref rpref; + char rpref[sizeof("MEDIUM")]; uint16_t router_lifetime; /* in seconds */ uint32_t reachable_time; /* in milliseconds */ uint32_t retrans_time; /* in milliseconds */ |