On Sat, Jul 25, 2015 at 09:20:18PM +0200, Martin Pieuchot wrote: > On 13/07/15(Mon) 14:04, Dimitris Papastamos wrote: > > Hi, > > > > I noticed -f in ndp(8) did nothing at all so I've enabled it and > > documented the file syntax in the man page. > > If it does nothing, I'd say let's kill it. >
Index: ndp.8 =================================================================== RCS file: /cvs/src/usr.sbin/ndp/ndp.8,v retrieving revision 1.33 diff -u -p -r1.33 ndp.8 --- ndp.8 3 Sep 2014 10:39:41 -0000 1.33 +++ ndp.8 25 Jul 2015 20:10:08 -0000 @@ -44,7 +44,6 @@ .Op Fl H | P | R .Op Fl A Ar wait .Op Fl d Ar hostname -.Op Fl f Ar filename .Op Fl i Ar interface Op Ar flag ... .Op Fl s Ar nodename etheraddr Oo Ic temp Oc Op Ic proxy .Op Fl V Ar rdomain @@ -119,9 +118,6 @@ the node has sent during the current sta Erase all the NDP entries. .It Fl d Ar hostname Delete the specified NDP entry. -.It Fl f Ar filename -Parse the file specified by -.Ar filename . .It Fl H Harmonize consistency between the routing table and the default router list; install the top entry of the list into the kernel routing table. Index: ndp.c =================================================================== RCS file: /cvs/src/usr.sbin/ndp/ndp.c,v retrieving revision 1.61 diff -u -p -r1.61 ndp.c --- ndp.c 3 Jun 2015 08:10:53 -0000 1.61 +++ ndp.c 25 Jul 2015 20:10:08 -0000 @@ -123,7 +123,6 @@ char ntop_buf[INET6_ADDRSTRLEN]; /* inet char host_buf[NI_MAXHOST]; /* getnameinfo() */ char ifix_buf[IFNAMSIZ]; /* if_indextoname() */ -int file(char *); void getsocket(void); int set(int, char **); void get(char *); @@ -294,41 +293,6 @@ main(int argc, char *argv[]) exit(0); } -/* - * Process a file to set standard ndp entries - */ -int -file(char *name) -{ - FILE *fp; - int i, retval; - char line[100], arg[5][50], *args[5]; - - if ((fp = fopen(name, "r")) == NULL) { - fprintf(stderr, "ndp: cannot open %s\n", name); - exit(1); - } - args[0] = &arg[0][0]; - args[1] = &arg[1][0]; - args[2] = &arg[2][0]; - args[3] = &arg[3][0]; - args[4] = &arg[4][0]; - retval = 0; - while (fgets(line, sizeof(line), fp) != NULL) { - i = sscanf(line, "%49s %49s %49s %49s %49s", - arg[0], arg[1], arg[2], arg[3], arg[4]); - if (i < 2) { - fprintf(stderr, "ndp: bad line: %s\n", line); - retval = 1; - continue; - } - if (set(i, args)) - retval = 1; - } - fclose(fp); - return (retval); -} - void getsocket(void) { @@ -792,7 +756,7 @@ usage(void) { printf("usage: ndp [-nrt] [-a | -c | -p] [-H | -P | -R] "); printf("[-A wait] [-d hostname]\n"); - printf("\t[-f filename] [-i interface [flag ...]]\n"); + printf("\t[-i interface [flag ...]]\n"); printf("\t[-s nodename etheraddr [temp] [proxy]] "); printf("[-V rdomain] [hostname]\n"); exit(1);