Sync with latest KAME

Obtained from:	KAME
This commit is contained in:
Kris Kennaway 2000-07-07 07:25:56 +00:00
parent 2f961bc842
commit 2637b5fb5d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62751
2 changed files with 68 additions and 43 deletions

View file

@ -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.

View file

@ -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)};