Commit 6ec5f5c4 authored by Vladislav Grishenko's avatar Vladislav Grishenko Committed by Simon Kelley

Extend --ra-param mtu: field to allow an interface name.

parent 5a7212c7
...@@ -103,7 +103,12 @@ version 2.77 ...@@ -103,7 +103,12 @@ version 2.77
presence of the --bogus-priv flag. Thanks to presence of the --bogus-priv flag. Thanks to
Vladislav Grishenko for the patch. Vladislav Grishenko for the patch.
Extend --ra-param mtu: field to allow an interface name.
This allows the MTU of a WAN interface to be advertised on
the internal interfaces of a router. Thanks to
Vladislav Grishenko for the patch.
version 2.76 version 2.76
Include 0.0.0.0/8 in DNS rebind checks. This range Include 0.0.0.0/8 in DNS rebind checks. This range
translates to hosts on the local network, or, at translates to hosts on the local network, or, at
......
...@@ -1776,7 +1776,7 @@ the relevant link-local address of the machine running dnsmasq is sent ...@@ -1776,7 +1776,7 @@ the relevant link-local address of the machine running dnsmasq is sent
as recursive DNS server. If provided, the DHCPv6 options dns-server and as recursive DNS server. If provided, the DHCPv6 options dns-server and
domain-search are used for the DNS server (RDNSS) and the domain search list (DNSSL). domain-search are used for the DNS server (RDNSS) and the domain search list (DNSSL).
.TP .TP
.B --ra-param=<interface>,[mtu:<integer>|off,][high,|low,]<ra-interval>[,<router lifetime>] .B --ra-param=<interface>,[mtu:<integer>|<interface>|off,][high,|low,]<ra-interval>[,<router lifetime>]
Set non-default values for router advertisements sent via an Set non-default values for router advertisements sent via an
interface. The priority field for the router may be altered from the interface. The priority field for the router may be altered from the
default of medium with eg default of medium with eg
...@@ -1788,7 +1788,11 @@ a router to advertise prefixes but not a route via itself. ...@@ -1788,7 +1788,11 @@ a router to advertise prefixes but not a route via itself.
.B --ra-parm=eth0,0,0 .B --ra-parm=eth0,0,0
(A value of zero for the interval means the default value.) All four parameters may be set at once. (A value of zero for the interval means the default value.) All four parameters may be set at once.
.B --ra-param=eth0,mtu:1280,low,60,1200 .B --ra-param=eth0,mtu:1280,low,60,1200
The interface field may include a wildcard. The interface field may include a wildcard.
The mtu: parameter may be an arbitrary interface name, in which case the MTU value for that interface is used. This is useful
for (eg) advertising the MTU of a WAN interface on the other interfaces of a router.
.TP .TP
.B --dhcp-reply-delay=[tag:<tag>,]<integer> .B --dhcp-reply-delay=[tag:<tag>,]<integer>
Delays sending DHCPOFFER and proxydhcp replies for at least the specified number of seconds. Delays sending DHCPOFFER and proxydhcp replies for at least the specified number of seconds.
......
...@@ -1756,7 +1756,7 @@ dnsmasq est spécifiée comme DNS récursif. Si elles sont fournies, les ...@@ -1756,7 +1756,7 @@ dnsmasq est spécifiée comme DNS récursif. Si elles sont fournies, les
options dns-server et domain-search sont utilisées respectivement pour RDNSS et options dns-server et domain-search sont utilisées respectivement pour RDNSS et
DNSSL. DNSSL.
.TP .TP
.B --ra-param=<interface>,[mtu:<valeur>|off,][high,|low,]<intervalle d'annonce routeur>[,<durée de vie route>] .B --ra-param=<interface>,[mtu:<valeur>|<interface>|off,][high,|low,]<intervalle d'annonce routeur>[,<durée de vie route>]
Configure pour une interface donnée des valeurs pour les annonces routeurs Configure pour une interface donnée des valeurs pour les annonces routeurs
différentes des valeurs par défaut. La valeur par défaut du champ priorité différentes des valeurs par défaut. La valeur par défaut du champ priorité
pour le routeur peut-être changée de "medium" (moyen) à "high" (haute) ou pour le routeur peut-être changée de "medium" (moyen) à "high" (haute) ou
......
...@@ -841,6 +841,7 @@ struct prefix_class { ...@@ -841,6 +841,7 @@ struct prefix_class {
struct ra_interface { struct ra_interface {
char *name; char *name;
char *mtu_name;
int interval, lifetime, prio, mtu; int interval, lifetime, prio, mtu;
struct ra_interface *next; struct ra_interface *next;
}; };
......
...@@ -488,7 +488,7 @@ static struct { ...@@ -488,7 +488,7 @@ static struct {
#ifdef OPTION6_PREFIX_CLASS #ifdef OPTION6_PREFIX_CLASS
{ LOPT_PREF_CLSS, ARG_DUP, "set:tag,<class>", gettext_noop("Specify DHCPv6 prefix class"), NULL }, { LOPT_PREF_CLSS, ARG_DUP, "set:tag,<class>", gettext_noop("Specify DHCPv6 prefix class"), NULL },
#endif #endif
{ LOPT_RA_PARAM, ARG_DUP, "<iface>,[mtu:<value>|off,][<prio>,]<intval>[,<lifetime>]", gettext_noop("Set MTU, priority, resend-interval and router-lifetime"), NULL }, { LOPT_RA_PARAM, ARG_DUP, "<iface>,[mtu:<value>|<interface>|off,][<prio>,]<intval>[,<lifetime>]", gettext_noop("Set MTU, priority, resend-interval and router-lifetime"), NULL },
{ LOPT_QUIET_DHCP, OPT_QUIET_DHCP, NULL, gettext_noop("Do not log routine DHCP."), NULL }, { LOPT_QUIET_DHCP, OPT_QUIET_DHCP, NULL, gettext_noop("Do not log routine DHCP."), NULL },
{ LOPT_QUIET_DHCP6, OPT_QUIET_DHCP6, NULL, gettext_noop("Do not log routine DHCPv6."), NULL }, { LOPT_QUIET_DHCP6, OPT_QUIET_DHCP6, NULL, gettext_noop("Do not log routine DHCPv6."), NULL },
{ LOPT_QUIET_RA, OPT_QUIET_RA, NULL, gettext_noop("Do not log RA."), NULL }, { LOPT_QUIET_RA, OPT_QUIET_RA, NULL, gettext_noop("Do not log RA."), NULL },
...@@ -3707,6 +3707,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -3707,6 +3707,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
new->lifetime = -1; new->lifetime = -1;
new->prio = 0; new->prio = 0;
new->mtu = 0; new->mtu = 0;
new->mtu_name = NULL;
new->name = opt_string_alloc(arg); new->name = opt_string_alloc(arg);
if (strcasestr(comma, "mtu:") == comma) if (strcasestr(comma, "mtu:") == comma)
{ {
...@@ -3715,7 +3716,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma ...@@ -3715,7 +3716,9 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
goto err; goto err;
if (!strcasecmp(arg, "off")) if (!strcasecmp(arg, "off"))
new->mtu = -1; new->mtu = -1;
else if (!atoi_check(arg, &new->mtu) || new->mtu < 1280) else if (!atoi_check(arg, &new->mtu))
new->mtu_name = opt_string_alloc(arg);
else if (new->mtu < 1280)
goto err; goto err;
} }
if (strcasestr(comma, "high") == comma || strcasestr(comma, "low") == comma) if (strcasestr(comma, "high") == comma || strcasestr(comma, "low") == comma)
......
...@@ -408,7 +408,8 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad ...@@ -408,7 +408,8 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad
available from SIOCGIFMTU */ available from SIOCGIFMTU */
if (mtu == 0) if (mtu == 0)
{ {
sprintf(daemon->namebuff, "/proc/sys/net/ipv6/conf/%s/mtu", iface_name); char *mtu_name = ra_param ? ra_param->mtu_name : NULL;
sprintf(daemon->namebuff, "/proc/sys/net/ipv6/conf/%s/mtu", mtu_name ? : iface_name);
if ((f = fopen(daemon->namebuff, "r"))) if ((f = fopen(daemon->namebuff, "r")))
{ {
if (fgets(daemon->namebuff, MAXDNAME, f)) if (fgets(daemon->namebuff, MAXDNAME, f))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment