-/* $OpenBSD: frontend.c,v 1.11 2018/07/18 09:10:50 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.12 2018/07/20 17:55:09 bket Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
build_packet(struct ra_iface *ra_iface)
{
struct nd_router_advert *ra;
+ struct nd_opt_mtu *ndopt_mtu;
struct nd_opt_prefix_info *ndopt_pi;
struct ra_iface_conf *ra_iface_conf;
struct ra_options_conf *ra_options_conf;
ra_options_conf = &ra_iface_conf->ra_options;
len = sizeof(*ra);
+ if (ra_options_conf->mtu > 0)
+ len += sizeof(*ndopt_mtu);
len += sizeof(*ndopt_pi) * ra_iface->prefix_count;
if (ra_iface_conf->rdnss_count > 0)
len += sizeof(*ndopt_rdnss) + ra_iface_conf->rdnss_count *
ra->nd_ra_retransmit = htonl(ra_options_conf->retrans_timer);
p += sizeof(*ra);
+ if (ra_options_conf->mtu > 0) {
+ ndopt_mtu = (struct nd_opt_mtu *)p;
+ ndopt_mtu->nd_opt_mtu_type = ND_OPT_MTU;
+ ndopt_mtu->nd_opt_mtu_len = 1;
+ ndopt_mtu->nd_opt_mtu_reserved = 0;
+ ndopt_mtu->nd_opt_mtu_mtu = htonl(ra_options_conf->mtu);
+ p += sizeof(*ndopt_mtu);
+ }
+
SIMPLEQ_FOREACH(ra_prefix_conf, &ra_iface->prefixes, entry) {
ndopt_pi = (struct nd_opt_prefix_info *)p;
memset(ndopt_pi, 0, sizeof(*ndopt_pi));
-/* $OpenBSD: parse.y,v 1.5 2018/07/20 17:48:58 florian Exp $ */
+/* $OpenBSD: parse.y,v 1.6 2018/07/20 17:55:09 bket Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
%token DEFAULT ROUTER HOP LIMIT MANAGED ADDRESS
%token CONFIGURATION OTHER LIFETIME REACHABLE TIME RETRANS TIMER
%token AUTO PREFIX VALID PREFERRED LIFETIME ONLINK AUTONOMOUS
-%token ADDRESS_CONFIGURATION DNS NAMESERVER SEARCH
+%token ADDRESS_CONFIGURATION DNS NAMESERVER SEARCH MTU
%token <v.string> STRING
%token <v.number> NUMBER
| RETRANS TIMER NUMBER {
ra_options->retrans_timer = $3;
}
+ | MTU NUMBER {
+ ra_options->mtu = $2;
+ }
;
optnl : '\n' optnl /* zero or more newlines */
{"lifetime", LIFETIME},
{"limit", LIMIT},
{"managed", MANAGED},
+ {"mtu", MTU},
{"nameserver", NAMESERVER},
{"no", NO},
{"on-link", ONLINK},
-/* $OpenBSD: printconf.c,v 1.3 2018/07/20 13:17:02 florian Exp $ */
+/* $OpenBSD: printconf.c,v 1.4 2018/07/20 17:55:09 bket Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
printf("%srouter lifetime %d\n", indent, ra_options->router_lifetime);
printf("%sreachable time %u\n", indent, ra_options->reachable_time);
printf("%sretrans timer %u\n", indent, ra_options->retrans_timer);
+ if (ra_options->mtu > 0)
+ printf("%smtu %u\n", indent, ra_options->mtu);
}
void
-/* $OpenBSD: rad.c,v 1.9 2018/07/18 14:43:34 florian Exp $ */
+/* $OpenBSD: rad.c,v 1.10 2018/07/20 17:55:09 bket Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
xconf->ra_options.router_lifetime = 1800;
xconf->ra_options.reachable_time = 0;
xconf->ra_options.retrans_timer = 0;
+ xconf->ra_options.mtu = 0;
return (xconf);
}
-.\" $OpenBSD: rad.conf.5,v 1.7 2018/07/20 13:17:02 florian Exp $
+.\" $OpenBSD: rad.conf.5,v 1.8 2018/07/20 17:55:09 bket Exp $
.\"
.\" Copyright (c) 2018 Florian Obser <florian@openbsd.org>
.\" Copyright (c) 2005 Esben Norby <norby@openbsd.org>
.\" XXX
.\" .It Ic retrans timer Ar number
.\" XXX
+.It Ic mtu Ar bytes
+The MTU option is used in Router Advertisement messages to ensure that all
+nodes on a link use the same MTU value in those cases where the link MTU
+is not well known.
+The default is 0, meaning unspecified by this router.
.El
.Sh INTERFACES
A list of interfaces to send advertisments on:
-/* $OpenBSD: rad.h,v 1.11 2018/07/15 09:28:21 florian Exp $ */
+/* $OpenBSD: rad.h,v 1.12 2018/07/20 17:55:09 bket Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
IMSG_SOCKET_IPC
};
-/* RFC 4861 Section 4.2 */
+/* RFC 4861 Sections 4.2 and 4.6.4 */
struct ra_options_conf {
int dfr; /* is default router? */
int cur_hl; /* current hop limit */
int router_lifetime; /* default router lifetime */
uint32_t reachable_time;
uint32_t retrans_timer;
+ uint32_t mtu;
};
/* RFC 4861 Section 4.6.2 */