summaryrefslogtreecommitdiffstats
path: root/usr.sbin/prefix
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2000-07-07 07:25:56 +0000
committerkris <kris@FreeBSD.org>2000-07-07 07:25:56 +0000
commit2961019f38d69087b51075d8a18e6b5cd4165402 (patch)
tree3286e7d12601b3656fc064d26e0f97e312500a52 /usr.sbin/prefix
parent5f9e0e210ee3f24e57386f6a623e6c274039e846 (diff)
downloadFreeBSD-src-2961019f38d69087b51075d8a18e6b5cd4165402.zip
FreeBSD-src-2961019f38d69087b51075d8a18e6b5cd4165402.tar.gz
Sync with latest KAME
Obtained from: KAME
Diffstat (limited to 'usr.sbin/prefix')
-rw-r--r--usr.sbin/prefix/prefix.875
-rw-r--r--usr.sbin/prefix/prefix.c36
2 files changed, 68 insertions, 43 deletions
diff --git a/usr.sbin/prefix/prefix.8 b/usr.sbin/prefix/prefix.8
index e78ee68..70a1e9e 100644
--- a/usr.sbin/prefix/prefix.8
+++ b/usr.sbin/prefix/prefix.8
@@ -1,6 +1,6 @@
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
-.\"
+.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
@@ -12,7 +12,7 @@
.\" 3. Neither the name of the project nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
-.\"
+.\"
.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: prefix.8,v 1.1.1.1 1999/08/08 23:31:13 itojun Exp $
+.\" $Id: prefix.8,v 1.4 2000/05/31 17:00:08 itojun Exp $
.\" $FreeBSD$
.\"
.Dd October 10, 1998
@@ -36,37 +36,62 @@
.Nd configure network interface prefixes
.Sh SYNOPSIS
.Nm prefix
+.Bk -words
.Ar interface prefix
+.Ek
+.Bk -words
.Op Ar parameters
+.Ek
+.Bk -words
.Op Cm set | delete
+.Ek
.Nm prefix
+.Bk -words
+.Ek
.Ar interface
-.Cm matchpr
-.Ar match_prefix
-.Cm mp_len
-.Ar match_prefix_len
-.Cm usepr
-.Ar use_prefix
-.Cm up_uselen
-.Ar use_prefix_len
+.Ek
+.Bk -words
+.Cm matchpr Ar match_prefix
+.Ek
+.Bk -words
+.Cm mp_len Ar match_prefix_len
+.Ek
+.Bk -words
+.Cm usepr Ar use_prefix
+.Ek
+.Bk -words
+.Cm up_uselen Ar use_prefix_len
+.Ek
+.Bk -words
.Op Ar parameters
+.Ek
+.Bk -words
.Op Cm add | change | setglobal
+.Ek
.Nm prefix
.Fl a
.Op Fl d
.Op Fl u
-.Cm matchpr
-.Ar match_prefix
-.Cm mp_len
-.Ar match_prefix_len
-.Cm usepr
-.Ar use_prefix
-.Cm up_uselen
-.Ar use_prefix_uselen
+.Bk -words
+.Cm matchpr Ar match_prefix
+.Ek
+.Bk -words
+.Cm mp_len Ar match_prefix_len
+.Ek
+.Bk -words
+.Cm usepr Ar use_prefix
+.Ek
+.Bk -words
+.Cm up_uselen Ar use_prefix_uselen
+.Ek
+.Bk -words
.Op Ar parameters
+.Ek
+.Bk -words
.Op Cm add | change | setglobal
+.Ek
.Sh DESCRIPTION
-.Nm Prefix
+.Nm
is used to assign an prefix
to a network interface and/or renumbering
network interface prefixes.
@@ -104,7 +129,7 @@ to a network interface.
Specify that
.Ar len
bits are reserved as identifier for IPv6 sub-networks in
-.Ar prefix .
+.Ar prefix.
The
.Ar len
must be integer, and for syntactical reason it must be between 0 to 128.
@@ -147,11 +172,11 @@ copied to the starting part of prefixes to be added on
.Cm add | change | setglobal
command, as decimal bit number.
.It Cm up_keeplen Ar use_prefix_keeplen
-Specify the medium part of
+Specify the midium part of
.Ar use_prefix
just next to the starting part specified by
-.Ar use_prefix_uselen ,
-as decimal bit number.
+.Ar use_prefix_uselen
+, as decimal bit number.
Contiguous bits part in the same bit position of an existent prefix
matched with
.Ar match_prefix
@@ -173,7 +198,7 @@ as prefix valid life time for a prefix to be added.
Valid value for
.Ar time
is same as for
-.Cm pltime .
+.Cm pltime.
.It Cm raf_auto
Enable the autonomous address auto configuration for the prefix to be
added.
diff --git a/usr.sbin/prefix/prefix.c b/usr.sbin/prefix/prefix.c
index 04bd9a1..84fbf26 100644
--- a/usr.sbin/prefix/prefix.c
+++ b/usr.sbin/prefix/prefix.c
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -13,7 +13,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -36,7 +36,9 @@
#include <sys/time.h>
#include <net/if.h>
+#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <net/if_var.h>
+#endif /* __FreeBSD__ >= 3 */
#include <net/if_dl.h>
#include <net/if_types.h>
#include <net/route.h>
@@ -55,8 +57,8 @@
#include <string.h>
#include <unistd.h>
-#define DEF_ADVVALIDLIFETIME 2592000
-#define DEF_ADVPREFERREDLIFETIME 604800
+#define DEF_ADVVALIDLIFETIME 2592000
+#define DEF_ADVPREFERREDLIFETIME 604800
struct in6_prefixreq prereq = {{NULL}, /* interface name */
PR_ORIG_STATIC,
64, /* default plen */
@@ -81,7 +83,7 @@ struct in6_rrenumreq rrreq = {{NULL}, /* interface name */
{NULL} /* use prefix */
};
-#define C(x) ((caddr_t) &x)
+#define C(x) ((caddr_t) &x)
struct prefix_cmds {
const char *errmsg;
@@ -95,12 +97,12 @@ struct prefix_cmds {
{"SIOCSGIFPREFIX_IN6 failed", SIOCSGIFPREFIX_IN6, C(rrreq)}
};
-#define PREF_CMD_SET 0
-#define PREF_CMD_DELETE 1
-#define PREF_CMD_ADD 2
-#define PREF_CMD_CHANGE 3
-#define PREF_CMD_SETGLOBAL 4
-#define PREF_CMD_MAX 5
+#define PREF_CMD_SET 0
+#define PREF_CMD_DELETE 1
+#define PREF_CMD_ADD 2
+#define PREF_CMD_CHANGE 3
+#define PREF_CMD_SETGLOBAL 4
+#define PREF_CMD_MAX 5
u_int prcmd = PREF_CMD_SET; /* default command */
@@ -110,8 +112,6 @@ int flags;
int newprefix_setdel, newprefix_match, newprefix_use, newprefix_uselen,
newprefix_keeplen;
-char ntop_buf[INET6_ADDRSTRLEN]; /*inet_ntop()*/
-
void Perror __P((const char *cmd));
int prefix __P((int argc, char *const *argv));
void usage __P((void));
@@ -251,7 +251,7 @@ main(argc, argv)
while (next < lim) {
ifm = (struct if_msghdr *)next;
-
+
if (ifm->ifm_type == RTM_IFINFO) {
sdl = (struct sockaddr_dl *)(ifm + 1);
flags = ifm->ifm_flags;
@@ -379,9 +379,9 @@ prefix(int argc, char *const *argv)
close(s);
return(0);
}
-#define PREFIX 0
-#define MPREFIX 1
-#define UPREFIX 2
+#define PREFIX 0
+#define MPREFIX 1
+#define UPREFIX 2
void
Perror(cmd)
@@ -402,7 +402,7 @@ Perror(cmd)
}
}
-#define SIN6(x) ((struct sockaddr_in6 *) &(x))
+#define SIN6(x) ((struct sockaddr_in6 *) &(x))
struct sockaddr_in6 *sin6tab[] = {
SIN6(prereq.ipr_prefix), SIN6(rrreq.irr_matchprefix),
SIN6(rrreq.irr_useprefix)};
OpenPOWER on IntegriCloud