View | Details | Raw Unified | Return to bug 121895
Collapse All | Expand All

(-)dump.c (+2 lines)
Lines 77-82 Link Here
77
		    ifinfo->active > 0 ? "active" : "inactive");
77
		    ifinfo->active > 0 ? "active" : "inactive");
78
		fprintf(fp, "  other config: %s\n",
78
		fprintf(fp, "  other config: %s\n",
79
		    ifinfo->otherconfig ? "on" : "off");
79
		    ifinfo->otherconfig ? "on" : "off");
80
		fprintf(fp, "  managed config: %s\n",
81
		    ifinfo->managedconfig ? "on" : "off");
80
		fprintf(fp, "  rtsold status: %s\n", ifstatstr[ifinfo->state]);
82
		fprintf(fp, "  rtsold status: %s\n", ifstatstr[ifinfo->state]);
81
		fprintf(fp, "  carrier detection: %s\n",
83
		fprintf(fp, "  carrier detection: %s\n",
82
		    ifinfo->mediareqok ? "available" : "unavailable");
84
		    ifinfo->mediareqok ? "available" : "unavailable");
(-)rtsol.c (-6 / +42 lines)
Lines 339-344 Link Here
339
339
340
	nd_ra = (struct nd_router_advert *)icp;
340
	nd_ra = (struct nd_router_advert *)icp;
341
341
342
#define RABOTH (ND_RA_FLAG_OTHER|ND_RA_FLAG_MANAGED)
343
	/*
344
	 * Having both O and M set is undefined.
345
	 */
346
	if ((nd_ra->nd_ra_flags_reserved & RABOTH) == RABOTH) {
347
		warnmsg(LOG_INFO, __func__,
348
		    "received RA from %s on IF(%s) with O and M set",
349
		    inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf,
350
		    INET6_ADDRSTRLEN),
351
		    if_indextoname(pi->ipi6_ifindex, ifnamebuf));
352
		return;
353
	}
354
342
	/*
355
	/*
343
	 * Process the "O bit."
356
	 * Process the "O bit."
344
	 * If the value of OtherConfigFlag changes from FALSE to TRUE, the
357
	 * If the value of OtherConfigFlag changes from FALSE to TRUE, the
Lines 346-357 Link Here
346
	 * requesting information.
359
	 * requesting information.
347
	 * [RFC 2462 Section 5.5.3]
360
	 * [RFC 2462 Section 5.5.3]
348
	 */
361
	 */
349
	if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) &&
362
	if ((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) {
350
	    !ifi->otherconfig) {
363
		if (ifi->managedconfig)
351
		warnmsg(LOG_DEBUG, __func__,
364
			warnmsg(LOG_DEBUG, __func__,
352
		    "OtherConfigFlag on %s is turned on", ifi->ifname);
365
			    "ManagedConfigFlag on %s already turned on",
353
		ifi->otherconfig = 1;
366
			     ifi->ifname);
354
		call_script(otherconf_script, ifi->ifname);
367
		else if (!ifi->otherconfig) {
368
			warnmsg(LOG_DEBUG, __func__,
369
			    "OtherConfigFlag on %s is turned on",
370
			    ifi->ifname);
371
			ifi->otherconfig = 1;
372
			call_script(otherconf_script, ifi->ifname);
373
		}
374
	}
375
376
	/*
377
	 * Process the "M bit."
378
	 */
379
	if (nd_ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) {
380
		if (ifi->otherconfig)
381
			warnmsg(LOG_DEBUG, __func__,
382
			    "OtherConfigFlag on %s already turned on",
383
			     ifi->ifname);
384
		else if (!ifi->managedconfig) {
385
			warnmsg(LOG_DEBUG, __func__,
386
			    "ManagedConfigFlag on %s is turned on",
387
			    ifi->ifname);
388
			ifi->managedconfig = 1;
389
			call_script(managed_script, ifi->ifname);
390
		}
355
	}
391
	}
356
392
357
	ifi->racnt++;
393
	ifi->racnt++;
(-)rtsold.8 (+16 lines)
Lines 40-45 Link Here
40
.Sh SYNOPSIS
40
.Sh SYNOPSIS
41
.Nm
41
.Nm
42
.Op Fl dDfFm1
42
.Op Fl dDfFm1
43
.Op Fl M Ar script-name
43
.Op Fl O Ar script-name
44
.Op Fl O Ar script-name
44
.Ar interface ...
45
.Ar interface ...
45
.Nm
46
.Nm
Lines 48-53 Link Here
48
.Fl a
49
.Fl a
49
.Nm rtsol
50
.Nm rtsol
50
.Op Fl dDF
51
.Op Fl dDF
52
.Op Fl M Ar script-name
51
.Op Fl O Ar script-name
53
.Op Fl O Ar script-name
52
.Ar interface ...
54
.Ar interface ...
53
.Nm rtsol
55
.Nm rtsol
Lines 206-211 Link Here
206
Advertisement packet has arrived on each
208
Advertisement packet has arrived on each
207
.Ar interface ,
209
.Ar interface ,
208
then exit.
210
then exit.
211
.It Fl M Ar script-name
212
Specifies a supplement script file to handle the Managed Configuration
213
flag of the router advertisement.
214
When the flag changes from FALSE to TRUE,
215
.Nm
216
will invoke
217
.Ar script-name
218
with a single argument of the receiving interface name,
219
expecting the script will then start a protocol for the other
220
configuration.
221
.Ar script-name
222
must be the absolute path from root to the script file, be a regular
223
file, and be created by the same owner who runs
224
.Nm .
209
.It Fl O Ar script-name
225
.It Fl O Ar script-name
210
Specifies a supplement script file to handle the Other Configuration
226
Specifies a supplement script file to handle the Other Configuration
211
flag of the router advertisement.
227
flag of the router advertisement.
(-)rtsold.c (-2 / +11 lines)
Lines 68-73 Link Here
68
int dflag = 0;
68
int dflag = 0;
69
69
70
char *otherconf_script;
70
char *otherconf_script;
71
char *managed_script;
71
72
72
/* protocol constants */
73
/* protocol constants */
73
#define MAX_RTR_SOLICITATION_DELAY	1 /* second */
74
#define MAX_RTR_SOLICITATION_DELAY	1 /* second */
Lines 127-135 Link Here
127
	if (argv0 && argv0[strlen(argv0) - 1] != 'd') {
128
	if (argv0 && argv0[strlen(argv0) - 1] != 'd') {
128
		fflag = 1;
129
		fflag = 1;
129
		once = 1;
130
		once = 1;
130
		opts = "adDFO:";
131
		opts = "adDFM:O:";
131
	} else
132
	} else
132
		opts = "adDfFm1O:";
133
		opts = "adDfFm1M:O:";
133
134
134
	while ((ch = getopt(argc, argv, opts)) != -1) {
135
	while ((ch = getopt(argc, argv, opts)) != -1) {
135
		switch (ch) {
136
		switch (ch) {
Lines 157-162 Link Here
157
		case 'O':
158
		case 'O':
158
			otherconf_script = optarg;
159
			otherconf_script = optarg;
159
			break;
160
			break;
161
		case 'M':
162
			managed_script = optarg;
163
			break;
160
		default:
164
		default:
161
			usage(argv0);
165
			usage(argv0);
162
			/*NOTREACHED*/
166
			/*NOTREACHED*/
Lines 191-196 Link Here
191
		    otherconf_script);
195
		    otherconf_script);
192
	}
196
	}
193
197
198
	if (managed_script && *managed_script != '/') {
199
		errx(1, "configuration script (%s) must be an absolute path",
200
		    managed_script);
201
	}
202
194
#ifndef HAVE_ARC4RANDOM
203
#ifndef HAVE_ARC4RANDOM
195
	/* random value initialization */
204
	/* random value initialization */
196
	srandom((u_long)time(NULL));
205
	srandom((u_long)time(NULL));
(-)rtsold.h (+3 lines)
Lines 43-48 Link Here
43
	int mediareqok;		/* wheter the IF supports SIOCGIFMEDIA */
43
	int mediareqok;		/* wheter the IF supports SIOCGIFMEDIA */
44
	int otherconfig;	/* need a separate protocol for the "other"
44
	int otherconfig;	/* need a separate protocol for the "other"
45
				 * configuration */
45
				 * configuration */
46
	int managedconfig;	/* need a separate protocol for the "managed"
47
				 * configuration */
46
	int state;
48
	int state;
47
	int probes;
49
	int probes;
48
	int dadcount;
50
	int dadcount;
Lines 68-73 Link Here
68
extern int dflag;
70
extern int dflag;
69
extern int aflag;
71
extern int aflag;
70
extern char *otherconf_script;
72
extern char *otherconf_script;
73
extern char *managed_script;
71
extern int ifconfig __P((char *));
74
extern int ifconfig __P((char *));
72
extern void iflist_init __P((void));
75
extern void iflist_init __P((void));
73
struct ifinfo *find_ifinfo __P((int));
76
struct ifinfo *find_ifinfo __P((int));

Return to bug 121895