Hi everyone,

This is a patch that removes -f for arp(8) and ndp(8).  As it stands
currently, ndp(8) -f is not hooked in the code so no one is probably
using that.

arp(8) -f is currently functional but I am not sure how useful.  If you
are using this option, please reply to this thread.

Below you will find a patch that removes -f for both of these tools.

Cheers,
Dimitris

===================================================================
RCS file: /cvs/src/usr.sbin/arp/arp.8,v
retrieving revision 1.36
diff -u -p -r1.36 arp.8
--- usr.sbin/arp/arp.8  27 Jul 2015 17:28:39 -0000      1.36
+++ usr.sbin/arp/arp.8  31 Jul 2015 12:51:29 -0000
@@ -43,7 +43,6 @@
 .Ar hostname
 .Nm arp
 .Op Fl F
-.Op Fl f Ar file
 .Op Fl V Ar rdomain
 .Fl s Ar hostname ether_addr
 .Op Cm temp | permanent
@@ -123,37 +122,6 @@ Force existing entries for the given hos
 and
 .Fl s
 options).
-.It Fl f Ar file
-Process entries from
-.Ar file
-to be set in the ARP tables.
-Any entries in the file that already exist for a given host
-will not be overwritten unless
-.Fl F
-is given.
-Entries in the file should be of the form:
-.Bd -filled -offset indent
-.Ar hostname ether_addr
-.Op Cm temp | permanent
-.Op Cm pub
-.Ed
-.Pp
-The entry will be static (will not time out) unless the word
-.Cm temp
-is given in the command.
-A static ARP entry can be overwritten by network traffic, unless the word
-.Cm permanent
-is given.
-If the word
-.Cm pub
-is given, the entry will be
-.Dq published ;
-that is, this system will act as an ARP server,
-responding to requests for
-.Ar hostname
-even though the host address is not its own.
-This behavior has traditionally been called
-.Em proxy ARP .
 .It Fl n
 Show network addresses as numbers (normally
 .Nm
Index: usr.sbin/arp/arp.c
===================================================================
RCS file: /cvs/src/usr.sbin/arp/arp.c,v
retrieving revision 1.64
diff -u -p -r1.64 arp.c
--- usr.sbin/arp/arp.c  3 Jun 2015 08:10:53 -0000       1.64
+++ usr.sbin/arp/arp.c  31 Jul 2015 12:51:29 -0000
@@ -71,7 +71,6 @@ void nuke_entry(struct sockaddr_dl *sdl,
        struct sockaddr_inarp *sin, struct rt_msghdr *rtm);
 static char *ether_str(struct sockaddr_dl *);
 int wake(const char *ether_addr, const char *iface);
-int file(char *);
 int get(const char *);
 int getinetaddr(const char *, struct in_addr *);
 void getsocket(void);
@@ -97,9 +96,8 @@ extern int h_errno;
 /* which function we're supposed to do */
 #define F_GET          1
 #define F_SET          2
-#define F_FILESET      3
-#define F_DELETE       4
-#define F_WAKE         5
+#define F_DELETE       3
+#define F_WAKE         4
 
 int
 main(int argc, char *argv[])
@@ -131,11 +129,6 @@ main(int argc, char *argv[])
                case 'F':
                        replace = 1;
                        break;
-               case 'f':
-                       if (func)
-                               usage();
-                       func = F_FILESET;
-                       break;
                case 'V':
                        rdomain = strtonum(optarg, 0, RT_TABLEID_MAX, &errstr);
                        if (errstr != NULL) {
@@ -184,11 +177,6 @@ main(int argc, char *argv[])
                else
                        usage();
                break;
-       case F_FILESET:
-               if (argc != 1)
-                       usage();
-               rtn = file(argv[0]);
-               break;
        case F_WAKE:
                if (aflag || nflag || replace || rdomain > 0)
                        usage();
@@ -203,41 +191,6 @@ main(int argc, char *argv[])
        return (rtn);
 }
 
-/*
- * Process a file to set standard arp entries
- */
-int
-file(char *name)
-{
-       char     line[100], arg[5][50], *args[5];
-       int      i, retval;
-       FILE    *fp;
-
-       if ((fp = fopen(name, "r")) == NULL)
-               err(1, "cannot open %s", name);
-       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) {
-                       warnx("bad line: %s", line);
-                       retval = 1;
-                       continue;
-               }
-               if (replace)
-                       delete(arg[0], NULL);
-               if (set(i, args))
-                       retval = 1;
-       }
-       fclose(fp);
-       return (retval);
-}
-
 void
 getsocket(void)
 {
@@ -604,7 +557,7 @@ void
 usage(void)
 {
        fprintf(stderr, "usage: arp [-adn] [-V rdomain] hostname\n");
-       fprintf(stderr, "       arp [-F] [-f file] [-V rdomain] "
+       fprintf(stderr, "       arp [-F] [-V rdomain] "
            "-s hostname ether_addr\n"
            "           [temp | permanent] [pub]\n");
        fprintf(stderr, "       arp -W ether_addr [iface]\n");
Index: usr.sbin/ndp/ndp.8
===================================================================
RCS file: /cvs/src/usr.sbin/ndp/ndp.8,v
retrieving revision 1.33
diff -u -p -r1.33 ndp.8
--- usr.sbin/ndp/ndp.8  3 Sep 2014 10:39:41 -0000       1.33
+++ usr.sbin/ndp/ndp.8  31 Jul 2015 12:51:29 -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: usr.sbin/ndp/ndp.c
===================================================================
RCS file: /cvs/src/usr.sbin/ndp/ndp.c,v
retrieving revision 1.61
diff -u -p -r1.61 ndp.c
--- usr.sbin/ndp/ndp.c  3 Jun 2015 08:10:53 -0000       1.61
+++ usr.sbin/ndp/ndp.c  31 Jul 2015 12:51:29 -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);

Reply via email to