Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
e2dc309e
Commit
e2dc309e
authored
Apr 08, 2008
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2
parents
97f550ca
ae9b671d
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
710 additions
and
121 deletions
+710
-121
COPYING
COPYING
+9
-9
include/linux/netfilter.h
include/linux/netfilter.h
+2
-2
include/linux/pkt_cls.h
include/linux/pkt_cls.h
+4
-4
include/linux/types.h
include/linux/types.h
+3
-3
ip/Makefile
ip/Makefile
+1
-1
ip/ip6tunnel.c
ip/ip6tunnel.c
+24
-18
ip/ipaddress.c
ip/ipaddress.c
+25
-8
ip/iptunnel.c
ip/iptunnel.c
+3
-1
man/man8/ip.8
man/man8/ip.8
+556
-35
misc/Makefile
misc/Makefile
+1
-1
misc/ss.c
misc/ss.c
+6
-6
tc/Makefile
tc/Makefile
+2
-2
tc/m_police.c
tc/m_police.c
+10
-1
tc/q_cbq.c
tc/q_cbq.c
+44
-27
tc/q_tbf.c
tc/q_tbf.c
+20
-3
No files found.
COPYING
View file @
e2dc309e
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
Version 2, June 1991
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
Everyone is permitted to copy and distribute verbatim copies
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
of this license document, but changing it is not allowed.
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
The licenses for most software are designed to take away your
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users.
This
software--to make sure the software is free for all its users.
This
General Public License applies to most of the Free Software
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
using it. (Some other Free Software Foundation software is covered by
...
@@ -19,7 +19,7 @@ the GNU Library General Public License instead.) You can apply it to
...
@@ -19,7 +19,7 @@ the GNU Library General Public License instead.) You can apply it to
your programs, too.
your programs, too.
When we speak of free software, we are referring to freedom, not
When we speak of free software, we are referring to freedom, not
price.
Our General Public Licenses are designed to make sure that you
price.
Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
if you want it, that you can change the software or use pieces of it
...
@@ -201,7 +201,7 @@ otherwise) that contradict the conditions of this License, they do not
...
@@ -201,7 +201,7 @@ otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all.
For example, if a patent
may not distribute the Program at all.
For example, if a patent
license would not permit royalty-free redistribution of the Program by
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
the only way you could satisfy both it and this License would be to
...
@@ -239,7 +239,7 @@ of the General Public License from time to time. Such new versions will
...
@@ -239,7 +239,7 @@ of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
address new problems or concerns.
Each version is given a distinguishing version number.
If the Program
Each version is given a distinguishing version number.
If the Program
specifies a version number of this License which applies to it and "any
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
either of that version or of any later version published by the Free
...
@@ -249,7 +249,7 @@ Foundation.
...
@@ -249,7 +249,7 @@ Foundation.
10. If you wish to incorporate parts of the Program into other free
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
programs whose distribution conditions are different, write to the author
to ask for permission.
For software which is copyrighted by the Free
to ask for permission.
For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of preserving the free status of all derivatives of our free software and
...
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
...
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
<one line to give the program's name and a brief idea of what it does.>
Copyright (C)
19yy
<name of author>
Copyright (C)
<year>
<name of author>
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
...
@@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
USA
Foundation, Inc., 5
1 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
Also add information on how to contact you by electronic and paper mail.
...
@@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail.
...
@@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C)
19yy
name of author
Gnomovision version 69, Copyright (C)
year
name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
under certain conditions; type `show c' for details.
...
...
include/linux/netfilter.h
View file @
e2dc309e
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#define NF_VERDICT_QMASK 0xffff0000
#define NF_VERDICT_QMASK 0xffff0000
#define NF_VERDICT_QBITS 16
#define NF_VERDICT_QBITS 16
#define NF_QUEUE_NR(x) (((
x << NF_VERDICT_Q
BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
#define NF_QUEUE_NR(x) (((
(x) << NF_VERDICT_
BITS) & NF_VERDICT_QMASK) | NF_QUEUE)
/* only for userspace compatibility */
/* only for userspace compatibility */
/* Generic cache responses from hook functions.
/* Generic cache responses from hook functions.
...
@@ -37,7 +37,7 @@ enum nf_inet_hooks {
...
@@ -37,7 +37,7 @@ enum nf_inet_hooks {
};
};
union
nf_inet_addr
{
union
nf_inet_addr
{
u_int32_t
all
[
4
];
__u32
all
[
4
];
__be32
ip
;
__be32
ip
;
__be32
ip6
[
4
];
__be32
ip6
[
4
];
struct
in_addr
in
;
struct
in_addr
in
;
...
...
include/linux/pkt_cls.h
View file @
e2dc309e
...
@@ -201,8 +201,8 @@ enum
...
@@ -201,8 +201,8 @@ enum
struct
tc_u32_key
struct
tc_u32_key
{
{
__
u
32
mask
;
__
be
32
mask
;
__
u
32
val
;
__
be
32
val
;
int
off
;
int
off
;
int
offmask
;
int
offmask
;
};
};
...
@@ -213,12 +213,12 @@ struct tc_u32_sel
...
@@ -213,12 +213,12 @@ struct tc_u32_sel
unsigned
char
offshift
;
unsigned
char
offshift
;
unsigned
char
nkeys
;
unsigned
char
nkeys
;
__
u
16
offmask
;
__
be
16
offmask
;
__u16
off
;
__u16
off
;
short
offoff
;
short
offoff
;
short
hoff
;
short
hoff
;
__
u
32
hmask
;
__
be
32
hmask
;
struct
tc_u32_key
keys
[
0
];
struct
tc_u32_key
keys
[
0
];
};
};
...
...
include/linux/types.h
View file @
e2dc309e
...
@@ -26,7 +26,7 @@ typedef __kernel_mqd_t mqd_t;
...
@@ -26,7 +26,7 @@ typedef __kernel_mqd_t mqd_t;
typedef
__kernel_uid_t
uid_t
;
typedef
__kernel_uid_t
uid_t
;
typedef
__kernel_gid_t
gid_t
;
typedef
__kernel_gid_t
gid_t
;
#if defined(__GNUC__)
&& !defined(__STRICT_ANSI__)
#if defined(__GNUC__)
typedef
__kernel_loff_t
loff_t
;
typedef
__kernel_loff_t
loff_t
;
#endif
#endif
...
@@ -92,7 +92,7 @@ typedef __u8 uint8_t;
...
@@ -92,7 +92,7 @@ typedef __u8 uint8_t;
typedef
__u16
uint16_t
;
typedef
__u16
uint16_t
;
typedef
__u32
uint32_t
;
typedef
__u32
uint32_t
;
#if defined(__GNUC__)
&& !defined(__STRICT_ANSI__)
#if defined(__GNUC__)
typedef
__u64
uint64_t
;
typedef
__u64
uint64_t
;
typedef
__u64
u_int64_t
;
typedef
__u64
u_int64_t
;
typedef
__s64
int64_t
;
typedef
__s64
int64_t
;
...
@@ -154,7 +154,7 @@ typedef __u16 __bitwise __le16;
...
@@ -154,7 +154,7 @@ typedef __u16 __bitwise __le16;
typedef
__u16
__bitwise
__be16
;
typedef
__u16
__bitwise
__be16
;
typedef
__u32
__bitwise
__le32
;
typedef
__u32
__bitwise
__le32
;
typedef
__u32
__bitwise
__be32
;
typedef
__u32
__bitwise
__be32
;
#if defined(__GNUC__)
&& !defined(__STRICT_ANSI__)
#if defined(__GNUC__)
typedef
__u64
__bitwise
__le64
;
typedef
__u64
__bitwise
__le64
;
typedef
__u64
__bitwise
__be64
;
typedef
__u64
__bitwise
__be64
;
#endif
#endif
...
...
ip/Makefile
View file @
e2dc309e
...
@@ -17,7 +17,7 @@ ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL)
...
@@ -17,7 +17,7 @@ ip: $(IPOBJ) $(LIBNETLINK) $(LIBUTIL)
rtmon
:
$(RTMONOBJ) $(LIBNETLINK)
rtmon
:
$(RTMONOBJ) $(LIBNETLINK)
install
:
all
install
:
all
install
-m
0755
-s
$(TARGETS)
$(DESTDIR)$(SBINDIR)
install
-m
0755
$(TARGETS)
$(DESTDIR)$(SBINDIR)
install
-m
0755
$(SCRIPTS)
$(DESTDIR)$(SBINDIR)
install
-m
0755
$(SCRIPTS)
$(DESTDIR)$(SBINDIR)
clean
:
clean
:
...
...
ip/ip6tunnel.c
View file @
e2dc309e
...
@@ -55,17 +55,17 @@ static void usage(void)
...
@@ -55,17 +55,17 @@ static void usage(void)
fprintf
(
stderr
,
" [ mode { ip6ip6 | ipip6 | any } ]
\n
"
);
fprintf
(
stderr
,
" [ mode { ip6ip6 | ipip6 | any } ]
\n
"
);
fprintf
(
stderr
,
" [ remote ADDR local ADDR ] [ dev PHYS_DEV ]
\n
"
);
fprintf
(
stderr
,
" [ remote ADDR local ADDR ] [ dev PHYS_DEV ]
\n
"
);
fprintf
(
stderr
,
" [ encaplimit ELIM ]
\n
"
);
fprintf
(
stderr
,
" [ encaplimit ELIM ]
\n
"
);
fprintf
(
stderr
,
" [ hoplimit
HLIM ] [ tc TC ] [ fl F
L ]
\n
"
);
fprintf
(
stderr
,
" [ hoplimit
TTL ] [ tclass TCLASS ] [ flowlabel FLOWLABE
L ]
\n
"
);
fprintf
(
stderr
,
" [ dscp inherit ]
\n
"
);
fprintf
(
stderr
,
" [ dscp inherit ]
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"
\n
"
);
fprintf
(
stderr
,
"Where: NAME := STRING
\n
"
);
fprintf
(
stderr
,
"Where: NAME
:= STRING
\n
"
);
fprintf
(
stderr
,
" ADDR := IPV6_ADDRESS
\n
"
);
fprintf
(
stderr
,
" ADDR
:= IPV6_ADDRESS
\n
"
);
fprintf
(
stderr
,
" ELIM := { none | 0..255 }(default=%d)
\n
"
,
fprintf
(
stderr
,
" ELIM
:= { none | 0..255 }(default=%d)
\n
"
,
IPV6_DEFAULT_TNL_ENCAP_LIMIT
);
IPV6_DEFAULT_TNL_ENCAP_LIMIT
);
fprintf
(
stderr
,
"
HLIM
:= 0..255 (default=%d)
\n
"
,
fprintf
(
stderr
,
"
TTL
:= 0..255 (default=%d)
\n
"
,
DEFAULT_TNL_HOP_LIMIT
);
DEFAULT_TNL_HOP_LIMIT
);
fprintf
(
stderr
,
" T
C
:= { 0x0..0xff | inherit }
\n
"
);
fprintf
(
stderr
,
" T
OS
:= { 0x0..0xff | inherit }
\n
"
);
fprintf
(
stderr
,
" FL
:= { 0x0..0xfffff | inherit }
\n
"
);
fprintf
(
stderr
,
" FL
OWLABEL
:= { 0x0..0xfffff | inherit }
\n
"
);
exit
(
-
1
);
exit
(
-
1
);
}
}
...
@@ -93,16 +93,16 @@ static void print_tunnel(struct ip6_tnl_parm *p)
...
@@ -93,16 +93,16 @@ static void print_tunnel(struct ip6_tnl_parm *p)
printf
(
" hoplimit %u"
,
p
->
hop_limit
);
printf
(
" hoplimit %u"
,
p
->
hop_limit
);
if
(
p
->
flags
&
IP6_TNL_F_USE_ORIG_TCLASS
)
if
(
p
->
flags
&
IP6_TNL_F_USE_ORIG_TCLASS
)
printf
(
" tc inherit"
);
printf
(
" tc
lass
inherit"
);
else
{
else
{
__u32
val
=
ntohl
(
p
->
flowinfo
&
IP6_FLOWINFO_TCLASS
);
__u32
val
=
ntohl
(
p
->
flowinfo
&
IP6_FLOWINFO_TCLASS
);
printf
(
" tc 0x%02x"
,
(
__u8
)(
val
>>
20
));
printf
(
" tc
lass
0x%02x"
,
(
__u8
)(
val
>>
20
));
}
}
if
(
p
->
flags
&
IP6_TNL_F_USE_ORIG_FLOWLABEL
)
if
(
p
->
flags
&
IP6_TNL_F_USE_ORIG_FLOWLABEL
)
printf
(
" fl inherit"
);
printf
(
" fl
owlabel
inherit"
);
else
else
printf
(
" fl 0x%05x"
,
ntohl
(
p
->
flowinfo
&
IP6_FLOWINFO_FLOWLABEL
));
printf
(
" fl
owlabel
0x%05x"
,
ntohl
(
p
->
flowinfo
&
IP6_FLOWINFO_FLOWLABEL
));
printf
(
" (flowinfo 0x%08x)"
,
ntohl
(
p
->
flowinfo
));
printf
(
" (flowinfo 0x%08x)"
,
ntohl
(
p
->
flowinfo
));
...
@@ -161,33 +161,39 @@ static int parse_args(int argc, char **argv, struct ip6_tnl_parm *p)
...
@@ -161,33 +161,39 @@ static int parse_args(int argc, char **argv, struct ip6_tnl_parm *p)
invarg
(
"invalid ELIM"
,
*
argv
);
invarg
(
"invalid ELIM"
,
*
argv
);
p
->
encap_limit
=
uval
;
p
->
encap_limit
=
uval
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"hoplimit"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"hoplimit"
)
==
0
||
strcmp
(
*
argv
,
"ttl"
)
==
0
||
strcmp
(
*
argv
,
"hlim"
)
==
0
)
{
__u8
uval
;
__u8
uval
;
NEXT_ARG
();
NEXT_ARG
();
if
(
get_u8
(
&
uval
,
*
argv
,
0
))
if
(
get_u8
(
&
uval
,
*
argv
,
0
))
invarg
(
"invalid
HLIM
"
,
*
argv
);
invarg
(
"invalid
TTL
"
,
*
argv
);
p
->
hop_limit
=
uval
;
p
->
hop_limit
=
uval
;
}
else
if
(
strcmp
(
*
argv
,
"tc"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"tclass"
)
==
0
||
strcmp
(
*
argv
,
"tc"
)
==
0
||
strcmp
(
*
argv
,
"tos"
)
==
0
||
matches
(
*
argv
,
"dsfield"
)
==
0
)
{
__u8
uval
;
__u8
uval
;
NEXT_ARG
();
NEXT_ARG
();
if
(
strcmp
(
*
argv
,
"inherit"
)
==
0
)
if
(
strcmp
(
*
argv
,
"inherit"
)
==
0
)
p
->
flags
|=
IP6_TNL_F_USE_ORIG_TCLASS
;
p
->
flags
|=
IP6_TNL_F_USE_ORIG_TCLASS
;
else
{
else
{
if
(
get_u8
(
&
uval
,
*
argv
,
16
))
if
(
get_u8
(
&
uval
,
*
argv
,
16
))
invarg
(
"invalid TC"
,
*
argv
);
invarg
(
"invalid TC
lass
"
,
*
argv
);
p
->
flowinfo
|=
htonl
((
__u32
)
uval
<<
20
)
&
IP6_FLOWINFO_TCLASS
;
p
->
flowinfo
|=
htonl
((
__u32
)
uval
<<
20
)
&
IP6_FLOWINFO_TCLASS
;
p
->
flags
&=
~
IP6_TNL_F_USE_ORIG_TCLASS
;
p
->
flags
&=
~
IP6_TNL_F_USE_ORIG_TCLASS
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"fl"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"flowlabel"
)
==
0
||
strcmp
(
*
argv
,
"fl"
)
==
0
)
{
__u32
uval
;
__u32
uval
;
NEXT_ARG
();
NEXT_ARG
();
if
(
strcmp
(
*
argv
,
"inherit"
)
==
0
)
if
(
strcmp
(
*
argv
,
"inherit"
)
==
0
)
p
->
flags
|=
IP6_TNL_F_USE_ORIG_FLOWLABEL
;
p
->
flags
|=
IP6_TNL_F_USE_ORIG_FLOWLABEL
;
else
{
else
{
if
(
get_u32
(
&
uval
,
*
argv
,
16
))
if
(
get_u32
(
&
uval
,
*
argv
,
16
))
invarg
(
"invalid F
L
"
,
*
argv
);
invarg
(
"invalid F
lowlabel
"
,
*
argv
);
if
(
uval
>
0xFFFFF
)
if
(
uval
>
0xFFFFF
)
invarg
(
"invalid F
L
"
,
*
argv
);
invarg
(
"invalid F
lowlabel
"
,
*
argv
);
p
->
flowinfo
|=
htonl
(
uval
)
&
IP6_FLOWINFO_FLOWLABEL
;
p
->
flowinfo
|=
htonl
(
uval
)
&
IP6_FLOWINFO_FLOWLABEL
;
p
->
flags
&=
~
IP6_TNL_F_USE_ORIG_FLOWLABEL
;
p
->
flags
&=
~
IP6_TNL_F_USE_ORIG_FLOWLABEL
;
}
}
...
...
ip/ipaddress.c
View file @
e2dc309e
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <sys/errno.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <string.h>
#include <string.h>
...
@@ -114,7 +115,20 @@ void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
...
@@ -114,7 +115,20 @@ void print_link_flags(FILE *fp, unsigned flags, unsigned mdown)
fprintf
(
fp
,
"> "
);
fprintf
(
fp
,
"> "
);
}
}
void
print_queuelen
(
char
*
name
)
static
const
char
*
oper_states
[]
=
{
"UNKNOWN"
,
"NOTPRESENT"
,
"DOWN"
,
"LOWERLAYERDOWN"
,
"TESTING"
,
"DORMANT"
,
"UP"
};
static
void
print_operstate
(
FILE
*
f
,
__u8
state
)
{
if
(
state
>=
sizeof
(
oper_states
)
/
sizeof
(
oper_states
[
0
]))
fprintf
(
f
,
"state %#x "
,
state
);
else
fprintf
(
f
,
"state %s "
,
oper_states
[
state
]);
}
static
void
print_queuelen
(
FILE
*
f
,
const
char
*
name
)
{
{
struct
ifreq
ifr
;
struct
ifreq
ifr
;
int
s
;
int
s
;
...
@@ -126,14 +140,14 @@ void print_queuelen(char *name)
...
@@ -126,14 +140,14 @@ void print_queuelen(char *name)
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
memset
(
&
ifr
,
0
,
sizeof
(
ifr
));
strcpy
(
ifr
.
ifr_name
,
name
);
strcpy
(
ifr
.
ifr_name
,
name
);
if
(
ioctl
(
s
,
SIOCGIFTXQLEN
,
&
ifr
)
<
0
)
{
if
(
ioctl
(
s
,
SIOCGIFTXQLEN
,
&
ifr
)
<
0
)
{
perror
(
"SIOCGIFXQLEN"
);
fprintf
(
f
,
"ioctl(SIOCGIFXQLEN) failed: %s
\n
"
,
strerror
(
errno
)
);
close
(
s
);
close
(
s
);
return
;
return
;
}
}
close
(
s
);
close
(
s
);
if
(
ifr
.
ifr_qlen
)
if
(
ifr
.
ifr_qlen
)
printf
(
"qlen %d"
,
ifr
.
ifr_qlen
);
fprintf
(
f
,
"qlen %d"
,
ifr
.
ifr_qlen
);
}
}
static
void
print_linktype
(
FILE
*
fp
,
struct
rtattr
*
tb
)
static
void
print_linktype
(
FILE
*
fp
,
struct
rtattr
*
tb
)
...
@@ -233,8 +247,11 @@ int print_linkinfo(const struct sockaddr_nl *who,
...
@@ -233,8 +247,11 @@ int print_linkinfo(const struct sockaddr_nl *who,
fprintf
(
fp
,
"master %s "
,
ll_idx_n2a
(
*
(
int
*
)
RTA_DATA
(
tb
[
IFLA_MASTER
]),
b1
));
fprintf
(
fp
,
"master %s "
,
ll_idx_n2a
(
*
(
int
*
)
RTA_DATA
(
tb
[
IFLA_MASTER
]),
b1
));
}
}
#endif
#endif
if
(
tb
[
IFLA_OPERSTATE
])
print_operstate
(
fp
,
*
(
__u8
*
)
RTA_DATA
(
tb
[
IFLA_OPERSTATE
]));
if
(
filter
.
showqueue
)
if
(
filter
.
showqueue
)
print_queuelen
((
char
*
)
RTA_DATA
(
tb
[
IFLA_IFNAME
]));
print_queuelen
(
fp
,
(
char
*
)
RTA_DATA
(
tb
[
IFLA_IFNAME
]));
if
(
!
filter
.
family
||
filter
.
family
==
AF_PACKET
)
{
if
(
!
filter
.
family
||
filter
.
family
==
AF_PACKET
)
{
SPRINT_BUF
(
b1
);
SPRINT_BUF
(
b1
);
...
@@ -514,7 +531,7 @@ struct nlmsg_list
...
@@ -514,7 +531,7 @@ struct nlmsg_list
struct
nlmsghdr
h
;
struct
nlmsghdr
h
;
};
};
int
print_selected_addrinfo
(
int
ifindex
,
struct
nlmsg_list
*
ainfo
,
FILE
*
fp
)
static
int
print_selected_addrinfo
(
int
ifindex
,
struct
nlmsg_list
*
ainfo
,
FILE
*
fp
)
{
{
for
(
;
ainfo
;
ainfo
=
ainfo
->
next
)
{
for
(
;
ainfo
;
ainfo
=
ainfo
->
next
)
{
struct
nlmsghdr
*
n
=
&
ainfo
->
h
;
struct
nlmsghdr
*
n
=
&
ainfo
->
h
;
...
@@ -557,7 +574,7 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
...
@@ -557,7 +574,7 @@ static int store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr *n,
return
0
;
return
0
;
}
}
int
ipaddr_list_or_flush
(
int
argc
,
char
**
argv
,
int
flush
)
static
int
ipaddr_list_or_flush
(
int
argc
,
char
**
argv
,
int
flush
)
{
{
struct
nlmsg_list
*
linfo
=
NULL
;
struct
nlmsg_list
*
linfo
=
NULL
;
struct
nlmsg_list
*
ainfo
=
NULL
;
struct
nlmsg_list
*
ainfo
=
NULL
;
...
@@ -795,7 +812,7 @@ void ipaddr_reset_filter(int oneline)
...
@@ -795,7 +812,7 @@ void ipaddr_reset_filter(int oneline)
filter
.
oneline
=
oneline
;
filter
.
oneline
=
oneline
;
}
}
int
default_scope
(
inet_prefix
*
lcl
)
static
int
default_scope
(
inet_prefix
*
lcl
)
{
{
if
(
lcl
->
family
==
AF_INET
)
{
if
(
lcl
->
family
==
AF_INET
)
{
if
(
lcl
->
bytelen
>=
1
&&
*
(
__u8
*
)
&
lcl
->
data
==
127
)
if
(
lcl
->
bytelen
>=
1
&&
*
(
__u8
*
)
&
lcl
->
data
==
127
)
...
@@ -804,7 +821,7 @@ int default_scope(inet_prefix *lcl)
...
@@ -804,7 +821,7 @@ int default_scope(inet_prefix *lcl)
return
0
;
return
0
;
}
}
int
ipaddr_modify
(
int
cmd
,
int
flags
,
int
argc
,
char
**
argv
)
static
int
ipaddr_modify
(
int
cmd
,
int
flags
,
int
argc
,
char
**
argv
)
{
{
struct
{
struct
{
struct
nlmsghdr
n
;
struct
nlmsghdr
n
;
...
...
ip/iptunnel.c
View file @
e2dc309e
...
@@ -171,7 +171,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
...
@@ -171,7 +171,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
}
else
if
(
strcmp
(
*
argv
,
"dev"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"dev"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
strncpy
(
medium
,
*
argv
,
IFNAMSIZ
-
1
);
strncpy
(
medium
,
*
argv
,
IFNAMSIZ
-
1
);
}
else
if
(
strcmp
(
*
argv
,
"ttl"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"ttl"
)
==
0
||
strcmp
(
*
argv
,
"hoplimit"
)
==
0
)
{
unsigned
uval
;
unsigned
uval
;
NEXT_ARG
();
NEXT_ARG
();
if
(
strcmp
(
*
argv
,
"inherit"
)
!=
0
)
{
if
(
strcmp
(
*
argv
,
"inherit"
)
!=
0
)
{
...
@@ -182,6 +183,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
...
@@ -182,6 +183,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
p
->
iph
.
ttl
=
uval
;
p
->
iph
.
ttl
=
uval
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"tos"
)
==
0
||
}
else
if
(
strcmp
(
*
argv
,
"tos"
)
==
0
||
strcmp
(
*
argv
,
"tclass"
)
==
0
||
matches
(
*
argv
,
"dsfield"
)
==
0
)
{
matches
(
*
argv
,
"dsfield"
)
==
0
)
{
__u32
uval
;
__u32
uval
;
NEXT_ARG
();
NEXT_ARG
();
...
...
man/man8/ip.8
View file @
e2dc309e
...
@@ -18,7 +18,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
...
@@ -18,7 +18,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.sp
.sp
.ti -8
.ti -8
.IR OPTIONS " := { "
.IR OPTIONS " := { "
\fB\-V\fR[\fIersion\fR] |
\fB\-V\fR[\fIersion\fR] |
\fB\-s\fR[\fItatistics\fR] |
\fB\-s\fR[\fItatistics\fR] |
\fB\-r\fR[\fIesolve\fR] |
\fB\-r\fR[\fIesolve\fR] |
...
@@ -46,7 +46,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
...
@@ -46,7 +46,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.br
.br
.B address
.B address
.IR LLADDR " |"
.IR LLADDR " |"
.B broadcast
.B broadcast
.IR LLADDR " |"
.IR LLADDR " |"
.br
.br
.B mtu
.B mtu
...
@@ -57,7 +57,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
...
@@ -57,7 +57,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.RI "[ " DEVICE " ]"
.RI "[ " DEVICE " ]"
.ti -8
.ti -8
.BR "ip addr" " { " add " | " del " } "
.BR "ip addr" " { " add " | " del " } "
.IB IFADDR " dev " STRING
.IB IFADDR " dev " STRING
.ti -8
.ti -8
...
@@ -65,7 +65,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
...
@@ -65,7 +65,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
.IR STRING " ] [ "
.IR STRING " ] [ "
.B scope
.B scope
.IR SCOPE-ID " ] [ "
.IR SCOPE-ID " ] [ "
.B to
.B to
.IR PREFIX " ] [ " FLAG-LIST " ] [ "
.IR PREFIX " ] [ " FLAG-LIST " ] [ "
.B label
.B label
.IR PATTERN " ]"
.IR PATTERN " ]"
...
@@ -97,7 +97,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
...
@@ -97,7 +97,7 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
tentative " | " deprecated " ]"
tentative " | " deprecated " ]"
.ti -8
.ti -8
.BR "ip addrlabel" " { " add " | " del " } " prefix
.BR "ip addrlabel" " { " add " | " del " } " prefix
.BR PREFIX " [ "
.BR PREFIX " [ "
.B dev
.B dev
.IR DEV " ] [ "
.IR DEV " ] [ "
...
@@ -113,10 +113,10 @@ tentative " | " deprecated " ]"
...
@@ -113,10 +113,10 @@ tentative " | " deprecated " ]"
.I SELECTOR
.I SELECTOR
.ti -8
.ti -8
.B ip route get
.B ip route get
.IR ADDRESS " [ "
.IR ADDRESS " [ "
.BI from " ADDRESS " iif " STRING"
.BI from " ADDRESS " iif " STRING"
.RB " ] [ " oif
.RB " ] [ " oif
.IR STRING " ] [ "
.IR STRING " ] [ "
.B tos
.B tos
.IR TOS " ]"
.IR TOS " ]"
...
@@ -278,9 +278,9 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
...
@@ -278,9 +278,9 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
.BR "ip tunnel" " { " add " | " change " | " del " | " show " }"
.RI "[ " NAME " ]"
.RI "[ " NAME " ]"
.br
.br
.RB "[ " mode
" { " ipip " | " gre " | " sit " } ]"
.RB "[ " mode
.
br
.
IR MODE " ] [ "
.
RB "[ "
remote
.
B
remote
.IR ADDR " ] [ "
.IR ADDR " ] [ "
.B local
.B local
.IR ADDR " ]"
.IR ADDR " ]"
...
@@ -289,14 +289,24 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
...
@@ -289,14 +289,24 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.IR KEY " ] [ "
.IR KEY " ] [ "
.RB "[" i "|" o "]" csum " ] ]"
.RB "[" i "|" o "]" csum " ] ]"
.br
.br
.RB "[ " encaplimit
.IR ELIM " ]"
.RB "[ " ttl
.RB "[ " ttl
.IR TTL " ] [ "
.IR TTL " ]"
.B tos
.br
.RB "[ " tos
.IR TOS " ] [ "
.IR TOS " ] [ "
.RB "[" no "]" pmtudisc " ]"
.B flowlabel
.IR FLOWLABEL " ]"
.br
.br
.RB "[ [" no "]" pmtudisc " ]"
.RB "[ " dev
.RB "[ " dev
.IR PHYS_DEV " ]"
.IR PHYS_DEV " ]"
.RB "[ " "dscp inherit" " ]"
.ti -8
.IR MODE " := "
.RB " { " ipip " | " gre " | " sit " | " isatap " | " ip6ip6 " | " ipip6 " | " any " }"
.ti -8
.ti -8
.IR ADDR " := { " IP_ADDRESS " |"
.IR ADDR " := { " IP_ADDRESS " |"
...
@@ -306,6 +316,12 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
...
@@ -306,6 +316,12 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.IR TOS " := { " NUMBER " |"
.IR TOS " := { " NUMBER " |"
.BR inherit " }"
.BR inherit " }"
.ti -8
.IR ELIM " := {
.BR none " | "
.IR 0 ".." 255 " }"
.ti -8
.ti -8
.ti -8
.IR TTL " := { " 1 ".." 255 " | "
.IR TTL " := { " 1 ".." 255 " | "
.BR inherit " }"
.BR inherit " }"
...
@@ -335,6 +351,313 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
...
@@ -335,6 +351,313 @@ throw " | " unreachable " | " prohibit " | " blackhole " | " nat " ]"
.ti -8
.ti -8
.BR "ip monitor" " [ " all " |"
.BR "ip monitor" " [ " all " |"
.IR LISTofOBJECTS " ]"
.IR LISTofOBJECTS " ]"
.ti -8
.BR "ip xfrm"
.IR XFRM_OBJECT " { " COMMAND " }"
.ti -8
.IR XFRM_OBJECT " := { " state " | " policy " | " monitor " } "
.ti -8
.BR "ip xfrm state " { " add " | " update " } "
.IR ID " [ "
.IR XFRM_OPT " ] "
.RB " [ " mode
.IR MODE " ] "
.br
.RB " [ " reqid
.IR REQID " ] "
.RB " [ " seq
.IR SEQ " ] "
.RB " [ " replay-window
.IR SIZE " ] "
.br
.RB " [ " flag
.IR FLAG-LIST " ] "
.RB " [ " encap
.IR ENCAP " ] "
.RB " [ " sel
.IR SELECTOR " ] "
.br
.RB " [ "
.IR LIMIT-LIST " ] "
.ti -8
.BR "ip xfrm state allocspi "
.IR ID
.RB " [ " mode
.IR MODE " ] "
.RB " [ " reqid
.IR REQID " ] "
.RB " [ " seq
.IR SEQ " ] "
.RB " [ " min
.IR SPI
.B max
.IR SPI " ] "
.ti -8
.BR "ip xfrm state" " { " delete " | " get " } "
.IR ID
.ti -8
.BR "ip xfrm state" " { " deleteall " | " list " } [ "
.IR ID " ] "
.RB " [ " mode
.IR MODE " ] "
.br
.RB " [ " reqid
.IR REQID " ] "
.RB " [ " flag
.IR FLAG_LIST " ] "
.ti -8
.BR "ip xfrm state flush" " [ " proto
.IR XFRM_PROTO " ] "
.ti -8
.BR "ip xfrm state count"
.ti -8
.IR ID " := "
.RB " [ " src
.IR ADDR " ] "
.RB " [ " dst
.IR ADDR " ] "
.RB " [ " proto
.IR XFRM_PROTO " ] "
.RB " [ " spi
.IR SPI " ] "
.ti -8
.IR XFRM_PROTO " := "
.RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
.ti -8
.IR MODE " := "
.RB " [ " transport " | " tunnel " | " ro " | " beet " ] "
.b (default=transport)
.ti -8
.IR FLAG-LIST " := "
.RI " [ " FLAG-LIST " ] " FLAG
.ti -8
.IR FLAG " := "
.RB " [ " noecn " | " decap-dscp " | " wildrecv " ] "
.ti -8
.IR ENCAP " := " ENCAP-TYPE " " SPORT " " DPORT " " OADDR
.ti -8
.IR ENCAP-TYPE " := "
.B espinudp
.RB " | "
.B espinudp-nonike
.ti -8
.IR ALGO-LIST " := [ "
.IR ALGO-LIST " ] | [ "
.IR ALGO " ] "
.ti -8
.IR ALGO " := "
.IR ALGO_TYPE
.IR ALGO_NAME
.IR ALGO_KEY
.ti -8
.IR ALGO_TYPE " := "
.RB " [ " enc " | " auth " | " comp " ] "
.ti -8
.IR SELECTOR " := "
.B src
.IR ADDR "[/" PLEN "]"
.B dst
.IR ADDR "[/" PLEN "]"
.RI " [ " UPSPEC " ] "
.RB " [ " dev
.IR DEV " ] "
.ti -8
.IR UPSPEC " := "
.B proto
.IR PROTO " [[ "
.B sport
.IR PORT " ] "
.RB " [ " dport
.IR PORT " ] | "
.br
.RB " [ " type
.IR NUMBER " ] "
.RB " [ " code
.IR NUMBER " ]] "
.ti -8
.IR LIMIT-LIST " := [ " LIMIT-LIST " ] |"
.RB " [ "limit
.IR LIMIT " ] "
.ti -8
.IR LIMIT " := "
.RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
.IR SECONDS " ] | "
.RB "[ ["byte-soft "|" byte-hard "]"
.IR SIZE " ] | "
.br
.RB " [ ["packet-soft "|" packet-hard "]"
.IR COUNT " ] "
.ti -8
.BR "ip xfrm policy" " { " add " | " update " } " " dir "
.IR DIR
.IR SELECTOR " [ "
.BR index
.IR INDEX " ] "
.br
.RB " [ " ptype
.IR PTYPE " ] "
.RB " [ " action
.IR ACTION " ] "
.RB " [ " priority
.IR PRIORITY " ] "
.br
.RI " [ " LIMIT-LIST " ] [ "
.IR TMPL-LIST " ] "
.ti -8
.BR "ip xfrm policy" " { " delete " | " get " } " " dir "
.IR DIR " [ " SELECTOR " | "
.BR index
.IR INDEX
.RB " ] "
.br
.RB " [ " ptype
.IR PTYPE " ] "
.ti -8
.BR "ip xfrm policy" " { " deleteall " | " list " } "
.RB " [ " dir
.IR DIR " ] [ "
.IR SELECTOR " ] "
.br
.RB " [ " index
.IR INDEX " ] "
.RB " [ " action
.IR ACTION " ] "
.RB " [ " priority
.IR PRIORITY " ] "
.ti -8
.B "ip xfrm policy flush"
.RB " [ " ptype
.IR PTYPE " ] "
.ti -8
.B "ip xfrm count"
.ti -8
.IR PTYPE " := "
.RB " [ " main " | " sub " ] "
.b (default=main)
.ti -8
.IR DIR " := "
.RB " [ " in " | " out " | " fwd " ] "
.ti -8
.IR SELECTOR " := "
.B src
.IR ADDR "[/" PLEN "]"
.B dst
.IR ADDR "[/" PLEN] " [ " UPSPEC
.RB " ] [ " dev
.IR DEV " ] "
.ti -8
.IR UPSPEC " := "
.B proto
.IR PROTO " [ "
.RB " [ " sport
.IR PORT " ] "
.RB " [ " dport
.IR PORT " ] | "
.br
.RB " [ " type
.IR NUMBER " ] "
.RB " [ " code
.IR NUMBER " ] ] "
.ti -8
.IR ACTION " := "
.RB " [ " allow " | " block " ]"
.b (default=allow)
.ti -8
.IR LIMIT-LIST " := "
.RB " [ "
.IR LIMIT-LIST " ] | "
.RB " [ " limit
.IR LIMIT " ] "
.ti -8
.IR LIMIT " := "
.RB " [ [" time-soft "|" time-hard "|" time-use-soft "|" time-use-hard "]"
.IR SECONDS " ] | "
.RB " [ [" byte-soft "|" byte-hard "]"
.IR SIZE " ] | "
.br [ "
.RB "[" packet-soft "|" packet-hard "]"
.IR NUMBER " ] "
.ti -8
.IR TMPL-LIST " := "
.b " [ "
.IR TMPL-LIST " ] | "
.RB " [ " tmpl
.IR TMPL " ] "
.ti -8
.IR TMPL " := "
.IR ID " [ "
.B mode
.IR MODE " ] "
.RB " [ " reqid
.IR REQID " ] "
.RB " [ " level
.IR LEVEL " ] "
.ti -8
.IR ID " := "
.RB " [ " src
.IR ADDR " ] "
.RB " [ " dst
.IR ADDR " ] "
.RB " [ " proto
.IR XFRM_PROTO " ] "
.RB " [ " spi
.IR SPI " ] "
.ti -8
.IR XFRM_PROTO " := "
.RB " [ " esp " | " ah " | " comp " | " route2 " | " hao " ] "
.ti -8
.IR MODE " := "
.RB " [ " transport " | " tunnel " | " beet " ] "
.b (default=transport)
.ti -8
.IR LEVEL " := "
.RB " [ " required " | " use " ] "
.b (default=required)
.ti -8
.BR "ip xfrm monitor" " [ " all " | "
.IR LISTofOBJECTS " ] "
.in -8
.in -8
.ad b
.ad b
...
@@ -359,7 +682,7 @@ followed by protocol family identifier:
...
@@ -359,7 +682,7 @@ followed by protocol family identifier:
or
or
.B link
.B link
,enforce the protocol family to use. If the option is not present,
,enforce the protocol family to use. If the option is not present,
the protocol family is guessed from other arguments. If the rest
the protocol family is guessed from other arguments. If the rest
of the command line does not give enough information to guess the
of the command line does not give enough information to guess the
family,
family,
.B ip
.B ip
...
@@ -391,7 +714,7 @@ shortcut for
...
@@ -391,7 +714,7 @@ shortcut for
output each record on a single line, replacing line feeds
output each record on a single line, replacing line feeds
with the
with the
.B '\e\'
.B '\e\'
character. This is convenient when you want to count records
character. This is convenient when you want to count records
with
with
.BR wc (1)
.BR wc (1)
or to
or to
...
@@ -444,6 +767,10 @@ host addresses.
...
@@ -444,6 +767,10 @@ host addresses.
.B tunnel
.B tunnel
- tunnel over IP.
- tunnel over IP.
.TP
.B xfrm
- framework for IPsec protocol.
.PP
.PP
The names of all objects may be written in full or
The names of all objects may be written in full or
abbreviated form, f.e.
abbreviated form, f.e.
...
@@ -522,13 +849,13 @@ already configured.
...
@@ -522,13 +849,13 @@ already configured.
.TP
.TP
.BI txqueuelen " NUMBER"
.BI txqueuelen " NUMBER"
.TP
.TP
.BI txqlen " NUMBER"
.BI txqlen " NUMBER"
change the transmit queue length of the device.
change the transmit queue length of the device.
.TP
.TP
.BI mtu " NUMBER"
.BI mtu " NUMBER"
change the
change the
.I MTU
.I MTU
of the device.
of the device.
...
@@ -1115,15 +1442,15 @@ the initial RTT ('Round Trip Time') estimate. If no suffix is
...
@@ -1115,15 +1442,15 @@ the initial RTT ('Round Trip Time') estimate. If no suffix is
specified the units are raw values passed directly to the
specified the units are raw values passed directly to the
routing code to maintain compatability with previous releases.
routing code to maintain compatability with previous releases.
Otherwise if a suffix of s, sec or secs is used to specify
Otherwise if a suffix of s, sec or secs is used to specify
seconds; ms, msec or msecs to specify milliseconds; us, usec
seconds; ms, msec or msecs to specify milliseconds; us, usec
or usecs to specify microseconds; ns, nsec or nsecs to specify
or usecs to specify microseconds; ns, nsec or nsecs to specify
nanoseconds; j, hz or jiffies to specify jiffies, the value is
nanoseconds; j, hz or jiffies to specify jiffies, the value is
converted to what the routing code expects.
converted to what the routing code expects.
.TP
.TP
.BI rttvar " TIME " "(2.3.15+ only)"
.BI rttvar " TIME " "(2.3.15+ only)"
the initial RTT variance estimate. Values are specified as with
the initial RTT variance estimate. Values are specified as with
.BI rtt
.BI rtt
above.
above.
...
@@ -1432,7 +1759,7 @@ force the output device on which this packet will be routed.
...
@@ -1432,7 +1759,7 @@ force the output device on which this packet will be routed.
.TP
.TP
.B connected
.B connected
if no source address
if no source address
.RB "(option " from ")"
.RB "(option " from ")"
was given, relookup the route with the source set to the preferred
was given, relookup the route with the source set to the preferred
address received from the first lookup.
address received from the first lookup.
...
@@ -1621,14 +1948,14 @@ It is also possible to use lookup instead of table.
...
@@ -1621,14 +1948,14 @@ It is also possible to use lookup instead of table.
.TP
.TP
.BI realms " FROM/TO"
.BI realms " FROM/TO"
Realms to select if the rule matched and the routing table lookup
Realms to select if the rule matched and the routing table lookup
succeeded. Realm
succeeded. Realm
.I TO
.I TO
is only used if the route did not select any realm.
is only used if the route did not select any realm.
.TP
.TP
.BI nat " ADDRESS"
.BI nat " ADDRESS"
The base of the IP address block to translate (for source addresses).
The base of the IP address block to translate (for source addresses).
The
The
.I ADDRESS
.I ADDRESS
may be either the start of the block of NAT addresses (selected by NAT
may be either the start of the block of NAT addresses (selected by NAT
routes) or a local host address (or even zero).
routes) or a local host address (or even zero).
...
@@ -1706,8 +2033,11 @@ the prefix selecting the IP source addresses of the multicast route.
...
@@ -1706,8 +2033,11 @@ the prefix selecting the IP source addresses of the multicast route.
.SH ip tunnel - tunnel configuration
.SH ip tunnel - tunnel configuration
.B tunnel
.B tunnel
objects are tunnels, encapsulating packets in IP
v4
packets and then
objects are tunnels, encapsulating packets in IP packets and then
sending them over the IP infrastructure.
sending them over the IP infrastructure.
The encapulating (or outer) address family is specified by the
.B -f
option. The default is IPv4.
.SS ip tunnel add - add a new tunnel
.SS ip tunnel add - add a new tunnel
.SS ip tunnel change - change an existing tunnel
.SS ip tunnel change - change an existing tunnel
...
@@ -1719,8 +2049,13 @@ select the tunnel device name.
...
@@ -1719,8 +2049,13 @@ select the tunnel device name.
.TP
.TP
.BI mode " MODE"
.BI mode " MODE"
set the tunnel mode. Three modes are currently available:
set the tunnel mode. Available modes depend on the encapsulating address family.
.BR ipip ", " sit " and " gre "."
.br
Modes for IPv4 encapsulation available:
.BR ipip ", " sit ", " isatap " and " gre "."
.br
Modes for IPv6 encapsulation available:
.BR ip6ip6 ", " ipip6 " and " any "."
.TP
.TP
.BI remote " ADDRESS"
.BI remote " ADDRESS"
...
@@ -1733,27 +2068,32 @@ It must be an address on another interface of this host.
...
@@ -1733,27 +2068,32 @@ It must be an address on another interface of this host.
.TP
.TP
.BI ttl " N"
.BI ttl " N"
set a fixed TTL
set a fixed TTL
.I N
.I N
on tunneled packets.
on tunneled packets.
.I N
.I N
is a number in the range 1--255. 0 is a special value
is a number in the range 1--255. 0 is a special value
meaning that packets inherit the TTL value.
meaning that packets inherit the TTL value.
The default value is:
The default value
for IPv4 tunnels
is:
.BR "inherit" .
.BR "inherit" .
The default value for IPv6 tunnels is:
.BR "64" .
.TP
.TP
.BI tos " T"
.BI tos " T"
.TP
.TP
.BI dsfield " T"
.BI dsfield " T"
set a fixed TOS
.TP
.BI tclass " T"
set a fixed TOS (or traffic class in IPv6)
.I T
.I T
on tunneled packets.
on tunneled packets.
The default value is:
The default value is:
.BR "inherit" .
.BR "inherit" .
.TP
.TP
.BI dev " NAME"
.BI dev " NAME"
bind the tunnel to the device
bind the tunnel to the device
.I NAME
.I NAME
so that tunneled packets will only be routed via this device and will
so that tunneled packets will only be routed via this device and will
...
@@ -1783,12 +2123,12 @@ parameter sets the key to use in both directions.
...
@@ -1783,12 +2123,12 @@ parameter sets the key to use in both directions.
The
The
.BR ikey " and " okey
.BR ikey " and " okey
parameters set different keys for input and output.
parameters set different keys for input and output.
.TP
.TP
.BR csum ", " icsum ", " ocsum
.BR csum ", " icsum ", " ocsum
.RB ( " only GRE tunnels " )
.RB ( " only GRE tunnels " )
generate/require checksums for tunneled packets.
generate/require checksums for tunneled packets.
The
The
.B ocsum
.B ocsum
flag calculates checksums for outgoing packets.
flag calculates checksums for outgoing packets.
The
The
...
@@ -1811,10 +2151,28 @@ The
...
@@ -1811,10 +2151,28 @@ The
flag requires that all input packets are serialized.
flag requires that all input packets are serialized.
The
The
.B seq
.B seq
flag is equivalent to the combination
flag is equivalent to the combination
.BR "iseq oseq" .
.BR "iseq oseq" .
.B It isn't work. Don't use it.
.B It isn't work. Don't use it.
.TP
.RP
.BI dscp inherit
.RB ( " only IPv6 tunnels " )
Inherit DS field between inner and outer header.
.TP
.RP
.BI encaplim " ELIM"
.RB ( " only IPv6 tunnels " )
set a fixed encapsulation limit. Default is 4.
.TP
.RP
.BI flowlabel " FLOWLABEL"
.RB ( " only IPv6 tunnels " )
set a fixed flowlabel.
.SS ip tunnel show - list tunnels
.SS ip tunnel show - list tunnels
This command has no arguments.
This command has no arguments.
...
@@ -1868,6 +2226,169 @@ at any time.
...
@@ -1868,6 +2226,169 @@ at any time.
It prepends the history with the state snapshot dumped at the moment
It prepends the history with the state snapshot dumped at the moment
of starting.
of starting.
.SH ip xfrm - setting xfrm
xfrm is an IP framework, which can transform format of the datagrams,
.br
i.e. encrypt the packets with some algorithm. xfrm policy and xfrm state
are associated through templates
.IR TMPL_LIST "."
This framework is used as a part of IPsec protocol.
.SS ip xfrm state add - add new state into xfrm
.SS ip xfrm state update - update existing xfrm state
.SS ip xfrm state allocspi - allocate SPI value
.TP
.I MODE
is set as default to
.BR transport ","
but it could be set to
.BR tunnel "," ro " or " beet "."
.TP
.I FLAG-LIST
contains one or more flags.
.TP
.I FLAG
could be set to
.BR noecn ", " decap-dscp " or " wildrecv "."
.TP
.I ENCAP
encapsulation is set to encapsulation type
.IR ENCAP-TYPE ", source port " SPORT ", destination port " DPORT " and " OADDR "."
.TP
.I ENCAP-TYPE
could be set to
.BR espinudp " or " espinudp-nonike "."
.TP
.I ALGO-LIST
contains one or more algorithms
.I ALGO
which depend on the type of algorithm set by
.IR ALGO_TYPE "."
It can be used these algoritms
.BR enc ", " auth " or " comp "."
.SS ip xfrm policy add - add a new policy
.SS ip xfrm policy update - update an existing policy
.SS ip xfrm policy delete - delete existing policy
.SS ip xfrm policy get - get existing policy
.SS ip xfrm policy deleteall - delete all existing xfrm policy
.SS ip xfrm policy list - print out the list of xfrm policy
.SS ip xfrm policy flush - flush policies
It can be flush
.BR all
policies or only those specified with
.BR ptype "."
.TP
.BI dir " DIR "
directory could be one of these:
.BR "inp", " out " or " fwd".
.TP
.IR SELECTOR
selects for which addresses will be set up the policy. The selector
is defined by source and destination address.
.TP
.IR UPSPEC
is defined by source port
.BR sport ", "
destination port
.BR dport ", " type
as number and
.B code
also number.
.TP
.BI dev " DEV "
specify network device.
.TP
.BI index " INDEX "
the number of indexed policy.
.TP
.BI ptype " PTYPE "
type is set as default on
.BR "main" ,
could be switch on
.BR "sub" .
.TP
.BI action " ACTION "
is set as default on
.BR "allow".
It could be switch on
.BR "block".
.TP
.BI priority " PRIORITY "
priority is a number. Default priority is set on zero.
.TP
.IR LIMIT-LIST
limits are set in seconds, bytes or numbers of packets.
.TP
.IR TMPL-LIST
template list is based on
.IR ID ","
.BR mode ", " reqid " and " level ". "
.TP
.IR ID
is specified by source address, destination address,
.I proto
and value of
.IR spi "."
.TP
.IR XFRM_PROTO
values:
.BR esp ", " ah ", " comp ", " route2 " or " hao "."
.TP
.IR MODE
is set as default on
.BR transport ","
but it could be set on
.BR tunnel " or " beet "."
.TP
.IR LEVEL
is set as default on
.BR required
and the other choice is
.BR use "."
.TP
.IR UPSPEC
is specified by
.BR sport ", "
.BR dport ", " type
and
.B code
(NUMBER).
.SS ip xfrm monitor - is used for listing all objects or defined group of them.
The
.B xfrm monitor
can monitor the policies for all objects or defined group of them.
.SH HISTORY
.SH HISTORY
.B ip
.B ip
was written by Alexey N. Kuznetsov and added in Linux 2.2.
was written by Alexey N. Kuznetsov and added in Linux 2.2.
...
...
misc/Makefile
View file @
e2dc309e
...
@@ -27,7 +27,7 @@ ssfilter.c: ssfilter.y
...
@@ -27,7 +27,7 @@ ssfilter.c: ssfilter.y
lnstat
:
$(LNSTATOBJ)
lnstat
:
$(LNSTATOBJ)
install
:
all
install
:
all
install
-m
0755
-s
$(TARGETS)
$(DESTDIR)$(SBINDIR)
install
-m
0755
$(TARGETS)
$(DESTDIR)$(SBINDIR)
ln
-sf
lnstat
$(DESTDIR)$(SBINDIR)
/rtstat
ln
-sf
lnstat
$(DESTDIR)$(SBINDIR)
/rtstat
ln
-sf
lnstat
$(DESTDIR)$(SBINDIR)
/ctstat
ln
-sf
lnstat
$(DESTDIR)$(SBINDIR)
/ctstat
...
...
misc/ss.c
View file @
e2dc309e
...
@@ -1641,7 +1641,7 @@ static int tcp_show(struct filter *f, int socktype)
...
@@ -1641,7 +1641,7 @@ static int tcp_show(struct filter *f, int socktype)
}
}
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
((
fp
=
net_tcp_open
())
<
0
)
if
((
fp
=
net_tcp_open
())
==
NULL
)
goto
outerr
;
goto
outerr
;
setbuffer
(
fp
,
buf
,
bufsize
);
setbuffer
(
fp
,
buf
,
bufsize
);
...
@@ -1651,7 +1651,7 @@ static int tcp_show(struct filter *f, int socktype)
...
@@ -1651,7 +1651,7 @@ static int tcp_show(struct filter *f, int socktype)
}
}
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
(
fp
=
net_tcp6_open
())
>=
0
)
{
(
fp
=
net_tcp6_open
())
!=
NULL
)
{
setbuffer
(
fp
,
buf
,
bufsize
);
setbuffer
(
fp
,
buf
,
bufsize
);
if
(
generic_record_read
(
fp
,
tcp_show_line
,
f
,
AF_INET6
))
if
(
generic_record_read
(
fp
,
tcp_show_line
,
f
,
AF_INET6
))
goto
outerr
;
goto
outerr
;
...
@@ -1773,7 +1773,7 @@ int udp_show(struct filter *f)
...
@@ -1773,7 +1773,7 @@ int udp_show(struct filter *f)
dg_proto
=
UDP_PROTO
;
dg_proto
=
UDP_PROTO
;
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
((
fp
=
net_udp_open
())
<
0
)
if
((
fp
=
net_udp_open
())
==
NULL
)
goto
outerr
;
goto
outerr
;
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET
))
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET
))
goto
outerr
;
goto
outerr
;
...
@@ -1781,7 +1781,7 @@ int udp_show(struct filter *f)
...
@@ -1781,7 +1781,7 @@ int udp_show(struct filter *f)
}
}
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
(
fp
=
net_udp6_open
())
>=
0
)
{
(
fp
=
net_udp6_open
())
!=
NULL
)
{
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET6
))
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET6
))
goto
outerr
;
goto
outerr
;
fclose
(
fp
);
fclose
(
fp
);
...
@@ -1805,7 +1805,7 @@ int raw_show(struct filter *f)
...
@@ -1805,7 +1805,7 @@ int raw_show(struct filter *f)
dg_proto
=
RAW_PROTO
;
dg_proto
=
RAW_PROTO
;
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
(
f
->
families
&
(
1
<<
AF_INET
))
{
if
((
fp
=
net_raw_open
())
<
0
)
if
((
fp
=
net_raw_open
())
==
NULL
)
goto
outerr
;
goto
outerr
;
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET
))
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET
))
goto
outerr
;
goto
outerr
;
...
@@ -1813,7 +1813,7 @@ int raw_show(struct filter *f)
...
@@ -1813,7 +1813,7 @@ int raw_show(struct filter *f)
}
}
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
if
((
f
->
families
&
(
1
<<
AF_INET6
))
&&
(
fp
=
net_raw6_open
())
>=
0
)
{
(
fp
=
net_raw6_open
())
!=
NULL
)
{
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET6
))
if
(
generic_record_read
(
fp
,
dgram_show_line
,
f
,
AF_INET6
))
goto
outerr
;
goto
outerr
;
fclose
(
fp
);
fclose
(
fp
);
...
...
tc/Makefile
View file @
e2dc309e
...
@@ -73,9 +73,9 @@ libtc.a: $(TCLIB)
...
@@ -73,9 +73,9 @@ libtc.a: $(TCLIB)
install
:
all
install
:
all
mkdir
-p
$(DESTDIR)
/usr/lib/tc
mkdir
-p
$(DESTDIR)
/usr/lib/tc
install
-m
0755
-s
tc
$(DESTDIR)$(SBINDIR)
install
-m
0755 tc
$(DESTDIR)$(SBINDIR)
for
i
in
$(TCSO)
;
\
for
i
in
$(TCSO)
;
\
do
install
-m
755
-s
$$
i
$(DESTDIR)
/usr/lib/tc
;
\
do
install
-m
755
$$
i
$(DESTDIR)
/usr/lib/tc
;
\
done
done
clean
:
clean
:
...
...
tc/m_police.c
View file @
e2dc309e
...
@@ -35,7 +35,7 @@ struct action_util police_action_util = {
...
@@ -35,7 +35,7 @@ struct action_util police_action_util = {
static
void
usage
(
void
)
static
void
usage
(
void
)
{
{
fprintf
(
stderr
,
"Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]
\n
"
);
fprintf
(
stderr
,
"Usage: ... police rate BPS burst BYTES[/BYTES] [ mtu BYTES[/BYTES] ]
\n
"
);
fprintf
(
stderr
,
" [ peakrate BPS ] [ avrate BPS ]
\n
"
);
fprintf
(
stderr
,
" [ peakrate BPS ] [ avrate BPS ]
[ overhead BYTES ]
\n
"
);
fprintf
(
stderr
,
" [ ACTIONTERM ]
\n
"
);
fprintf
(
stderr
,
" [ ACTIONTERM ]
\n
"
);
fprintf
(
stderr
,
"Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
fprintf
(
stderr
,
"Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
fprintf
(
stderr
,
"New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
fprintf
(
stderr
,
"New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
...
@@ -133,6 +133,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
...
@@ -133,6 +133,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
__u32
avrate
=
0
;
__u32
avrate
=
0
;
int
presult
=
0
;
int
presult
=
0
;
unsigned
buffer
=
0
,
mtu
=
0
,
mpu
=
0
;
unsigned
buffer
=
0
,
mtu
=
0
,
mpu
=
0
;
unsigned
short
overhead
;
int
Rcell_log
=-
1
,
Pcell_log
=
-
1
;
int
Rcell_log
=-
1
,
Pcell_log
=
-
1
;
struct
rtattr
*
tail
;
struct
rtattr
*
tail
;
...
@@ -234,6 +235,11 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
...
@@ -234,6 +235,11 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
fprintf
(
stderr
,
"Illegal
\"
action
\"\n
"
);
fprintf
(
stderr
,
"Illegal
\"
action
\"\n
"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
matches
(
*
argv
,
"overhead"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u16
(
&
overhead
,
*
argv
,
10
))
{
explain1
(
"overhead"
);
return
-
1
;
}
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
usage
();
usage
();
}
else
{
}
else
{
...
@@ -263,6 +269,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
...
@@ -263,6 +269,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
if
(
p
.
rate
.
rate
)
{
if
(
p
.
rate
.
rate
)
{
p
.
rate
.
mpu
=
mpu
;
p
.
rate
.
mpu
=
mpu
;
p
.
rate
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
p
.
rate
,
rtab
,
Rcell_log
,
mtu
)
<
0
)
{
if
(
tc_calc_rtable
(
&
p
.
rate
,
rtab
,
Rcell_log
,
mtu
)
<
0
)
{
fprintf
(
stderr
,
"TBF: failed to calculate rate table.
\n
"
);
fprintf
(
stderr
,
"TBF: failed to calculate rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -272,6 +279,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
...
@@ -272,6 +279,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
p
.
mtu
=
mtu
;
p
.
mtu
=
mtu
;
if
(
p
.
peakrate
.
rate
)
{
if
(
p
.
peakrate
.
rate
)
{
p
.
peakrate
.
mpu
=
mpu
;
p
.
peakrate
.
mpu
=
mpu
;
p
.
peakrate
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
p
.
peakrate
,
ptab
,
Pcell_log
,
mtu
)
<
0
)
{
if
(
tc_calc_rtable
(
&
p
.
peakrate
,
ptab
,
Pcell_log
,
mtu
)
<
0
)
{
fprintf
(
stderr
,
"POLICE: failed to calculate peak rate table.
\n
"
);
fprintf
(
stderr
,
"POLICE: failed to calculate peak rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -344,6 +352,7 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg)
...
@@ -344,6 +352,7 @@ print_police(struct action_util *a, FILE *f, struct rtattr *arg)
fprintf
(
f
,
"/%s "
,
police_action_n2a
(
*
(
int
*
)
RTA_DATA
(
tb
[
TCA_POLICE_RESULT
]),
b1
,
sizeof
(
b1
)));
fprintf
(
f
,
"/%s "
,
police_action_n2a
(
*
(
int
*
)
RTA_DATA
(
tb
[
TCA_POLICE_RESULT
]),
b1
,
sizeof
(
b1
)));
}
else
}
else
fprintf
(
f
,
" "
);
fprintf
(
f
,
" "
);
fprintf
(
f
,
"overhead %ub "
,
p
->
rate
.
overhead
);
fprintf
(
f
,
"
\n
ref %d bind %d
\n
"
,
p
->
refcnt
,
p
->
bindcnt
);
fprintf
(
f
,
"
\n
ref %d bind %d
\n
"
,
p
->
refcnt
,
p
->
bindcnt
);
return
0
;
return
0
;
...
...
tc/q_cbq.c
View file @
e2dc309e
...
@@ -32,6 +32,7 @@ static void explain_class(void)
...
@@ -32,6 +32,7 @@ static void explain_class(void)
fprintf
(
stderr
,
" [ prio NUMBER ] [ cell BYTES ] [ ewma LOG ]
\n
"
);
fprintf
(
stderr
,
" [ prio NUMBER ] [ cell BYTES ] [ ewma LOG ]
\n
"
);
fprintf
(
stderr
,
" [ estimator INTERVAL TIME_CONSTANT ]
\n
"
);
fprintf
(
stderr
,
" [ estimator INTERVAL TIME_CONSTANT ]
\n
"
);
fprintf
(
stderr
,
" [ split CLASSID ] [ defmap MASK/CHANGE ]
\n
"
);
fprintf
(
stderr
,
" [ split CLASSID ] [ defmap MASK/CHANGE ]
\n
"
);
fprintf
(
stderr
,
" [ overhead BYTES ]
\n
"
);
}
}
static
void
explain
(
void
)
static
void
explain
(
void
)
...
@@ -53,6 +54,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -53,6 +54,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
struct
tc_cbq_lssopt
lss
;
struct
tc_cbq_lssopt
lss
;
__u32
rtab
[
256
];
__u32
rtab
[
256
];
unsigned
mpu
=
0
,
avpkt
=
0
,
allot
=
0
;
unsigned
mpu
=
0
,
avpkt
=
0
,
allot
=
0
;
unsigned
short
overhead
=
0
;
int
cell_log
=-
1
;
int
cell_log
=-
1
;
int
ewma_log
=-
1
;
int
ewma_log
=-
1
;
struct
rtattr
*
tail
;
struct
rtattr
*
tail
;
...
@@ -61,14 +63,14 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -61,14 +63,14 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
memset
(
&
r
,
0
,
sizeof
(
r
));
memset
(
&
r
,
0
,
sizeof
(
r
));
while
(
argc
>
0
)
{
while
(
argc
>
0
)
{
if
(
strcmp
(
*
argv
,
"bandwidth"
)
==
0
||
if
(
matches
(
*
argv
,
"bandwidth"
)
==
0
||
strcmp
(
*
argv
,
"rate"
)
==
0
)
{
matches
(
*
argv
,
"rate"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_rate
(
&
r
.
rate
,
*
argv
))
{
if
(
get_rate
(
&
r
.
rate
,
*
argv
))
{
explain1
(
"bandwidth"
);
explain1
(
"bandwidth"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"ewma"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"ewma"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_integer
(
&
ewma_log
,
*
argv
,
0
))
{
if
(
get_integer
(
&
ewma_log
,
*
argv
,
0
))
{
explain1
(
"ewma"
);
explain1
(
"ewma"
);
...
@@ -78,7 +80,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -78,7 +80,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
fprintf
(
stderr
,
"ewma_log must be < 32
\n
"
);
fprintf
(
stderr
,
"ewma_log must be < 32
\n
"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"cell"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"cell"
)
==
0
)
{
unsigned
cell
;
unsigned
cell
;
int
i
;
int
i
;
NEXT_ARG
();
NEXT_ARG
();
...
@@ -94,26 +96,31 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -94,26 +96,31 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
return
-
1
;
return
-
1
;
}
}
cell_log
=
i
;
cell_log
=
i
;
}
else
if
(
strcmp
(
*
argv
,
"avpkt"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"avpkt"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
avpkt
,
*
argv
))
{
if
(
get_size
(
&
avpkt
,
*
argv
))
{
explain1
(
"avpkt"
);
explain1
(
"avpkt"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"mpu"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"mpu"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
mpu
,
*
argv
))
{
if
(
get_size
(
&
mpu
,
*
argv
))
{
explain1
(
"mpu"
);
explain1
(
"mpu"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"allot"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"allot"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
/* Accept and ignore "allot" for backward compatibility */
/* Accept and ignore "allot" for backward compatibility */
if
(
get_size
(
&
allot
,
*
argv
))
{
if
(
get_size
(
&
allot
,
*
argv
))
{
explain1
(
"allot"
);
explain1
(
"allot"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"overhead"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u16
(
&
overhead
,
*
argv
,
10
))
{
explain1
(
"overhead"
);
return
-
1
;
}
}
else
if
(
matches
(
*
argv
,
"help"
)
==
0
)
{
explain
();
explain
();
return
-
1
;
return
-
1
;
}
else
{
}
else
{
...
@@ -138,6 +145,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -138,6 +145,7 @@ static int cbq_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
allot
=
(
avpkt
*
3
)
/
2
;
allot
=
(
avpkt
*
3
)
/
2
;
r
.
mpu
=
mpu
;
r
.
mpu
=
mpu
;
r
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
r
,
rtab
,
cell_log
,
allot
)
<
0
)
{
if
(
tc_calc_rtable
(
&
r
,
rtab
,
cell_log
,
allot
)
<
0
)
{
fprintf
(
stderr
,
"CBQ: failed to calculate rate table.
\n
"
);
fprintf
(
stderr
,
"CBQ: failed to calculate rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -179,6 +187,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -179,6 +187,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
int
ewma_log
=-
1
;
int
ewma_log
=-
1
;
unsigned
bndw
=
0
;
unsigned
bndw
=
0
;
unsigned
minburst
=
0
,
maxburst
=
0
;
unsigned
minburst
=
0
,
maxburst
=
0
;
unsigned
short
overhead
=
0
;
struct
rtattr
*
tail
;
struct
rtattr
*
tail
;
memset
(
&
r
,
0
,
sizeof
(
r
));
memset
(
&
r
,
0
,
sizeof
(
r
));
...
@@ -188,52 +197,52 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -188,52 +197,52 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
memset
(
&
ovl
,
0
,
sizeof
(
ovl
));
memset
(
&
ovl
,
0
,
sizeof
(
ovl
));
while
(
argc
>
0
)
{
while
(
argc
>
0
)
{
if
(
strcmp
(
*
argv
,
"rate"
)
==
0
)
{
if
(
matches
(
*
argv
,
"rate"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_rate
(
&
r
.
rate
,
*
argv
))
{
if
(
get_rate
(
&
r
.
rate
,
*
argv
))
{
explain1
(
"rate"
);
explain1
(
"rate"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"bandwidth"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"bandwidth"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_rate
(
&
bndw
,
*
argv
))
{
if
(
get_rate
(
&
bndw
,
*
argv
))
{
explain1
(
"bandwidth"
);
explain1
(
"bandwidth"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"minidle"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"minidle"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_u32
(
&
lss
.
minidle
,
*
argv
,
0
))
{
if
(
get_u32
(
&
lss
.
minidle
,
*
argv
,
0
))
{
explain1
(
"minidle"
);
explain1
(
"minidle"
);
return
-
1
;
return
-
1
;
}
}
lss
.
change
|=
TCF_CBQ_LSS_MINIDLE
;
lss
.
change
|=
TCF_CBQ_LSS_MINIDLE
;
}
else
if
(
strcmp
(
*
argv
,
"minburst"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"minburst"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_u32
(
&
minburst
,
*
argv
,
0
))
{
if
(
get_u32
(
&
minburst
,
*
argv
,
0
))
{
explain1
(
"minburst"
);
explain1
(
"minburst"
);
return
-
1
;
return
-
1
;
}
}
lss
.
change
|=
TCF_CBQ_LSS_OFFTIME
;
lss
.
change
|=
TCF_CBQ_LSS_OFFTIME
;
}
else
if
(
strcmp
(
*
argv
,
"maxburst"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"maxburst"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_u32
(
&
maxburst
,
*
argv
,
0
))
{
if
(
get_u32
(
&
maxburst
,
*
argv
,
0
))
{
explain1
(
"maxburst"
);
explain1
(
"maxburst"
);
return
-
1
;
return
-
1
;
}
}
lss
.
change
|=
TCF_CBQ_LSS_MAXIDLE
;
lss
.
change
|=
TCF_CBQ_LSS_MAXIDLE
;
}
else
if
(
strcmp
(
*
argv
,
"bounded"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"bounded"
)
==
0
)
{
lss
.
flags
|=
TCF_CBQ_LSS_BOUNDED
;
lss
.
flags
|=
TCF_CBQ_LSS_BOUNDED
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
}
else
if
(
strcmp
(
*
argv
,
"borrow"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"borrow"
)
==
0
)
{
lss
.
flags
&=
~
TCF_CBQ_LSS_BOUNDED
;
lss
.
flags
&=
~
TCF_CBQ_LSS_BOUNDED
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
}
else
if
(
strcmp
(
*
argv
,
"isolated"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"isolated"
)
==
0
)
{
lss
.
flags
|=
TCF_CBQ_LSS_ISOLATED
;
lss
.
flags
|=
TCF_CBQ_LSS_ISOLATED
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
}
else
if
(
strcmp
(
*
argv
,
"sharing"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"sharing"
)
==
0
)
{
lss
.
flags
&=
~
TCF_CBQ_LSS_ISOLATED
;
lss
.
flags
&=
~
TCF_CBQ_LSS_ISOLATED
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
lss
.
change
|=
TCF_CBQ_LSS_FLAGS
;
}
else
if
(
strcmp
(
*
argv
,
"ewma"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"ewma"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_integer
(
&
ewma_log
,
*
argv
,
0
))
{
if
(
get_integer
(
&
ewma_log
,
*
argv
,
0
))
{
explain1
(
"ewma"
);
explain1
(
"ewma"
);
...
@@ -244,7 +253,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -244,7 +253,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
return
-
1
;
return
-
1
;
}
}
lss
.
change
|=
TCF_CBQ_LSS_EWMA
;
lss
.
change
|=
TCF_CBQ_LSS_EWMA
;
}
else
if
(
strcmp
(
*
argv
,
"cell"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"cell"
)
==
0
)
{
unsigned
cell
;
unsigned
cell
;
int
i
;
int
i
;
NEXT_ARG
();
NEXT_ARG
();
...
@@ -260,7 +269,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -260,7 +269,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
return
-
1
;
return
-
1
;
}
}
cell_log
=
i
;
cell_log
=
i
;
}
else
if
(
strcmp
(
*
argv
,
"prio"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"prio"
)
==
0
)
{
unsigned
prio
;
unsigned
prio
;
NEXT_ARG
();
NEXT_ARG
();
if
(
get_u32
(
&
prio
,
*
argv
,
0
))
{
if
(
get_u32
(
&
prio
,
*
argv
,
0
))
{
...
@@ -273,40 +282,40 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -273,40 +282,40 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
}
}
wrr
.
priority
=
prio
;
wrr
.
priority
=
prio
;
wrr_ok
++
;
wrr_ok
++
;
}
else
if
(
strcmp
(
*
argv
,
"allot"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"allot"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
wrr
.
allot
,
*
argv
))
{
if
(
get_size
(
&
wrr
.
allot
,
*
argv
))
{
explain1
(
"allot"
);
explain1
(
"allot"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"avpkt"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"avpkt"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
lss
.
avpkt
,
*
argv
))
{
if
(
get_size
(
&
lss
.
avpkt
,
*
argv
))
{
explain1
(
"avpkt"
);
explain1
(
"avpkt"
);
return
-
1
;
return
-
1
;
}
}
lss
.
change
|=
TCF_CBQ_LSS_AVPKT
;
lss
.
change
|=
TCF_CBQ_LSS_AVPKT
;
}
else
if
(
strcmp
(
*
argv
,
"mpu"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"mpu"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
mpu
,
*
argv
))
{
if
(
get_size
(
&
mpu
,
*
argv
))
{
explain1
(
"mpu"
);
explain1
(
"mpu"
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
strcmp
(
*
argv
,
"weight"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"weight"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_size
(
&
wrr
.
weight
,
*
argv
))
{
if
(
get_size
(
&
wrr
.
weight
,
*
argv
))
{
explain1
(
"weight"
);
explain1
(
"weight"
);
return
-
1
;
return
-
1
;
}
}
wrr_ok
++
;
wrr_ok
++
;
}
else
if
(
strcmp
(
*
argv
,
"split"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"split"
)
==
0
)
{
NEXT_ARG
();
NEXT_ARG
();
if
(
get_tc_classid
(
&
fopt
.
split
,
*
argv
))
{
if
(
get_tc_classid
(
&
fopt
.
split
,
*
argv
))
{
fprintf
(
stderr
,
"Invalid split node ID.
\n
"
);
fprintf
(
stderr
,
"Invalid split node ID.
\n
"
);
usage
();
usage
();
}
}
fopt_ok
++
;
fopt_ok
++
;
}
else
if
(
strcmp
(
*
argv
,
"defmap"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"defmap"
)
==
0
)
{
int
err
;
int
err
;
NEXT_ARG
();
NEXT_ARG
();
err
=
sscanf
(
*
argv
,
"%08x/%08x"
,
&
fopt
.
defmap
,
&
fopt
.
defchange
);
err
=
sscanf
(
*
argv
,
"%08x/%08x"
,
&
fopt
.
defmap
,
&
fopt
.
defchange
);
...
@@ -317,7 +326,12 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -317,7 +326,12 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
if
(
err
==
1
)
if
(
err
==
1
)
fopt
.
defchange
=
~
0
;
fopt
.
defchange
=
~
0
;
fopt_ok
++
;
fopt_ok
++
;
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
}
else
if
(
matches
(
*
argv
,
"overhead"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u16
(
&
overhead
,
*
argv
,
10
))
{
explain1
(
"overhead"
);
return
-
1
;
}
}
else
if
(
matches
(
*
argv
,
"help"
)
==
0
)
{
explain_class
();
explain_class
();
return
-
1
;
return
-
1
;
}
else
{
}
else
{
...
@@ -336,6 +350,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
...
@@ -336,6 +350,7 @@ static int cbq_parse_class_opt(struct qdisc_util *qu, int argc, char **argv, str
if
(
wrr
.
allot
<
(
lss
.
avpkt
*
3
)
/
2
)
if
(
wrr
.
allot
<
(
lss
.
avpkt
*
3
)
/
2
)
wrr
.
allot
=
(
lss
.
avpkt
*
3
)
/
2
;
wrr
.
allot
=
(
lss
.
avpkt
*
3
)
/
2
;
r
.
mpu
=
mpu
;
r
.
mpu
=
mpu
;
r
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
r
,
rtab
,
cell_log
,
pktsize
)
<
0
)
{
if
(
tc_calc_rtable
(
&
r
,
rtab
,
cell_log
,
pktsize
)
<
0
)
{
fprintf
(
stderr
,
"CBQ: failed to calculate rate table.
\n
"
);
fprintf
(
stderr
,
"CBQ: failed to calculate rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -464,6 +479,8 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
...
@@ -464,6 +479,8 @@ static int cbq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
fprintf
(
f
,
"cell %ub "
,
1
<<
r
->
cell_log
);
fprintf
(
f
,
"cell %ub "
,
1
<<
r
->
cell_log
);
if
(
r
->
mpu
)
if
(
r
->
mpu
)
fprintf
(
f
,
"mpu %ub "
,
r
->
mpu
);
fprintf
(
f
,
"mpu %ub "
,
r
->
mpu
);
if
(
r
->
overhead
)
fprintf
(
f
,
"overhead %ub "
,
r
->
overhead
);
}
}
}
}
if
(
lss
&&
lss
->
flags
)
{
if
(
lss
&&
lss
->
flags
)
{
...
...
tc/q_tbf.c
View file @
e2dc309e
...
@@ -26,7 +26,8 @@
...
@@ -26,7 +26,8 @@
static
void
explain
(
void
)
static
void
explain
(
void
)
{
{
fprintf
(
stderr
,
"Usage: ... tbf limit BYTES burst BYTES[/BYTES] rate KBPS [ mtu BYTES[/BYTES] ]
\n
"
);
fprintf
(
stderr
,
"Usage: ... tbf limit BYTES burst BYTES[/BYTES] rate KBPS [ mtu BYTES[/BYTES] ]
\n
"
);
fprintf
(
stderr
,
" [ peakrate KBPS ] [ latency TIME ]
\n
"
);
fprintf
(
stderr
,
" [ peakrate KBPS ] [ latency TIME ] "
);
fprintf
(
stderr
,
"[ overhead BYTES ]
\n
"
);
}
}
static
void
explain1
(
char
*
arg
)
static
void
explain1
(
char
*
arg
)
...
@@ -45,6 +46,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -45,6 +46,7 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
__u32
ptab
[
256
];
__u32
ptab
[
256
];
unsigned
buffer
=
0
,
mtu
=
0
,
mpu
=
0
,
latency
=
0
;
unsigned
buffer
=
0
,
mtu
=
0
,
mpu
=
0
,
latency
=
0
;
int
Rcell_log
=-
1
,
Pcell_log
=
-
1
;
int
Rcell_log
=-
1
,
Pcell_log
=
-
1
;
unsigned
short
overhead
=
0
;
struct
rtattr
*
tail
;
struct
rtattr
*
tail
;
memset
(
&
opt
,
0
,
sizeof
(
opt
));
memset
(
&
opt
,
0
,
sizeof
(
opt
));
...
@@ -130,6 +132,15 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -130,6 +132,15 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
return
-
1
;
return
-
1
;
}
}
ok
++
;
ok
++
;
}
else
if
(
matches
(
*
argv
,
"overhead"
)
==
0
)
{
NEXT_ARG
();
if
(
overhead
)
{
fprintf
(
stderr
,
"Double
\"
overhead
\"
spec
\n
"
);
return
-
1
;
}
if
(
get_u16
(
&
overhead
,
*
argv
,
10
))
{
explain1
(
"overhead"
);
return
-
1
;
}
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"help"
)
==
0
)
{
explain
();
explain
();
return
-
1
;
return
-
1
;
...
@@ -170,7 +181,8 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -170,7 +181,8 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
opt
.
limit
=
lim
;
opt
.
limit
=
lim
;
}
}
opt
.
rate
.
mpu
=
mpu
;
opt
.
rate
.
mpu
=
mpu
;
opt
.
rate
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
opt
.
rate
,
rtab
,
Rcell_log
,
mtu
)
<
0
)
{
if
(
tc_calc_rtable
(
&
opt
.
rate
,
rtab
,
Rcell_log
,
mtu
)
<
0
)
{
fprintf
(
stderr
,
"TBF: failed to calculate rate table.
\n
"
);
fprintf
(
stderr
,
"TBF: failed to calculate rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -178,7 +190,8 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
...
@@ -178,7 +190,8 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl
opt
.
buffer
=
tc_calc_xmittime
(
opt
.
rate
.
rate
,
buffer
);
opt
.
buffer
=
tc_calc_xmittime
(
opt
.
rate
.
rate
,
buffer
);
if
(
opt
.
peakrate
.
rate
)
{
if
(
opt
.
peakrate
.
rate
)
{
opt
.
peakrate
.
mpu
=
mpu
;
opt
.
peakrate
.
mpu
=
mpu
;
opt
.
peakrate
.
overhead
=
overhead
;
if
(
tc_calc_rtable
(
&
opt
.
peakrate
,
ptab
,
Pcell_log
,
mtu
)
<
0
)
{
if
(
tc_calc_rtable
(
&
opt
.
peakrate
,
ptab
,
Pcell_log
,
mtu
)
<
0
)
{
fprintf
(
stderr
,
"TBF: failed to calculate peak rate table.
\n
"
);
fprintf
(
stderr
,
"TBF: failed to calculate peak rate table.
\n
"
);
return
-
1
;
return
-
1
;
...
@@ -252,6 +265,10 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
...
@@ -252,6 +265,10 @@ static int tbf_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
}
}
fprintf
(
f
,
"lat %s "
,
sprint_time
(
latency
,
b1
));
fprintf
(
f
,
"lat %s "
,
sprint_time
(
latency
,
b1
));
if
(
qopt
->
rate
.
overhead
)
{
fprintf
(
f
,
"overhead %d"
,
qopt
->
rate
.
overhead
);
}
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment