changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: ip/ipconfig: set ndb database file with -f argument

changeset 4195: ad65200830ef
parent 4194: f33e669a7132
child 4196: 8a341092873b
author: mischief <mischief@offblast.org>
date: Sat, 10 Jan 2015 11:27:45 -0800
files: sys/man/8/ipconfig sys/src/cmd/ip/ipconfig/main.c
description: ip/ipconfig: set ndb database file with -f argument
     1.1--- a/sys/man/8/ipconfig
     1.2+++ b/sys/man/8/ipconfig
     1.3@@ -18,6 +18,8 @@ ipconfig, rip, linklocal, ipv6on \- Inte
     1.4 .IR mtu ]
     1.5 .RB [ -o
     1.6 .IR dhcp-opt ]
     1.7+.RB [ -f
     1.8+.IR dbfile ]
     1.9 .RB [ -x
    1.10 .IR netmtpt ]
    1.11 [
    1.12@@ -227,6 +229,10 @@ disable IPv6 duplicate discovery detecti
    1.13 which removes any existing ARP table entry for one of our IPv6 addresses
    1.14 before adding new ones.
    1.15 .TP
    1.16+.B f
    1.17+use the ndb database file
    1.18+.I dbfile .
    1.19+.TP
    1.20 .B x
    1.21 use the IP stack mounted at
    1.22 .I netmtpt
     2.1--- a/sys/src/cmd/ip/ipconfig/main.c
     2.2+++ b/sys/src/cmd/ip/ipconfig/main.c
     2.3@@ -149,6 +149,7 @@ Ctl	*firstctl, **ctll;
     2.4 Ipifc	*ifc;
     2.5 int	ipv6auto = 0;
     2.6 int	myifc = -1;
     2.7+char	*dbfile;
     2.8 char	*ndboptions;
     2.9 int	nip;
    2.10 int	noconfig;
    2.11@@ -226,7 +227,7 @@ usage(void)
    2.12 {
    2.13 	fprint(2, "usage: %s [-6dDGnNOpPruX][-b baud][-c ctl]* [-g gw]"
    2.14 		"[-h host][-m mtu]\n"
    2.15-		"\t[-x mtpt][-o dhcpopt] type dev [verb] [laddr [mask "
    2.16+		"\t[-f dbfile][-x mtpt][-o dhcpopt] type dev [verb] [laddr [mask "
    2.17 		"[raddr [fs [auth]]]]]\n", argv0);
    2.18 	exits("usage");
    2.19 }
    2.20@@ -519,6 +520,9 @@ main(int argc, char **argv)
    2.21 	case 'D':
    2.22 		debug = 1;
    2.23 		break;
    2.24+	case 'f':
    2.25+		dbfile = EARGF(usage());
    2.26+		break;
    2.27 	case 'g':
    2.28 		if (parseip(conf.gaddr, EARGF(usage())) == -1)
    2.29 			usage();
    2.30@@ -1823,7 +1827,7 @@ ndbconfig(void)
    2.31 	Ndb *db;
    2.32 	Ndbtuple *t, *nt;
    2.33 
    2.34-	db = ndbopen(0);
    2.35+	db = ndbopen(dbfile);
    2.36 	if(db == nil)
    2.37 		sysfatal("can't open ndb: %r");
    2.38 	if (strcmp(conf.type, "ether") != 0 && strcmp(conf.type, "gbe") != 0 ||