From 02508a3d4e178b431fe5dda354a56d883f976c02 Mon Sep 17 00:00:00 2001 From: Franco Fitchner Date: Sat, 14 Aug 2021 11:10:21 -0400 Subject: [PATCH] rtsold: pass sending router address to other and managed script Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31518 --- usr.sbin/rtsold/rtsol.c | 8 ++++++-- usr.sbin/rtsold/rtsold.8 | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/usr.sbin/rtsold/rtsol.c b/usr.sbin/rtsold/rtsol.c index 76756bfd839..646dd092cb0 100644 --- a/usr.sbin/rtsold/rtsol.c +++ b/usr.sbin/rtsold/rtsol.c @@ -79,8 +79,8 @@ static int ra_opt_rdnss_dispatch(struct ifinfo *, struct rainfo *, struct script_msg_head_t *, struct script_msg_head_t *); static char *make_rsid(const char *, const char *, struct rainfo *); -#define _ARGS_MANAGED managedconf_script, ifi->ifname -#define _ARGS_OTHER otherconf_script, ifi->ifname +#define _ARGS_MANAGED managedconf_script, ifi->ifname, rasender +#define _ARGS_OTHER otherconf_script, ifi->ifname, rasender #define _ARGS_RESADD resolvconf_script, "-a", rsid #define _ARGS_RESDEL resolvconf_script, "-d", rsid @@ -301,6 +301,8 @@ rtsol_input(int sock) */ if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_MANAGED) && !ifi->managedconfig) { + const char *rasender = inet_ntop(AF_INET6, &from.sin6_addr, + ntopbuf, sizeof(ntopbuf)); warnmsg(LOG_DEBUG, __func__, "ManagedConfigFlag on %s is turned on", ifi->ifname); ifi->managedconfig = 1; @@ -317,6 +319,8 @@ rtsol_input(int sock) */ if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) && !ifi->otherconfig) { + const char *rasender = inet_ntop(AF_INET6, &from.sin6_addr, + ntopbuf, sizeof(ntopbuf)); warnmsg(LOG_DEBUG, __func__, "OtherConfigFlag on %s is turned on", ifi->ifname); ifi->otherconfig = 1; diff --git a/usr.sbin/rtsold/rtsold.8 b/usr.sbin/rtsold/rtsold.8 index 273a2b4f0dd..84e4d3013ef 100644 --- a/usr.sbin/rtsold/rtsold.8 +++ b/usr.sbin/rtsold/rtsold.8 @@ -219,7 +219,8 @@ When the flag changes from FALSE to TRUE, .Nm will invoke .Ar script-name -with a single argument of the receiving interface name, +with a first argument of the receiving interface name +and a second argument of the sending router address, expecting the script will then start a protocol for the managed configuration. .Ar script-name @@ -233,7 +234,8 @@ When the flag changes from FALSE to TRUE, .Nm will invoke .Ar script-name -with a single argument of the receiving interface name, +with a first argument of the receiving interface name +and a second argument of the sending router address, expecting the script will then start a protocol for the other configuration. The script will not be run if the Managed Configuration flag in the