Unix Technical Forum

arp: replacing existing entries

This is a discussion on arp: replacing existing entries within the lucky.openbsd.tech forums, part of the OpenBSD category; --> I suppose, it is not a new topic for a discussion, anyway, here is the diff. --- arp.c.orig Sun ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-22-2008, 11:21 AM
Mike Belopuhov
 
Posts: n/a
Default arp: replacing existing entries

I suppose, it is not a new topic for a discussion, anyway,
here is the diff.

--- arp.c.orig Sun Mar 13 15:54:38 2005
+++ arp.c Fri Mar 25 02:23:44 2005
@@ -103,6 +103,7 @@ extern int h_errno;
#define F_SET 2
#define F_FILESET 3
#define F_DELETE 4
+#define F_REPLACE 5

int
main(int argc, char *argv[])
@@ -113,7 +114,7 @@ main(int argc, char *argv[])
opterr = 0;
func = 0;

- while ((ch = getopt(argc, argv, "andsf")) != -1) {
+ while ((ch = getopt(argc, argv, "andSsf")) != -1) {
switch ((char)ch) {
case 'a':
aflag = 1;
@@ -126,6 +127,11 @@ main(int argc, char *argv[])
usage();
func = F_DELETE;
break;
+ case 'S':
+ if (func)
+ usage();
+ func = F_REPLACE;
+ break;
case 's':
if (func)
usage();
@@ -158,8 +164,12 @@ main(int argc, char *argv[])
usage();
break;
case F_SET:
+ /* FALLTHROUGH */
+ case F_REPLACE:
if (argc < 2 || argc > 5)
usage();
+ if (func == F_REPLACE)
+ (void)delete(argv[0], NULL);
rtn = set(argc, argv) ? 1 : 0;
break;
case F_DELETE:
@@ -205,6 +215,7 @@ file(char *name)
retval = 1;
continue;
}
+ (void)delete(arg[0], NULL);
if (set(i, args))
retval = 1;
}
@@ -528,6 +539,8 @@ usage(void)
(void)fprintf(stderr, "usage: arp -d -a\n");
(void)fprintf(stderr,
"usage: arp -s hostname ether_addr [temp | permanent] [pub]\n");
+ (void)fprintf(stderr,
+ "usage: arp -S hostname ether_addr [temp | permanent] [pub]\n");
(void)fprintf(stderr, "usage: arp -f filename\n");
exit(1);
}
--- arp.8.orig Sat Jul 10 21:30:31 2004
+++ arp.8 Fri Mar 25 02:30:04 2005
@@ -52,6 +52,10 @@
.Op Cm temp | permanent
.Op Cm pub
.Nm arp
+.Fl S Ar hostname ether_addr
+.Op Cm temp | permanent
+.Op Cm pub
+.Nm arp
.Fl f Ar filename
.Sh DESCRIPTION
The
@@ -133,6 +137,13 @@
.Ar ether_addr .
The Ethernet address is given as six hexadecimal bytes separated by
colons.
+.It Fl S Ar hostname ether_addr
+Create or replace an
+.Tn ARP
+entry for the host called
+.Ar hostname
+with the Ethernet address
+.Ar ether_addr .
.Pp
The
.Cm permanent , pub ,

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com