shithub: riscv

Download patch

ref: a4650bdf834911d0d3b06d630f960fbd0dd1c9ed
parent: 4dfcb4791be0f4e4f9ab24b654af1f8bfb9b3758
author: mischief <mischief@offblast.org>
date: Sat Jan 10 06:27:45 EST 2015

ip/ipconfig: set ndb database file with -f argument

--- a/sys/man/8/ipconfig
+++ b/sys/man/8/ipconfig
@@ -18,6 +18,8 @@
 .IR mtu ]
 .RB [ -o
 .IR dhcp-opt ]
+.RB [ -f
+.IR dbfile ]
 .RB [ -x
 .IR netmtpt ]
 [
@@ -226,6 +228,10 @@
 disable IPv6 duplicate discovery detection,
 which removes any existing ARP table entry for one of our IPv6 addresses
 before adding new ones.
+.TP
+.B f
+use the ndb database file
+.I dbfile .
 .TP
 .B x
 use the IP stack mounted at
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -149,6 +149,7 @@
 Ipifc	*ifc;
 int	ipv6auto = 0;
 int	myifc = -1;
+char	*dbfile;
 char	*ndboptions;
 int	nip;
 int	noconfig;
@@ -226,7 +227,7 @@
 {
 	fprint(2, "usage: %s [-6dDGnNOpPruX][-b baud][-c ctl]* [-g gw]"
 		"[-h host][-m mtu]\n"
-		"\t[-x mtpt][-o dhcpopt] type dev [verb] [laddr [mask "
+		"\t[-f dbfile][-x mtpt][-o dhcpopt] type dev [verb] [laddr [mask "
 		"[raddr [fs [auth]]]]]\n", argv0);
 	exits("usage");
 }
@@ -519,6 +520,9 @@
 	case 'D':
 		debug = 1;
 		break;
+	case 'f':
+		dbfile = EARGF(usage());
+		break;
 	case 'g':
 		if (parseip(conf.gaddr, EARGF(usage())) == -1)
 			usage();
@@ -1823,7 +1827,7 @@
 	Ndb *db;
 	Ndbtuple *t, *nt;
 
-	db = ndbopen(0);
+	db = ndbopen(dbfile);
 	if(db == nil)
 		sysfatal("can't open ndb: %r");
 	if (strcmp(conf.type, "ether") != 0 && strcmp(conf.type, "gbe") != 0 ||