Change the code that enables/disables the ATM channel to use the
new ATMIOCOPENVCC/CLOSEVCC. This allows us to not only use UBR channels for IP over ATM, but also CBR, VBR and ABR. Change the format of the link layer address to specify the channel characteristics. The old format is still supported and opens UBR channels.
This commit is contained in:
parent
0ddc915c01
commit
b24521d779
@ -1,6 +1,6 @@
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd June 13, 2003
|
||||
.Dd August 11, 2003
|
||||
.Dt NATMIP 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -19,15 +19,103 @@ like:
|
||||
.Pp
|
||||
.Dl # ifconfig en0 128.252.200.1 netmask 0xffffff00 up
|
||||
.Pp
|
||||
A PVC is added with the
|
||||
IP routing is done with special interface routes (routes with directly
|
||||
reachable destinations) with a link layer gateway address.
|
||||
The link layer address specifies the ATM interface through which the
|
||||
destination can be reached, the virtual channel that connects to the
|
||||
destination and the ATM characteristics of this channel.
|
||||
The address part of the link layer address (see
|
||||
.Xr link_addr 3 )
|
||||
consists of a fixed part (the first 5 bytes) and a part that
|
||||
depends on the kind of the PVC (UBR, CBR, VBR, ABR). Multi-byte values
|
||||
are big-endian encoded: the bytes with the lower numbers contain the
|
||||
higher order bits.
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It byte 0
|
||||
Is a flag byte. Currently only flag 0x20 is used.
|
||||
When set, all IP frames are LLC/SNAP encapsulated before putting them into
|
||||
an AAL5 frame.
|
||||
Setting this flag is recommended and allows interoperability with other
|
||||
CLIP implementations.
|
||||
Note that BPF works only with LLC/SNAP encapsulation.
|
||||
.It byte 1
|
||||
This is the VPI of the channel.
|
||||
.It bytes 2...3
|
||||
VCI of the channel. Must not be zero.
|
||||
.It byte 4
|
||||
Traffic type. One of 0 (UBR), 1 (CBR), 2 (ABR), 3 (VBR).
|
||||
.El
|
||||
.Pp
|
||||
The variable part for UBR connections may be either empty or three bytes:
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It bytes 5...7
|
||||
Specifies the peak cell rate for UBR.
|
||||
.El
|
||||
.Pp
|
||||
The variable part for CBR connections must be three bytes:
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It bytes 5...7
|
||||
Specifies the peak cell rate for CBR.
|
||||
.El
|
||||
.Pp
|
||||
The variable part for VBR connections must be 9 bytes long and specifies three
|
||||
values:
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It bytes 5...7
|
||||
Specifies the peak cell rate for VBR.
|
||||
.It bytes 8...10
|
||||
This is the sustainable cell rate.
|
||||
.It bytes 11...13
|
||||
The maximum burst size.
|
||||
.El
|
||||
.Pp
|
||||
The variable part for ABR connections must be 19 bytes long and specifies the
|
||||
following values:
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It bytes 5...7
|
||||
Specifies the peak cell rate for ABR.
|
||||
.It bytes 8...10
|
||||
The minimum cell rate.
|
||||
.It bytes 11...13
|
||||
The initial cell rate.
|
||||
.It bytes 14...16
|
||||
The transient buffer exposure.
|
||||
.It byte 17
|
||||
The NRM value.
|
||||
.It byte 18
|
||||
The TRM value.
|
||||
.It bytes 19...20
|
||||
The ADTF value.
|
||||
.It byte 21
|
||||
The rate increase factor (RIF).
|
||||
.It byte 22
|
||||
The rate decrease factor (RDF).
|
||||
.It byte 23
|
||||
The cutoff decrease factor (CDF).
|
||||
.El
|
||||
.Pp
|
||||
To add a PVC the
|
||||
.Dq route
|
||||
utility:
|
||||
utility can be used:
|
||||
.Pp
|
||||
.Dl # route add -iface <remote IP address> -link en0:z.0.x.y
|
||||
.Ic # route add -iface
|
||||
.Ar <remote IP address>
|
||||
.Ic -link
|
||||
.Ar <iface> Ns Ic \&: Ns Ar <lladdr>
|
||||
.Pp
|
||||
where x and y are the hexadecimal byte encoding of the VCI to use,
|
||||
and z is the byte encoding of the following flags:
|
||||
The
|
||||
.Ar <iface>
|
||||
is the ATM interface through which
|
||||
.Ar <remote IP address>
|
||||
can be reached and
|
||||
.Ar <lladdr>
|
||||
is the link layer address as a string of dot-separated, hexadecimal bytes.
|
||||
.Pp
|
||||
NATM also supports the old, original format. This consists of 4 byte
|
||||
link layer addresses (and the channels are implicit UBR):
|
||||
.Bl -tag -width "bytes 12...12" -offset indent
|
||||
.It byte 0
|
||||
Flags:
|
||||
.Bl -tag -width "0x02" -offset indent -compact
|
||||
.It 0x01
|
||||
use AAL5.
|
||||
@ -38,40 +126,48 @@ if using AAL5, use an LLC/SNAP header.
|
||||
Thus, parameter 3 means AAL5 and LLC/SNAP encapsulation (this is the required
|
||||
setting for interworking with other CLIP clients).
|
||||
Note that BPF works only with LLC/SNAP encapsulation.
|
||||
.It byte 1
|
||||
VPI for the channel
|
||||
.It bytes 2...3
|
||||
VCI for the channel
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Suppose you have 3 hosts 128.252.200.1, 128.252.200.2 and
|
||||
128.252.200.3 connected by ATM through PVCs:
|
||||
.Pp
|
||||
.Bl -item -offset indent -compact
|
||||
.It
|
||||
between 128.252.200.1 and 128.252.200.2: 0xc9
|
||||
between 128.252.200.1 and 128.252.200.2: 0xc9 UBR
|
||||
.It
|
||||
between 128.252.200.1 and 128.252.200.3: 0xca
|
||||
between 128.252.200.1 and 128.252.200.3: 0xca VBR
|
||||
.It
|
||||
between 128.252.200.2 and 128.252.200.3: 0xcb
|
||||
between 128.252.200.2 and 128.252.200.3: 0xcb CBR
|
||||
.El
|
||||
.Pp
|
||||
The parameters for the VBR channel are: PCR 50000, SCR 10000, MBS 10.
|
||||
The peak cell rate for the CBR channel is 100000.
|
||||
.Pp
|
||||
To enable the links use the following commands:
|
||||
.Pp
|
||||
on host 128.252.200.1:
|
||||
.Bd -literal -offset indent -compact
|
||||
# ifconfig en0 128.252.200.1 netmask 0xffffff00 up
|
||||
# route add -iface 128.252.200.2 -link en0:3.0.0.c9
|
||||
# route add -iface 128.252.200.3 -link en0:3.0.0.ca
|
||||
# route add -iface 128.252.200.2 -link en0:3.0.0.c9.0
|
||||
# route add -iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
|
||||
.Ed
|
||||
.Pp
|
||||
on host 128.252.200.2:
|
||||
.Bd -literal -offset indent -compact
|
||||
# ifconfig en0 128.252.200.2 netmask 0xffffff00 up
|
||||
# route add -iface 128.252.200.1 -link en0:3.0.0.c9
|
||||
# route add -iface 128.252.200.3 -link en0:3.0.0.cb
|
||||
# route add -iface 128.252.200.1 -link en0:3.0.0.c9.0
|
||||
# route add -iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0
|
||||
.Ed
|
||||
.Pp
|
||||
on host 128.252.200.3:
|
||||
.Bd -literal -offset indent -compact
|
||||
# ifconfig en0 128.252.200.3 netmask 0xffffff00 up
|
||||
# route add -iface 128.252.200.1 -link en0:3.0.0.ca
|
||||
# route add -iface 128.252.200.2 -link en0:3.0.0.cb
|
||||
# route add -iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a
|
||||
# route add -iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0
|
||||
.Ed
|
||||
.Pp
|
||||
This can also be done in
|
||||
@ -82,8 +178,8 @@ on host 128.252.200.1:
|
||||
network_interfaces="lo0 en0"
|
||||
ifconfig_en0="inet 128.252.200.1 netmask 255.255.255.0"
|
||||
static_routes="host2 host3"
|
||||
route_host2="-iface 128.252.200.2 -link en0:3.0.0.c9"
|
||||
route_host3="-iface 128.252.200.3 -link en0:3.0.0.ca"
|
||||
route_host2="-iface 128.252.200.2 -link en0:3.0.0.c9.0"
|
||||
route_host3="-iface 128.252.200.3 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
|
||||
.Ed
|
||||
.Pp
|
||||
on host 128.252.200.2:
|
||||
@ -91,8 +187,8 @@ on host 128.252.200.2:
|
||||
network_interfaces="lo0 en0"
|
||||
ifconfig_en0="inet 128.252.200.2 netmask 255.255.255.0"
|
||||
static_routes="host1 host3"
|
||||
route_host1="-iface 128.252.200.1 -link en0:3.0.0.c9"
|
||||
route_host3="-iface 128.252.200.3 -link en0:3.0.0.cb"
|
||||
route_host1="-iface 128.252.200.1 -link en0:3.0.0.c9.0"
|
||||
route_host3="-iface 128.252.200.3 -link en0:3.0.0.cb.1.1.86.a0"
|
||||
.Ed
|
||||
.Pp
|
||||
on host 128.252.200.3:
|
||||
@ -100,8 +196,8 @@ on host 128.252.200.3:
|
||||
network_interfaces="lo0 en0"
|
||||
ifconfig_en0="inet 128.252.200.3 netmask 255.255.255.0"
|
||||
static_routes="host1 host2"
|
||||
route_host1="-iface 128.252.200.1 -link en0:3.0.0.ca"
|
||||
route_host2="-iface 128.252.200.2 -link en0:3.0.0.cb"
|
||||
route_host1="-iface 128.252.200.1 -link en0:3.0.0.ca.3.0.c3.50.0.27.10.0.0.a"
|
||||
route_host2="-iface 128.252.200.2 -link en0:3.0.0.cb.1.1.86.a0"
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr en 4 ,
|
||||
|
@ -65,6 +65,24 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#define SDL(s) ((struct sockaddr_dl *)s)
|
||||
|
||||
#define GET3BYTE(V, A, L) do { \
|
||||
(V) = ((A)[0] << 16) | ((A)[1] << 8) | (A)[2]; \
|
||||
(A) += 3; \
|
||||
(L) -= 3; \
|
||||
} while (0)
|
||||
|
||||
#define GET2BYTE(V, A, L) do { \
|
||||
(V) = ((A)[0] << 8) | (A)[1]; \
|
||||
(A) += 2; \
|
||||
(L) -= 2; \
|
||||
} while (0)
|
||||
|
||||
#define GET1BYTE(V, A, L) do { \
|
||||
(V) = *(A)++; \
|
||||
(L)--; \
|
||||
} while (0)
|
||||
|
||||
|
||||
/*
|
||||
* atm_rtrequest: handle ATM rt request (in support of generic code)
|
||||
* inputs: "req" = request code
|
||||
@ -136,96 +154,59 @@ atm_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
|
||||
|
||||
if (alen == 4) {
|
||||
/* old type address */
|
||||
op.param.flags = *addr++;
|
||||
op.param.vpi = *addr++;
|
||||
op.param.vci = *addr++ << 8;
|
||||
op.param.vci |= *addr++;
|
||||
GET1BYTE(op.param.flags, addr, alen);
|
||||
GET1BYTE(op.param.vpi, addr, alen);
|
||||
GET2BYTE(op.param.vci, addr, alen);
|
||||
op.param.traffic = ATMIO_TRAFFIC_UBR;
|
||||
op.param.aal = (op.param.flags & ATM_PH_AAL5) ?
|
||||
ATMIO_AAL_5 : ATMIO_AAL_0;
|
||||
} else {
|
||||
/* new address */
|
||||
op.param.aal = ATMIO_AAL_5;
|
||||
/* 1. byte LLC/SNAP flag */
|
||||
op.param.flags = *addr++ & ATM_PH_LLCSNAP;
|
||||
alen--;
|
||||
/* 2.-4. byte VPI/VCI */
|
||||
op.param.vpi = *addr++;
|
||||
op.param.vci = *addr++ << 8;
|
||||
op.param.vci |= *addr++;
|
||||
alen -= 3;
|
||||
/* 5. byte: traffic */
|
||||
op.param.traffic = *addr++;
|
||||
alen--;
|
||||
|
||||
GET1BYTE(op.param.flags, addr, alen);
|
||||
op.param.flags &= ATM_PH_LLCSNAP;
|
||||
|
||||
GET1BYTE(op.param.vpi, addr, alen);
|
||||
GET2BYTE(op.param.vci, addr, alen);
|
||||
|
||||
GET1BYTE(op.param.traffic, addr, alen);
|
||||
|
||||
switch (op.param.traffic) {
|
||||
|
||||
case ATMIO_TRAFFIC_UBR:
|
||||
if (alen >= 3) {
|
||||
op.param.tparam.pcr = *addr++ << 16;
|
||||
op.param.tparam.pcr = *addr++ << 8;
|
||||
op.param.tparam.pcr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
}
|
||||
if (alen >= 3)
|
||||
GET3BYTE(op.param.tparam.pcr,
|
||||
addr, alen);
|
||||
break;
|
||||
|
||||
case ATMIO_TRAFFIC_CBR:
|
||||
if (alen < 3)
|
||||
goto bad_param;
|
||||
op.param.tparam.pcr = *addr++ << 16;
|
||||
op.param.tparam.pcr = *addr++ << 8;
|
||||
op.param.tparam.pcr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
GET3BYTE(op.param.tparam.pcr, addr, alen);
|
||||
break;
|
||||
|
||||
case ATMIO_TRAFFIC_VBR:
|
||||
if (alen < 3 * 3)
|
||||
goto bad_param;
|
||||
op.param.tparam.pcr = *addr++ << 16;
|
||||
op.param.tparam.pcr = *addr++ << 8;
|
||||
op.param.tparam.pcr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.scr = *addr++ << 16;
|
||||
op.param.tparam.scr = *addr++ << 8;
|
||||
op.param.tparam.scr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.mbs = *addr++ << 16;
|
||||
op.param.tparam.mbs = *addr++ << 8;
|
||||
op.param.tparam.mbs = *addr++ << 0;
|
||||
alen -= 3;
|
||||
GET3BYTE(op.param.tparam.pcr, addr, alen);
|
||||
GET3BYTE(op.param.tparam.scr, addr, alen);
|
||||
GET3BYTE(op.param.tparam.mbs, addr, alen);
|
||||
break;
|
||||
|
||||
case ATMIO_TRAFFIC_ABR:
|
||||
if (alen < 4 * 3 + 1 * 2 + 5 + 1)
|
||||
if (alen < 4 * 3 + 2 + 1 * 2 + 3)
|
||||
goto bad_param;
|
||||
op.param.tparam.pcr = *addr++ << 16;
|
||||
op.param.tparam.pcr = *addr++ << 8;
|
||||
op.param.tparam.pcr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.mcr = *addr++ << 16;
|
||||
op.param.tparam.mcr = *addr++ << 8;
|
||||
op.param.tparam.mcr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.icr = *addr++ << 16;
|
||||
op.param.tparam.icr = *addr++ << 8;
|
||||
op.param.tparam.icr = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.tbe = *addr++ << 16;
|
||||
op.param.tparam.tbe = *addr++ << 8;
|
||||
op.param.tparam.tbe = *addr++ << 0;
|
||||
alen -= 3;
|
||||
op.param.tparam.nrm = *addr++;
|
||||
alen--;
|
||||
op.param.tparam.trm = *addr++;
|
||||
alen--;
|
||||
op.param.tparam.adtf = *addr++ << 8;
|
||||
op.param.tparam.adtf = *addr++ << 0;
|
||||
alen -= 2;
|
||||
op.param.tparam.rif = *addr++;
|
||||
alen--;
|
||||
op.param.tparam.rdf = *addr++;
|
||||
alen--;
|
||||
op.param.tparam.cdf = *addr++;
|
||||
alen--;
|
||||
GET3BYTE(op.param.tparam.pcr, addr, alen);
|
||||
GET3BYTE(op.param.tparam.mcr, addr, alen);
|
||||
GET3BYTE(op.param.tparam.icr, addr, alen);
|
||||
GET3BYTE(op.param.tparam.tbe, addr, alen);
|
||||
GET1BYTE(op.param.tparam.nrm, addr, alen);
|
||||
GET1BYTE(op.param.tparam.trm, addr, alen);
|
||||
GET2BYTE(op.param.tparam.adtf, addr, alen);
|
||||
GET1BYTE(op.param.tparam.rif, addr, alen);
|
||||
GET1BYTE(op.param.tparam.rdf, addr, alen);
|
||||
GET1BYTE(op.param.tparam.cdf, addr, alen);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user