Browse Source

Plan 9 from Bell Labs 2007-04-20

David du Colombier 17 years ago
parent
commit
9a867725dd
8 changed files with 205 additions and 113 deletions
  1. 6 6
      dist/replica/_plan9.db
  2. 6 6
      dist/replica/plan9.db
  3. 7 0
      dist/replica/plan9.log
  4. 93 2
      sys/man/3/ip
  5. 10 12
      sys/src/9/ip/ip.c
  6. 17 18
      sys/src/9/ip/ip.h
  7. 26 46
      sys/src/9/ip/ipifc.c
  8. 40 23
      sys/src/cmd/auth/cron.c

+ 6 - 6
dist/replica/_plan9.db

@@ -49,7 +49,7 @@
 386/bin/auth/changeuser - 775 sys sys 1168402267 97488
 386/bin/auth/changeuser - 775 sys sys 1168402267 97488
 386/bin/auth/convkeys - 775 sys sys 1174964423 88664
 386/bin/auth/convkeys - 775 sys sys 1174964423 88664
 386/bin/auth/convkeys2 - 775 sys sys 1174964423 88723
 386/bin/auth/convkeys2 - 775 sys sys 1174964423 88723
-386/bin/auth/cron - 775 sys sys 1168402268 144754
+386/bin/auth/cron - 775 sys sys 1177012403 145052
 386/bin/auth/debug - 775 sys sys 1168402268 101566
 386/bin/auth/debug - 775 sys sys 1168402268 101566
 386/bin/auth/disable - 775 sys sys 1020319057 146
 386/bin/auth/disable - 775 sys sys 1020319057 146
 386/bin/auth/enable - 775 sys sys 1020319057 134
 386/bin/auth/enable - 775 sys sys 1020319057 134
@@ -7624,7 +7624,7 @@ sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1174771711 22618
+sys/man/3/ip - 664 sys sys 1176959517 24540
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/loopback - 664 sys sys 964662153 1995
 sys/man/3/loopback - 664 sys sys 964662153 1995
@@ -7949,10 +7949,10 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1176937812 17893
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/il.c - 664 sys sys 1134498903 27226
 sys/src/9/ip/il.c - 664 sys sys 1134498903 27226
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1101906449 15285
-sys/src/9/ip/ip.h - 664 sys sys 1162907930 15760
+sys/src/9/ip/ip.c - 664 sys sys 1176957040 15288
+sys/src/9/ip/ip.h - 664 sys sys 1176957139 15982
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
-sys/src/9/ip/ipifc.c - 664 sys sys 1176937940 33863
+sys/src/9/ip/ipifc.c - 664 sys sys 1176957160 33517
 sys/src/9/ip/ipmux.c - 664 sys sys 1047260566 15362
 sys/src/9/ip/ipmux.c - 664 sys sys 1047260566 15362
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
 sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
 sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
@@ -9526,7 +9526,7 @@ sys/src/cmd/auth/changeuser.c - 664 sys sys 1155994851 2949
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1155994849 2387
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1155994849 2387
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1155994849 2444
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1155994849 2444
-sys/src/cmd/auth/cron.c - 664 sys sys 1168307786 12266
+sys/src/cmd/auth/cron.c - 664 sys sys 1177004942 12306
 sys/src/cmd/auth/debug.c - 664 sys sys 1143694911 7325
 sys/src/cmd/auth/debug.c - 664 sys sys 1143694911 7325
 sys/src/cmd/auth/disable - 775 sys sys 1015008431 146
 sys/src/cmd/auth/disable - 775 sys sys 1015008431 146
 sys/src/cmd/auth/enable - 775 sys sys 1015008430 134
 sys/src/cmd/auth/enable - 775 sys sys 1015008430 134

+ 6 - 6
dist/replica/plan9.db

@@ -49,7 +49,7 @@
 386/bin/auth/changeuser - 775 sys sys 1168402267 97488
 386/bin/auth/changeuser - 775 sys sys 1168402267 97488
 386/bin/auth/convkeys - 775 sys sys 1174964423 88664
 386/bin/auth/convkeys - 775 sys sys 1174964423 88664
 386/bin/auth/convkeys2 - 775 sys sys 1174964423 88723
 386/bin/auth/convkeys2 - 775 sys sys 1174964423 88723
-386/bin/auth/cron - 775 sys sys 1168402268 144754
+386/bin/auth/cron - 775 sys sys 1177012403 145052
 386/bin/auth/debug - 775 sys sys 1168402268 101566
 386/bin/auth/debug - 775 sys sys 1168402268 101566
 386/bin/auth/disable - 775 sys sys 1020319057 146
 386/bin/auth/disable - 775 sys sys 1020319057 146
 386/bin/auth/enable - 775 sys sys 1020319057 134
 386/bin/auth/enable - 775 sys sys 1020319057 134
@@ -7624,7 +7624,7 @@ sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/floppy - 664 sys sys 954378905 881
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/fs - 664 sys sys 1175145095 3147
 sys/man/3/i82365 - 664 sys sys 954378906 884
 sys/man/3/i82365 - 664 sys sys 954378906 884
-sys/man/3/ip - 664 sys sys 1174771711 22618
+sys/man/3/ip - 664 sys sys 1176959517 24540
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/kprof - 664 sys sys 1018029972 1377
 sys/man/3/loopback - 664 sys sys 964662153 1995
 sys/man/3/loopback - 664 sys sys 964662153 1995
@@ -7949,10 +7949,10 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1176937812 17893
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/il.c - 664 sys sys 1134498903 27226
 sys/src/9/ip/il.c - 664 sys sys 1134498903 27226
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1101906449 15285
-sys/src/9/ip/ip.h - 664 sys sys 1162907930 15760
+sys/src/9/ip/ip.c - 664 sys sys 1176957040 15288
+sys/src/9/ip/ip.h - 664 sys sys 1176957139 15982
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
-sys/src/9/ip/ipifc.c - 664 sys sys 1176937940 33863
+sys/src/9/ip/ipifc.c - 664 sys sys 1176957160 33517
 sys/src/9/ip/ipmux.c - 664 sys sys 1047260566 15362
 sys/src/9/ip/ipmux.c - 664 sys sys 1047260566 15362
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
 sys/src/9/ip/iproute.c - 664 sys sys 1168305878 14778
 sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
 sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
@@ -9526,7 +9526,7 @@ sys/src/cmd/auth/changeuser.c - 664 sys sys 1155994851 2949
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1155994849 2387
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1155994849 2387
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1155994849 2444
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1155994849 2444
-sys/src/cmd/auth/cron.c - 664 sys sys 1168307786 12266
+sys/src/cmd/auth/cron.c - 664 sys sys 1177004942 12306
 sys/src/cmd/auth/debug.c - 664 sys sys 1143694911 7325
 sys/src/cmd/auth/debug.c - 664 sys sys 1143694911 7325
 sys/src/cmd/auth/disable - 775 sys sys 1015008431 146
 sys/src/cmd/auth/disable - 775 sys sys 1015008431 146
 sys/src/cmd/auth/enable - 775 sys sys 1015008430 134
 sys/src/cmd/auth/enable - 775 sys sys 1015008430 134

+ 7 - 0
dist/replica/plan9.log

@@ -48423,3 +48423,10 @@
 1176939006 0 c sys/src/9/ip/icmp6.c - 664 sys sys 1176937812 17893
 1176939006 0 c sys/src/9/ip/icmp6.c - 664 sys sys 1176937812 17893
 1176939006 1 c sys/src/9/ip/ipifc.c - 664 sys sys 1176937940 33863
 1176939006 1 c sys/src/9/ip/ipifc.c - 664 sys sys 1176937940 33863
 1176939006 2 c sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
 1176939006 2 c sys/src/9/ip/ipv6.c - 664 sys sys 1176938017 14297
+1176957006 0 c sys/src/9/ip/ip.c - 664 sys sys 1176957040 15288
+1176958805 0 c sys/man/3/ip - 664 sys sys 1176958444 24542
+1176958805 1 c sys/src/9/ip/ip.h - 664 sys sys 1176957139 15982
+1176958805 2 c sys/src/9/ip/ipifc.c - 664 sys sys 1176957160 33517
+1176960606 0 c sys/man/3/ip - 664 sys sys 1176959517 24540
+1177005616 0 c sys/src/cmd/auth/cron.c - 664 sys sys 1177004942 12306
+1177012806 0 c 386/bin/auth/cron - 775 sys sys 1177012403 145052

+ 93 - 2
sys/man/3/ip

@@ -94,7 +94,8 @@ alters aspects of the interface.
 The possible
 The possible
 .I ctl
 .I ctl
 messages are:
 messages are:
-.TF "bind loopback"
+.\" .TF "bind loopback"
+.TF "bind netdev"
 .PD
 .PD
 .TP
 .TP
 .BI "bind ether " path
 .BI "bind ether " path
@@ -135,7 +136,15 @@ written to it will be looped back.
 Disassociate the physical device from an IP interface.
 Disassociate the physical device from an IP interface.
 .TP
 .TP
 .BI add\  "local mask remote mtu " proxy
 .BI add\  "local mask remote mtu " proxy
-Add a local IP address to the interface.  The
+.PD 0
+.TP
+.BI try\  "local mask remote mtu " proxy
+.PD
+Add a local IP address to the interface.
+.I try
+adds the local address as a tentative address
+if it's an IPv6 address.
+The
 .IR mask ,
 .IR mask ,
 .IR remote ,
 .IR remote ,
 .IR mtu ,
 .IR mtu ,
@@ -185,6 +194,88 @@ on this interface as a local address.
 Remove the multicast address
 Remove the multicast address
 .I addr
 .I addr
 from this interface.
 from this interface.
+.TP
+.BI "add6 " "v6addr pfx-len [onlink auto validlt preflt]"
+Add the local IPv6 address
+.I v6addr
+with prefix length
+.I pfx-len
+to this interface.
+See RFC 2461 §6.2.1 for more detail.
+The remaining arguments are optional:
+.RS
+.TF onlink
+.TP
+.I onlink
+flag: address is `on-link'
+.TP
+.I auto
+flag: autonomous
+.TP
+.I validlt
+valid life-time in seconds
+.TP
+.I preflt
+preferred life-time in seconds
+.RE
+.PD
+.TP
+.BI "ra6 " "keyword value ..."
+Set IPv6 router advertisement (RA) parameter
+.IR keyword 's
+.IR value .
+Known
+.IR keyword s
+and the meanings of their values follow.
+See RFC 2461 §6.2.1 for more detail.
+Flags are true iff non-zero.
+.RS
+.TF minraint
+.TP
+.B recvra
+flag: receive and process RAs.
+.TP
+.B sendra
+flag: generate and send RAs.
+.TP
+.B mflag
+flag: ``Managed address configuration'',
+goes into RAs.
+.TP
+.B oflag
+flag: ``Other stateful configuration'',
+goes into RAs.
+.TP
+.B maxraint
+``maximum time allowed between sending unsolicited multicast''
+RAs from the interface, in ms.
+.TP
+.B minraint
+``minimum time allowed between sending unsolicited multicast''
+RAs from the interface, in ms.
+.TP
+.B linkmtu
+``value to be placed in MTU options sent by the router.''
+Zero indicates none.
+.TP
+.B reachtime
+sets the Reachable Time field in RAs sent by the router.
+``Zero means unspecified (by this router).''
+.TP
+.B rxmitra
+sets the Retrans Timer field in RAs sent by the router.
+``Zero means unspecified (by this router).''
+.TP
+.B ttl
+default value of the Cur Hop Limit field in RAs sent by the router.
+Should be set to the ``current diameter of the Internet.''
+``Zero means unspecified (by this router).''
+.TP
+.B routerlt
+sets the Router Lifetime field of RAs sent from the interface, in ms.
+Zero means the router is not to be used as a default router.
+.PD
+.RE
 .PP
 .PP
 Reading the interface's
 Reading the interface's
 .I status
 .I status

+ 10 - 12
sys/src/9/ip/ip.c

@@ -145,30 +145,28 @@ Block*		ip4reassemble(IP*, int, Block*, Ip4hdr*);
 void		ipfragfree4(IP*, Fragment4*);
 void		ipfragfree4(IP*, Fragment4*);
 Fragment4*	ipfragallo4(IP*);
 Fragment4*	ipfragallo4(IP*);
 
 
-
 void
 void
 ip_init_6(Fs *f)
 ip_init_6(Fs *f)
 {
 {
 	v6params *v6p;
 	v6params *v6p;
 
 
 	v6p = smalloc(sizeof(v6params));
 	v6p = smalloc(sizeof(v6params));
-	
-	v6p->rp.mflag		= 0;		// default not managed
+
+	v6p->rp.mflag		= 0;		/* default not managed */
 	v6p->rp.oflag		= 0;
 	v6p->rp.oflag		= 0;
-	v6p->rp.maxraint	= 600000;	// millisecs
+	v6p->rp.maxraint	= 600000;	/* millisecs */
 	v6p->rp.minraint	= 200000;
 	v6p->rp.minraint	= 200000;
-	v6p->rp.linkmtu		= 0;		// no mtu sent
+	v6p->rp.linkmtu		= 0;		/* no mtu sent */
 	v6p->rp.reachtime	= 0;
 	v6p->rp.reachtime	= 0;
 	v6p->rp.rxmitra		= 0;
 	v6p->rp.rxmitra		= 0;
 	v6p->rp.ttl		= MAXTTL;
 	v6p->rp.ttl		= MAXTTL;
-	v6p->rp.routerlt	= 3*(v6p->rp.maxraint);	
+	v6p->rp.routerlt	= 3 * v6p->rp.maxraint;
 
 
-	v6p->hp.rxmithost	= 1000;		// v6 RETRANS_TIMER
+	v6p->hp.rxmithost	= 1000;		/* v6 RETRANS_TIMER */
 
 
 	v6p->cdrouter 		= -1;
 	v6p->cdrouter 		= -1;
 
 
 	f->v6p			= v6p;
 	f->v6p			= v6p;
-
 }
 }
 
 
 void
 void
@@ -217,7 +215,7 @@ iprouting(Fs *f, int on)
 	if(f->ip->iprouting==0)
 	if(f->ip->iprouting==0)
 		f->ip->stats[Forwarding] = 2;
 		f->ip->stats[Forwarding] = 2;
 	else
 	else
-		f->ip->stats[Forwarding] = 1;	
+		f->ip->stats[Forwarding] = 1;
 }
 }
 
 
 int
 int
@@ -362,7 +360,7 @@ if((eh->frag[0] & (IP_DF>>8)) && !gating) print("%V: DF set\n", eh->dst);
 			seglen = dlen - fragoff;
 			seglen = dlen - fragoff;
 			hnputs(feh->frag, fragoff>>3);
 			hnputs(feh->frag, fragoff>>3);
 		}
 		}
-		else	
+		else
 			hnputs(feh->frag, (fragoff>>3)|IP_MF);
 			hnputs(feh->frag, (fragoff>>3)|IP_MF);
 
 
 		hnputs(feh->length, seglen + IP4HDR);
 		hnputs(feh->length, seglen + IP4HDR);
@@ -387,7 +385,7 @@ if((eh->frag[0] & (IP_DF>>8)) && !gating) print("%V: DF set\n", eh->dst);
 			chunk -= blklen;
 			chunk -= blklen;
 			if(xp->rp == xp->wp)
 			if(xp->rp == xp->wp)
 				xp = xp->next;
 				xp = xp->next;
-		} 
+		}
 
 
 		feh->cksum[0] = 0;
 		feh->cksum[0] = 0;
 		feh->cksum[1] = 0;
 		feh->cksum[1] = 0;
@@ -723,7 +721,7 @@ ip4reassemble(IP *ip, int offset, Block *bp, Ip4hdr *ih)
 			hnputs(ih->length, len);
 			hnputs(ih->length, len);
 			qunlock(&ip->fraglock4);
 			qunlock(&ip->fraglock4);
 			ip->stats[ReasmOKs]++;
 			ip->stats[ReasmOKs]++;
-			return bl;		
+			return bl;
 		}
 		}
 		pktposn += BKFG(bl)->flen;
 		pktposn += BKFG(bl)->flen;
 	}
 	}

+ 17 - 18
sys/src/9/ip/ip.h

@@ -188,19 +188,19 @@ struct Iplink
 	int	ref;
 	int	ref;
 };
 };
 
 
-/* rfc 2461, pp.40--43. */
+/* rfc 2461, pp.4043. */
 
 
 /* default values, one per stack */
 /* default values, one per stack */
 struct Routerparams {
 struct Routerparams {
-	int	mflag;
-	int	oflag;
-	int 	maxraint;
-	int	minraint;
-	int	linkmtu;
-	int	reachtime;
-	int	rxmitra;
-	int	ttl;
-	int	routerlt;	
+	int	mflag;		/* flag: managed address configuration */
+	int	oflag;		/* flag: other stateful configuration */
+	int 	maxraint;	/* max. router adv interval (ms) */
+	int	minraint;	/* min. router adv interval (ms) */
+	int	linkmtu;	/* mtu options */
+	int	reachtime;	/* reachable time */
+	int	rxmitra;	/* retransmit interval */
+	int	ttl;		/* cur hop count limit */
+	int	routerlt;	/* router lifetime */
 };
 };
 
 
 struct Hostparams {
 struct Hostparams {
@@ -210,7 +210,7 @@ struct Hostparams {
 struct Ipifc
 struct Ipifc
 {
 {
 	RWlock;
 	RWlock;
-	
+
 	Conv	*conv;		/* link to its conversation structure */
 	Conv	*conv;		/* link to its conversation structure */
 	char	dev[64];	/* device we're attached to */
 	char	dev[64];	/* device we're attached to */
 	Medium	*m;		/* Media pointer */
 	Medium	*m;		/* Media pointer */
@@ -234,9 +234,9 @@ struct Ipifc
 	ulong	in, out;	/* message statistics */
 	ulong	in, out;	/* message statistics */
 	ulong	inerr, outerr;	/* ... */
 	ulong	inerr, outerr;	/* ... */
 
 
-	uchar	sendra6;	/* == 1 => send router advs on this ifc	*/
-	uchar	recvra6;	/* == 1 => recv router advs on this ifc */
-	Routerparams rp;	/* router parameters as in RFC 2461, pp.40--43. 
+	uchar	sendra6;	/* flag: send router advs on this ifc */
+	uchar	recvra6;	/* flag: recv router advs on this ifc */
+	Routerparams rp;	/* router parameters as in RFC 2461, pp.40—43.
 					used only if node is router */
 					used only if node is router */
 };
 };
 
 
@@ -361,7 +361,7 @@ struct v6params
 	Routerparams	rp;		/* v6 params, one copy per node now */
 	Routerparams	rp;		/* v6 params, one copy per node now */
 	Hostparams	hp;
 	Hostparams	hp;
 	v6router	v6rlist[3];	/* max 3 default routers, currently */
 	v6router	v6rlist[3];	/* max 3 default routers, currently */
-	int		cdrouter;	/* uses only v6rlist[cdrouter] if   */ 
+	int		cdrouter;	/* uses only v6rlist[cdrouter] if   */
 					/* cdrouter >= 0. */
 					/* cdrouter >= 0. */
 };
 };
 
 
@@ -379,7 +379,7 @@ char*	Fsstdannounce(Conv*, char**, int);
 char*	Fsstdbind(Conv*, char**, int);
 char*	Fsstdbind(Conv*, char**, int);
 ulong	scalednconv(void);
 ulong	scalednconv(void);
 void	closeconv(Conv*);
 void	closeconv(Conv*);
-/* 
+/*
  *  logging
  *  logging
  */
  */
 enum
 enum
@@ -605,8 +605,7 @@ extern void	ipifcaddmulti(Conv *c, uchar *ma, uchar *ia);
 extern char*	ipifcrem(Ipifc *ifc, char **argv, int argc);
 extern char*	ipifcrem(Ipifc *ifc, char **argv, int argc);
 extern char*	ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
 extern char*	ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp);
 extern long	ipselftabread(Fs*, char *a, ulong offset, int n);
 extern long	ipselftabread(Fs*, char *a, ulong offset, int n);
-extern char*	ipifcaddpref6(Ipifc *ifc, char**argv, int argc);
-extern void	ipsendra6(Fs *f, int on);
+extern char*	ipifcadd6(Ipifc *ifc, char**argv, int argc);
 /*
 /*
  *  ip.c
  *  ip.c
  */
  */

+ 26 - 46
sys/src/9/ip/ipifc.c

@@ -415,12 +415,12 @@ ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp)
 		if(ipcmp(lifc->local, ip) == 0) {
 		if(ipcmp(lifc->local, ip) == 0) {
 			if(lifc->tentative != tentative)
 			if(lifc->tentative != tentative)
 				lifc->tentative = tentative;
 				lifc->tentative = tentative;
-			if(lifcp != nil) {
-				lifc->onlink = lifcp->onlink;
+			if(lifcp) {
+				lifc->onlink   = lifcp->onlink;
 				lifc->autoflag = lifcp->autoflag;
 				lifc->autoflag = lifcp->autoflag;
-				lifc->validlt = lifcp->validlt;
-				lifc->preflt = lifcp->preflt;
-				lifc->origint = lifcp->origint;
+				lifc->validlt  = lifcp->validlt;
+				lifc->preflt   = lifcp->preflt;
+				lifc->origint  = lifcp->origint;
 			}
 			}
 			goto out;
 			goto out;
 		}
 		}
@@ -432,18 +432,16 @@ ipifcadd(Ipifc *ifc, char **argv, int argc, int tentative, Iplifc *lifcp)
 	ipmove(lifc->remote, rem);
 	ipmove(lifc->remote, rem);
 	ipmove(lifc->net, net);
 	ipmove(lifc->net, net);
 	lifc->tentative = tentative;
 	lifc->tentative = tentative;
-	if(lifcp != nil) {
-		lifc->onlink = lifcp->onlink;
+	if(lifcp) {
+		lifc->onlink   = lifcp->onlink;
 		lifc->autoflag = lifcp->autoflag;
 		lifc->autoflag = lifcp->autoflag;
-		lifc->validlt = lifcp->validlt;
-		lifc->preflt = lifcp->preflt;
-		lifc->origint = lifcp->origint;
+		lifc->validlt  = lifcp->validlt;
+		lifc->preflt   = lifcp->preflt;
+		lifc->origint  = lifcp->origint;
 	} else {		/* default values */
 	} else {		/* default values */
-		lifc->onlink = 1;
-		lifc->autoflag = 1;
-		lifc->validlt = ~0L;
-		lifc->preflt = ~0L;
-		lifc->origint = NOW / 1000;
+		lifc->onlink   = lifc->autoflag = 1;
+		lifc->validlt  = lifc->preflt = ~0L;
+		lifc->origint  = NOW / 1000;
 	}
 	}
 	lifc->next = nil;
 	lifc->next = nil;
 
 
@@ -687,7 +685,7 @@ ipifcconnect(Conv* c, char **argv, int argc)
 }
 }
 
 
 char*
 char*
-ipifcsetpar6(Ipifc *ifc, char **argv, int argc)
+ipifcra6(Ipifc *ifc, char **argv, int argc)
 {
 {
 	int i, argsleft, vmax = ifc->rp.maxraint, vmin = ifc->rp.minraint;
 	int i, argsleft, vmax = ifc->rp.maxraint, vmin = ifc->rp.minraint;
 
 
@@ -736,20 +734,6 @@ ipifcsetpar6(Ipifc *ifc, char **argv, int argc)
 	return nil;
 	return nil;
 }
 }
 
 
-char*
-ipifcsendra6(Ipifc *ifc, char **argv, int argc)
-{
-	ifc->sendra6 = ((argc > 1? atoi(argv[1]): 0) != 0);
-	return nil;
-}
-
-char*
-ipifcrecvra6(Ipifc *ifc, char **argv, int argc)
-{
-	ifc->recvra6 = ((argc > 1? atoi(argv[1]): 0) != 0);
-	return nil;
-}
-
 /*
 /*
  *  non-standard control messages.
  *  non-standard control messages.
  *  called with c->car locked.
  *  called with c->car locked.
@@ -780,15 +764,12 @@ ipifcctl(Conv* c, char**argv, int argc)
 	} else if(strcmp(argv[0], "iprouting") == 0){
 	} else if(strcmp(argv[0], "iprouting") == 0){
 		iprouting(c->p->f, (argc > 1? atoi(argv[1]): 1));
 		iprouting(c->p->f, (argc > 1? atoi(argv[1]): 1));
 		return nil;
 		return nil;
-	} else if(strcmp(argv[0], "addpref6") == 0)
-		return ipifcaddpref6(ifc, argv, argc);
-	else if(strcmp(argv[0], "setpar6") == 0)
-		return ipifcsetpar6(ifc, argv, argc);
-	else if(strcmp(argv[0], "sendra6") == 0)
-		return ipifcsendra6(ifc, argv, argc);
-	else if(strcmp(argv[0], "recvra6") == 0)
-		return ipifcrecvra6(ifc, argv, argc);
-	return "unsupported ctl";
+	} else if(strcmp(argv[0], "add6") == 0)
+		return ipifcadd6(ifc, argv, argc);
+	else if(strcmp(argv[0], "ra6") == 0)
+		return ipifcra6(ifc, argv, argc);
+	else
+		return "unsupported ctl";
 }
 }
 
 
 int
 int
@@ -1583,7 +1564,7 @@ enum {
 };
 };
 
 
 char*
 char*
-ipifcaddpref6(Ipifc *ifc, char**argv, int argc)
+ipifcadd6(Ipifc *ifc, char**argv, int argc)
 {
 {
 	int plen = 64;
 	int plen = 64;
 	long origint = NOW / 1000, preflt = ~0L, validlt = ~0L;
 	long origint = NOW / 1000, preflt = ~0L, validlt = ~0L;
@@ -1620,17 +1601,16 @@ ipifcaddpref6(Ipifc *ifc, char**argv, int argc)
 		return Ebadarg;
 		return Ebadarg;
 
 
 	lifc = smalloc(sizeof(Iplifc));
 	lifc = smalloc(sizeof(Iplifc));
-	lifc->onlink = (onlink!=0);
-	lifc->autoflag = (autoflag!=0);
+	lifc->onlink = (onlink != 0);
+	lifc->autoflag = (autoflag != 0);
 	lifc->validlt = validlt;
 	lifc->validlt = validlt;
 	lifc->preflt = preflt;
 	lifc->preflt = preflt;
 	lifc->origint = origint;
 	lifc->origint = origint;
 
 
-	if(ifc->m->pref2addr)
-		ifc->m->pref2addr(prefix, ifc->mac);
-	else
+	/* issue "add" ctl msg for v6 link-local addr and prefix len */
+	if(!ifc->m->pref2addr)
 		return Ebadarg;
 		return Ebadarg;
-
+	ifc->m->pref2addr(prefix, ifc->mac);	/* mac → v6 link-local addr */
 	sprint(addr, "%I", prefix);
 	sprint(addr, "%I", prefix);
 	sprint(preflen, "/%d", plen);
 	sprint(preflen, "/%d", plen);
 	params[0] = "add";
 	params[0] = "add";

+ 40 - 23
sys/src/cmd/auth/cron.c

@@ -84,6 +84,20 @@ sleepuntil(ulong tm)
 		return 0;
 		return 0;
 }
 }
 
 
+#pragma varargck	argpos clog 1
+
+static void
+clog(char *fmt, ...)
+{
+	char msg[256];
+	va_list arg;
+
+	va_start(arg, fmt);
+	vseprint(msg, msg + sizeof msg, fmt, arg);
+	va_end(arg);
+	syslog(0, CRONLOG, msg);
+}
+
 void
 void
 main(int argc, char *argv[])
 main(int argc, char *argv[])
 {
 {
@@ -138,10 +152,10 @@ main(int argc, char *argv[])
 		 * just execute one day's jobs.
 		 * just execute one day's jobs.
 		 */
 		 */
 		if (now < last) {
 		if (now < last) {
-			syslog(0, CRONLOG, "time went backward");
+			clog("time went backward");
 			last = now;
 			last = now;
 		} else if (now - last > Day) {
 		} else if (now - last > Day) {
-			syslog(0, CRONLOG, "time advanced more than a day");
+			clog("time advanced more than a day");
 			last = now - Day;
 			last = now - Day;
 		}
 		}
 		now = minute(now);
 		now = minute(now);
@@ -261,8 +275,7 @@ readjobs(char *file, User *user)
 		if(*savec == '#' || *savec == '\0')
 		if(*savec == '#' || *savec == '\0')
 			continue;
 			continue;
 		if(strlen(savec) > 1024){
 		if(strlen(savec) > 1024){
-			syslog(0, CRONLOG, "%s: line %d: line too long",
-				user->name, line);
+			clog("%s: line %d: line too long", user->name, line);
 			continue;
 			continue;
 		}
 		}
 		j = emalloc(sizeof *j);
 		j = emalloc(sizeof *j);
@@ -277,8 +290,7 @@ readjobs(char *file, User *user)
 			j->next = jobs;
 			j->next = jobs;
 			jobs = j;
 			jobs = j;
 		}else{
 		}else{
-			syslog(0, CRONLOG, "%s: line %d: syntax error",
-				user->name, line);
+			clog("%s: line %d: syntax error", user->name, line);
 			free(j);
 			free(j);
 		}
 		}
 	}
 	}
@@ -356,7 +368,7 @@ getname(char **namep)
 	*p = '\0';
 	*p = '\0';
 	*namep = strdup(buf);
 	*namep = strdup(buf);
 	if(*namep == 0){
 	if(*namep == 0){
-		syslog(0, CRONLOG, "internal error: strdup failure");
+		clog("internal error: strdup failure");
 		_exits(0);
 		_exits(0);
 	}
 	}
 	while(*savec == ' ' || *savec == '\t')
 	while(*savec == ' ' || *savec == '\t')
@@ -492,59 +504,63 @@ rexec(User *user, Job *j)
 	case 0:
 	case 0:
 		break;
 		break;
 	case -1:
 	case -1:
-		syslog(0, CRONLOG, "can't fork a job for %s: %r\n", user->name);
+		clog("can't fork a job for %s: %r\n", user->name);
 	default:
 	default:
 		return;
 		return;
 	}
 	}
 
 
 	if(!mkcmd(j->cmd, buf, sizeof buf)){
 	if(!mkcmd(j->cmd, buf, sizeof buf)){
-		syslog(0, CRONLOG, "internal error: cmd buffer overflow");
+		clog("internal error: cmd buffer overflow");
 		_exits(0);
 		_exits(0);
 	}
 	}
 
 
 	/*
 	/*
-	 * remote call, auth, cmd with no i/o
-	 * give it 2 min to complete
+	 * local call, auth, cmd with no i/o
 	 */
 	 */
 	if(strcmp(j->host, "local") == 0){
 	if(strcmp(j->host, "local") == 0){
 		if(becomeuser(user->name) < 0){
 		if(becomeuser(user->name) < 0){
-			syslog(0, CRONLOG, "%s: can't change uid for %s on %s: %r", user->name, j->cmd, j->host);
+			clog("%s: can't change uid for %s on %s: %r",
+				user->name, j->cmd, j->host);
 			_exits(0);
 			_exits(0);
 		}
 		}
-syslog(0, CRONLOG, "%s: ran '%s' on %s", user->name, j->cmd, j->host);
-		execl("/bin/rc", "rc", "-c", buf, nil);
-		syslog(0, CRONLOG, "%s: exec failed for %s on %s: %r",
+		putenv("service", "rx");
+		clog("%s: ran '%s' on %s", user->name, j->cmd, j->host);
+		execl("/bin/rc", "rc", "-lc", buf, nil);
+		clog("%s: exec failed for %s on %s: %r",
 			user->name, j->cmd, j->host);
 			user->name, j->cmd, j->host);
 		_exits(0);
 		_exits(0);
 	}
 	}
 
 
+	/*
+	 * remote call, auth, cmd with no i/o
+	 * give it 2 min to complete
+	 */
 	alarm(2*Minute*1000);
 	alarm(2*Minute*1000);
 	fd = call(j->host);
 	fd = call(j->host);
 	if(fd < 0){
 	if(fd < 0){
 		if(fd == -2)
 		if(fd == -2)
-			syslog(0, CRONLOG, "%s: dangerous host %s",
-				user->name, j->host);
-		syslog(0, CRONLOG, "%s: can't call %s: %r", user->name, j->host);
+			clog("%s: dangerous host %s", user->name, j->host);
+		clog("%s: can't call %s: %r", user->name, j->host);
 		_exits(0);
 		_exits(0);
 	}
 	}
-syslog(0, CRONLOG, "%s: called %s on %s", user->name, j->cmd, j->host);
+	clog("%s: called %s on %s", user->name, j->cmd, j->host);
 	if(becomeuser(user->name) < 0){
 	if(becomeuser(user->name) < 0){
-		syslog(0, CRONLOG, "%s: can't change uid for %s on %s: %r",
+		clog("%s: can't change uid for %s on %s: %r",
 			user->name, j->cmd, j->host);
 			user->name, j->cmd, j->host);
 		_exits(0);
 		_exits(0);
 	}
 	}
 	ai = auth_proxy(fd, nil, "proto=p9any role=client");
 	ai = auth_proxy(fd, nil, "proto=p9any role=client");
 	if(ai == nil){
 	if(ai == nil){
-		syslog(0, CRONLOG, "%s: can't authenticate for %s on %s: %r",
+		clog("%s: can't authenticate for %s on %s: %r",
 			user->name, j->cmd, j->host);
 			user->name, j->cmd, j->host);
 		_exits(0);
 		_exits(0);
 	}
 	}
-syslog(0, CRONLOG, "%s: authenticated %s on %s", user->name, j->cmd, j->host);
+	clog("%s: authenticated %s on %s", user->name, j->cmd, j->host);
 	write(fd, buf, strlen(buf)+1);
 	write(fd, buf, strlen(buf)+1);
 	write(fd, buf, 0);
 	write(fd, buf, 0);
 	while((n = read(fd, buf, sizeof(buf)-1)) > 0){
 	while((n = read(fd, buf, sizeof(buf)-1)) > 0){
 		buf[n] = 0;
 		buf[n] = 0;
-		syslog(0, CRONLOG, "%s: %s\n", j->cmd, buf);
+		clog("%s: %s\n", j->cmd, buf);
 	}
 	}
 	_exits(0);
 	_exits(0);
 }
 }
@@ -660,6 +676,7 @@ becomeuser(char *new)
 {
 {
 	char *cap;
 	char *cap;
 	int rv;
 	int rv;
+
 	cap = mkcap(getuser(), new);
 	cap = mkcap(getuser(), new);
 	if(cap == nil)
 	if(cap == nil)
 		return -1;
 		return -1;