Commit bd733e40 authored by Stephen Hemminger's avatar Stephen Hemminger

Merge branch 'master' into net-next

Conflicts:
	man/man8/ip-route.8.in
parents 194e9b85 a89d5329
......@@ -16,7 +16,8 @@ struct db_names {
int max;
};
struct db_names *db_names_alloc(const char *path);
struct db_names *db_names_alloc(void);
int db_names_load(struct db_names *db, const char *path);
void db_names_free(struct db_names *db);
char *id_to_name(struct db_names *db, int id, char *name);
......
......@@ -72,7 +72,7 @@ void iplink_usage(void)
fprintf(stderr, " [ mtu MTU ]\n");
fprintf(stderr, " [ netns PID ]\n");
fprintf(stderr, " [ netns NAME ]\n");
fprintf(stderr, " [ link-netnsid ID ]\n");
fprintf(stderr, " [ link-netnsid ID ]\n");
fprintf(stderr, " [ alias NAME ]\n");
fprintf(stderr, " [ vf NUM [ mac LLADDR ]\n");
fprintf(stderr, " [ vlan VLANID [ qos VLAN-QOS ] ]\n");
......
......@@ -11,8 +11,10 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "names.h"
#include "utils.h"
#define MAX_ENTRIES 256
#define NAME_MAX_LEN 512
......@@ -48,48 +50,65 @@ static int read_id_name(FILE *fp, int *id, char *name)
return 0;
}
struct db_names *db_names_alloc(const char *path)
struct db_names *db_names_alloc(void)
{
struct db_names *db;
struct db_entry *entry;
FILE *fp;
int id;
char namebuf[NAME_MAX_LEN] = {0};
int ret;
fp = fopen(path, "r");
if (!fp) {
fprintf(stderr, "Can't open file: %s\n", path);
db = malloc(sizeof(*db));
if (!db)
return NULL;
}
db = malloc(sizeof(*db));
memset(db, 0, sizeof(*db));
db->size = MAX_ENTRIES;
db->hash = malloc(sizeof(struct db_entry *) * db->size);
memset(db->hash, 0, sizeof(struct db_entry *) * db->size);
return db;
}
int db_names_load(struct db_names *db, const char *path)
{
struct db_entry *entry;
FILE *fp;
int id;
char namebuf[NAME_MAX_LEN] = {0};
int ret = -1;
fp = fopen(path, "r");
if (!fp)
return -ENOENT;
while ((ret = read_id_name(fp, &id, &namebuf[0]))) {
if (ret == -1) {
fprintf(stderr, "Database %s is corrupted at %s\n",
path, namebuf);
fclose(fp);
return NULL;
goto Exit;
}
ret = -1;
if (id < 0)
continue;
entry = malloc(sizeof(*entry));
entry->id = id;
if (!entry)
goto Exit;
entry->name = strdup(namebuf);
if (!entry->name) {
free(entry);
goto Exit;
}
entry->id = id;
entry->next = db->hash[id & (db->size - 1)];
db->hash[id & (db->size - 1)] = entry;
}
ret = 0;
Exit:
fclose(fp);
return db;
return ret;
}
void db_names_free(struct db_names *db)
......@@ -117,8 +136,12 @@ void db_names_free(struct db_names *db)
char *id_to_name(struct db_names *db, int id, char *name)
{
struct db_entry *entry = db->hash[id & (db->size - 1)];
struct db_entry *entry;
if (!db)
return NULL;
entry = db->hash[id & (db->size - 1)];
while (entry && entry->id != id)
entry = entry->next;
......@@ -136,6 +159,9 @@ int name_to_id(struct db_names *db, int *id, const char *name)
struct db_entry *entry;
int i;
if (!db)
return -1;
if (db->cached && strcmp(db->cached->name, name) == 0) {
*id = db->cached->id;
return 0;
......@@ -145,6 +171,7 @@ int name_to_id(struct db_names *db, int *id, const char *name)
entry = db->hash[i];
while (entry && strcmp(entry->name, name))
entry = entry->next;
if (entry) {
db->cached = entry;
*id = entry->id;
......
......@@ -35,7 +35,7 @@ Suppress sending broadcast queries by the kernel. This option only makes sense t
Specifies the timeout of the negative cache. When resolution fails, arpd suppresses further attempts to resolve for this period. This option only makes sense together with option '-k'. This timeout should not be too much longer than the boot time of a typical host not supporting gratuitous ARP. Default value is 60 seconds.
.TP
-p <TIME>
The time to wait in seconds between polling attempts to the kernel ARP table. TIME may be a floating point number. The default value is 30.
The time to wait in seconds between polling attempts to the kernel ARP table. TIME may be a floating point number. The default value is 30.
.TP
-R <RATE>
Maximal steady rate of broadcasts sent by arpd in packets per second. Default value is 1.
......
......@@ -111,7 +111,7 @@ utility and exit.
.TP
.BR "\-s" , " \-stats", " \-statistics"
output more information. If this option
output more information. If this option
is given multiple times, the amount of information increases.
As a rule, the information is statistics or some time values.
......@@ -169,9 +169,9 @@ and
(or
.B list
) objects, but some objects do not allow all of these operations
or have some additional commands. The
or have some additional commands. The
.B help
command is available for all objects. It prints
command is available for all objects. It prints
out a list of available commands and argument syntax conventions.
.sp
If no command is given, some default command is assumed.
......@@ -201,70 +201,70 @@ the STP path cost of the specified port.
.TP
.BI priority " PRIO "
the STP port priority. The priority value is an unsigned 8-bit quantity
(number between 0 and 255). This metric is used in the designated port an
the STP port priority. The priority value is an unsigned 8-bit quantity
(number between 0 and 255). This metric is used in the designated port an
droot port selectio algorithms.
.TP
.BI state " STATE "
the operation state of the port. This is primarily used by user space STP/RSTP
implementation. One may enter a lowercased port state name, or one of the
numbers below. Negative inputs are ignored, and unrecognized names return an
the operation state of the port. This is primarily used by user space STP/RSTP
implementation. One may enter a lowercased port state name, or one of the
numbers below. Negative inputs are ignored, and unrecognized names return an
error.
.B 0
- port is DISABLED. Make this port completely inactive.
- port is DISABLED. Make this port completely inactive.
.sp
.B 1
- STP LISTENING state. Only valid if STP is enabled on the brige. In this
- STP LISTENING state. Only valid if STP is enabled on the brige. In this
state the port for list for STP BPDUs and drop all other traffic.
.sp
.B 2
- STP LEARNING state. Only valid if STP is enabled on the bridge. In this
- STP LEARNING state. Only valid if STP is enabled on the bridge. In this
state the port will accept traffic only for the purpose of updating MAC
adress tables.
.sp
.B 3
- STP FORWARDING state. Port is fully active.
- STP FORWARDING state. Port is fully active.
.sp
.B 4
- STP BLOCKING state. Only valid if STP is enabled on the bridge. This state
is used during the STP election process. In this state, port will only process
- STP BLOCKING state. Only valid if STP is enabled on the bridge. This state
is used during the STP election process. In this state, port will only process
STP BPDUs.
.sp
.TP
.BR "guard on " or " guard off "
Controls whether STP BPUDs will be processed by the bridge port. By default,
the flag is turned off allowed BPDU processing. Turning this flag on will
Controls whether STP BPUDs will be processed by the bridge port. By default,
the flag is turned off allowed BPDU processing. Turning this flag on will
cause the port to stop processing STP BPDUs.
.TP
.BR "hairpin on " or " hairpin off "
Controls whether traffic may be send back out of the port on which it was
received. By default, this flag is turned off and the bridge will not forward
received. By default, this flag is turned off and the bridge will not forward
traffic back out of the receiving port.
.TP
.BR "fastleave on " or " fastleave off "
This flag allows the bridge to immediately stop multicast traffic on a port
that receives IGMP Leave message. It is only used with IGMP snooping is
enabled on the bridge. By default the flag is off.
that receives IGMP Leave message. It is only used with IGMP snooping is
enabled on the bridge. By default the flag is off.
.TP
.BR "root_block on " or " root_block off "
Controls whether a given port is allowed to become root port or not. Only used
when STP is enabled on the bridge. By default the flag is off.
Controls whether a given port is allowed to become root port or not. Only used
when STP is enabled on the bridge. By default the flag is off.
.TP
.BR "learning on " or " learning off "
Controls whether a given port will learn MAC addresses from received traffic or
not. If learning if off, the bridge will end up flooding any traffic for which
it has no FDB entry. By default this flag is on.
not. If learning if off, the bridge will end up flooding any traffic for which
it has no FDB entry. By default this flag is on.
.TP
.BR "learning_sync on " or " learning_sync off "
......@@ -273,12 +273,12 @@ bridge FDB.
.TP
.BR "flooding on " or " flooding off "
Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on.
Controls whether a given port will flood unicast traffic for which there is no FDB entry. By default this flag is on.
.TP
.BI hwmode
Some network interface cards support HW bridge functionality and they may be
configured in different modes. Currently support modes are:
configured in different modes. Currently support modes are:
.B vepa
- Data sent between HW ports is sent on the wire to the external
......@@ -389,7 +389,7 @@ This command displays the current forwarding table.
.PP
With the
.B -statistics
option, the command becomes verbose. It prints out the last updated
option, the command becomes verbose. It prints out the last updated
and last used time for each entry.
.SH bridge mdb - multicast group database management
......@@ -452,7 +452,7 @@ bridge interfaces.
.PP
With the
.B -details
option, the command becomes verbose. It prints out the ports known to have
option, the command becomes verbose. It prints out the ports known to have
a connected router.
.SH bridge vlan - VLAN filter list
......@@ -487,7 +487,7 @@ the vlan specified is to be treated as untagged on egress.
.TP
.BI self
the vlan is configured on the specified physical device. Required if the
the vlan is configured on the specified physical device. Required if the
device is the bridge device.
.TP
......@@ -513,7 +513,7 @@ This command displays the current VLAN filter table.
The
.B bridge
utility can monitor the state of devices and addresses
continuously. This option has a slightly different format.
continuously. This option has a slightly different format.
Namely, the
.B monitor
command is the first in the command line and then the object list follows:
......@@ -535,7 +535,7 @@ described in previous sections.
.P
If a file name is given, it does not listen on RTNETLINK,
but opens the file containing RTNETLINK messages saved in binary format
and dumps them. Such a history file can be generated with the
and dumps them. Such a history file can be generated with the
.SH NOTES
......
......@@ -80,7 +80,7 @@ the name of the device to add the address to.
.BI local " ADDRESS " (default)
the address of the interface. The format of the address depends
on the protocol. It is a dotted quad for IP and a sequence of
hexadecimal halfwords separated by colons for IPv6. The
hexadecimal halfwords separated by colons for IPv6. The
.I ADDRESS
may be followed by a slash and a decimal number which encodes
the network prefix length.
......@@ -91,8 +91,8 @@ the address of the remote endpoint for pointopoint interfaces.
Again, the
.I ADDRESS
may be followed by a slash and a decimal number, encoding the network
prefix length. If a peer address is specified, the local address
cannot have a prefix length. The network prefix is associated
prefix length. If a peer address is specified, the local address
cannot have a prefix length. The network prefix is associated
with the peer rather than with the local address.
.TP
......@@ -103,7 +103,7 @@ It is possible to use the special symbols
.B '+'
and
.B '-'
instead of the broadcast address. In this case, the broadcast address
instead of the broadcast address. In this case, the broadcast address
is derived by setting/resetting the host bits of the interface prefix.
.TP
......@@ -139,7 +139,7 @@ valid inside this site.
.B Arguments:
coincide with the arguments of
.B ip addr add.
The device name is a required argument. The rest are optional.
The device name is a required argument. The rest are optional.
If no arguments are given, the first address is deleted.
.SS ip address show - look at protocol addresses
......@@ -221,14 +221,14 @@ The difference is that it does not run when no arguments are given.
.B Warning:
This command (and other
.B flush
commands described below) is pretty dangerous. If you make a mistake,
commands described below) is pretty dangerous. If you make a mistake,
it will not forgive it, but will cruelly purge all the addresses.
.PP
With the
.B -statistics
option, the command becomes verbose. It prints out the number of deleted
addresses and the number of rounds made to flush the address list. If
addresses and the number of rounds made to flush the address list. If
this option is given twice,
.B ip address flush
also dumps all the deleted addresses in the format described in the
......
......@@ -35,7 +35,7 @@ ip-addrlabel \- protocol address label management
.SH "DESCRIPTION"
IPv6 address labels are used for address selection;
they are described in RFC 3484. Precedence is managed by userspace,
they are described in RFC 3484. Precedence is managed by userspace,
and only the label itself is stored in the kernel.
.SS ip addrlabel add - add an address label
......
......@@ -72,7 +72,10 @@ ip-link \- network device configuration
.BR gre " |"
.BR gretap " |"
.BR ip6gre " |"
.BR ip6gretap " ]"
.BR ip6gretap " |"
.BR vti " |"
.BR nlmon " |"
.BR ipvlan " ]"
.ti -8
.BI "ip link delete " DEVICE
......@@ -228,6 +231,15 @@ Link types:
.sp
.BR ip6gretap
- Virtual L2 tunnel interface GRE over IPv6
.sp
.BR vti
- Virtual tunnel interface
.sp
.BR nlmon
- Netlink monitoring device
.sp
.BR ipvlan
- Interface for L3 (IPv6/IPv4) based VLANs
.in -8
.TP
......@@ -300,7 +312,7 @@ parameter.
.BI remote " IPADDR"
- specifies the unicast destination IP address to use in outgoing packets
when the destination link layer address is not known in the VXLAN device
forwarding database. This parameter cannot be specified with the
forwarding database. This parameter cannot be specified with the
.B group
parameter.
......@@ -521,7 +533,7 @@ flag calculates checksums for outgoing packets.
The
.B icsum
flag requires that all input packets have the correct
checksum. The
checksum. The
.B csum
flag is equivalent to the combination
.BR "icsum ocsum" .
......@@ -532,7 +544,7 @@ flag is equivalent to the combination
.sp
.BI encaplimit " ELIM"
- specifies a fixed encapsulation limit. Default is 4.
- specifies a fixed encapsulation limit. Default is 4.
.sp
.BI flowlabel " FLOWLABEL"
......@@ -599,7 +611,7 @@ device.
.BI group " GROUP "
.I GROUP
has a dual role: If both group and dev are present, then move the device to the
specified group. If only a group is specified, then the command operates on
specified group. If only a group is specified, then the command operates on
all devices in that group.
.TP
......@@ -631,7 +643,7 @@ used by the Linux).
.TP
.BI name " NAME"
change the name of the device. This operation is not
change the name of the device. This operation is not
recommended if the device is running or has some addresses
already configured.
......@@ -782,7 +794,7 @@ If multiple parameter changes are requested,
aborts immediately after any of the changes have failed.
This is the only case when
.B ip
can move the system to an unpredictable state. The solution
can move the system to an unpredictable state. The solution
is to avoid changing several parameters with one
.B ip link set
call.
......
......@@ -39,7 +39,7 @@ the device name.
These commands attach/detach a static link-layer multicast address
to listen on the interface.
Note that it is impossible to join protocol multicast groups
statically. This command only manages link-layer addresses.
statically. This command only manages link-layer addresses.
.RS
.TP
......
......@@ -33,7 +33,7 @@ Prints short timestamp before the event message on the same line in format:
The
.B ip
utility can monitor the state of devices, addresses
and routes continuously. This option has a slightly different format.
and routes continuously. This option has a slightly different format.
Namely, the
.B monitor
command is the first in the command line and then the object list follows:
......@@ -65,7 +65,7 @@ but opens the given file, and dumps its contents. The file
should contain RTNETLINK messages saved in binary format.
Such a file can be generated with the
.B rtmon
utility. This utility has a command line syntax similar to
utility. This utility has a command line syntax similar to
.BR "ip monitor" .
Ideally,
.B rtmon
......
......@@ -28,7 +28,7 @@ or
Due to the limitations of the current interface to the multicast routing
engine, it is impossible to change
.B mroute
objects administratively, so we can only display them. This limitation
objects administratively, so we can only display them. This limitation
will be removed in the future.
.SS ip mroute show - list mroute cache entries
......
......@@ -152,7 +152,7 @@ only list neighbour entries in this state.
.I NUD_STATE
takes values listed below or the special value
.B all
which means all states. This option may occur more than once.
which means all states. This option may occur more than once.
If this option is absent,
.B ip
lists all entries except for
......@@ -176,9 +176,9 @@ and
.PP
With the
.B -statistics
option, the command becomes verbose. It prints out the number of
option, the command becomes verbose. It prints out the number of
deleted neighbours and the number of rounds made to flush the
neighbour table. If the option is given
neighbour table. If the option is given
twice,
.B ip neigh flush
also dumps all the deleted neighbours.
......
......@@ -51,10 +51,10 @@ the processes share the same default network namespace from the init process.
By convention a named network namespace is an object at
.BR "/var/run/netns/" NAME
that can be opened. The file descriptor resulting from opening
that can be opened. The file descriptor resulting from opening
.BR "/var/run/netns/" NAME
refers to the specified network namespace. Holding that file
descriptor open keeps the network namespace alive. The file
refers to the specified network namespace. Holding that file
descriptor open keeps the network namespace alive. The file
descriptor can be used with the
.B setns(2)
system call to change the network namespace associated with a task.
......@@ -90,7 +90,7 @@ network namespace and assigns NAME.
.B ip [-all] netns delete [ NAME ] - delete the name of a network namespace(s)
.sp
If NAME is present in /var/run/netns it is umounted and the mount
point is removed. If this is the last user of the network namespace the
point is removed. If this is the last user of the network namespace the
network namespace will be freed and all physical devices will be moved to the
default one, otherwise the network namespace persists until it has no more
users. ip netns delete may fail if the mount point is in use in another mount
......@@ -116,12 +116,18 @@ $ ip netns exec net0 SOME_PROCESS_IN_BACKGROUND
$ ip netns del net0
.RE
.RS
and eth0 will appear in the default netns only after SOME_PROCESS_IN_BACKGROUND
will exit or will be killed. To prevent this the processes running in net0
should be killed before deleting the netns:
$ ip netns pids net0 | xargs kill
$ ip netns del net0
.RE
.RS 10
$ ip netns pids net0 | xargs kill
.RE
.RS 10
$ ip netns del net0
.RE
.TP
.B ip netns set NAME NETNSID - assign an id to a peer network namespace
......@@ -152,7 +158,7 @@ the named network namespace as their primary network namespace.
This command allows applications that are network namespace unaware
to be run in something other than the default network namespace with
all of the configuration for the specified network namespace appearing
in the customary global locations. A network namespace and bind mounts
in the customary global locations. A network namespace and bind mounts
are used to move files from their network namespace specific location
to their default locations without affecting other processes.
......
......@@ -178,7 +178,7 @@ by the route prefix.
.sp
.B unreachable
- these destinations are unreachable. Packets are discarded and the
- these destinations are unreachable. Packets are discarded and the
ICMP message
.I host unreachable
is generated.
......@@ -188,47 +188,47 @@ error.
.sp
.B blackhole
- these destinations are unreachable. Packets are discarded silently.
- these destinations are unreachable. Packets are discarded silently.
The local senders get an
.I EINVAL
error.
.sp
.B prohibit
- these destinations are unreachable. Packets are discarded and the
- these destinations are unreachable. Packets are discarded and the
ICMP message
.I communication administratively prohibited
is generated. The local senders get an
is generated. The local senders get an
.I EACCES
error.
.sp
.B local
- the destinations are assigned to this host. The packets are looped
- the destinations are assigned to this host. The packets are looped
back and delivered locally.
.sp
.B broadcast
- the destinations are broadcast addresses. The packets are sent as
- the destinations are broadcast addresses. The packets are sent as
link broadcasts.
.sp
.B throw
- a special control route used together with policy rules. If such a
route is selected, lookup in this table is terminated pretending that
no route was found. Without policy routing it is equivalent to the
absence of the route in the routing table. The packets are dropped
no route was found. Without policy routing it is equivalent to the
absence of the route in the routing table. The packets are dropped
and the ICMP message
.I net unreachable
is generated. The local senders get an
is generated. The local senders get an
.I ENETUNREACH
error.
.sp
.B nat
- a special NAT route. Destinations covered by the prefix
- a special NAT route. Destinations covered by the prefix
are considered to be dummy (or external) addresses which require translation
to real (or internal) ones before forwarding. The addresses to translate to
to real (or internal) ones before forwarding. The addresses to translate to
are selected with the attribute
.BR "via" .
.B Warning:
......@@ -239,7 +239,7 @@ Route NAT is no longer supported in Linux 2.6.
.RI "- " "not implemented"
the destinations are
.I anycast
addresses assigned to this host. They are mainly equivalent
addresses assigned to this host. They are mainly equivalent
to
.B local
with one difference: such addresses are invalid when used
......@@ -247,7 +247,7 @@ as the source address of any packet.
.sp
.B multicast
- a special type used for multicast routing. It is not present in
- a special type used for multicast routing. It is not present in
normal routing tables.
.in -8
......@@ -263,10 +263,10 @@ Values (0, 253, 254, and 255) are reserved for built-in use.
.sp
Actually, one other table always exists, which is invisible but
even more important. It is the
even more important. It is the
.B local
table (ID 255). This table
consists of routes for local and broadcast addresses. The kernel maintains
table (ID 255). This table
consists of routes for local and broadcast addresses. The kernel maintains
this table automatically and the administrator usually need not modify it
or even look at it.
......@@ -286,7 +286,7 @@ change or add new one
.RS
.TP
.BI to " TYPE PREFIX " (default)
the destination prefix of the route. If
the destination prefix of the route. If
.I TYPE
is omitted,
.B ip
......@@ -297,9 +297,9 @@ Other values of
are listed above.
.I PREFIX
is an IP or IPv6 address optionally followed by a slash and the
prefix length. If the length of the prefix is missing,
prefix length. If the length of the prefix is missing,
.B ip
assumes a full-length host route. There is also a special
assumes a full-length host route. There is also a special
.I PREFIX
.B default
- which is equivalent to IP
......@@ -311,9 +311,9 @@ or to IPv6
.BI tos " TOS"
.TP
.BI dsfield " TOS"
the Type Of Service (TOS) key. This key has no associated mask and
the Type Of Service (TOS) key. This key has no associated mask and
the longest match is understood as: First, compare the TOS
of the route and of the packet. If they are not equal, then the packet
of the route and of the packet. If they are not equal, then the packet
may still match a route with a zero TOS.
.I TOS
is either an 8 bit hexadecimal number or an identifier
......@@ -356,7 +356,7 @@ normal
.B unicast
routes it is either the true next hop router or, if it is a direct
route installed in BSD compatibility mode, it can be a local address
of the interface. For NAT routes it is the first address of the block
of the interface. For NAT routes it is the first address of the block
of translated IP destinations.
.TP
......@@ -375,10 +375,10 @@ may be a number or a string from the file
.BI mtu " MTU"
.TP
.BI "mtu lock" " MTU"
the MTU along the path to the destination. If the modifier
the MTU along the path to the destination. If the modifier
.B lock
is not used, the MTU may be updated by the kernel due to
Path MTU Discovery. If the modifier
Path MTU Discovery. If the modifier
.B lock
is used, no path MTU discovery will be tried, all packets
will be sent without the DF bit in IPv4 case or fragmented
......@@ -387,7 +387,7 @@ to MTU for IPv6.
.TP
.BI window " NUMBER"
the maximal window for TCP to advertise to these destinations,
measured in bytes. It limits maximal data bursts that our TCP
measured in bytes. It limits maximal data bursts that our TCP
peers are allowed to send to us.
.TP
......@@ -408,7 +408,7 @@ above.
.TP
.BI rto_min " TIME " "(2.6.23+ only)"
the minimum TCP Retransmission TimeOut to use when communicating with this
destination. Values are specified as with
destination. Values are specified as with
.BI rtt
above.
......@@ -418,7 +418,7 @@ an estimate for the initial slow start threshold.
.TP
.BI cwnd " NUMBER " "(2.3.15+ only)"
the clamp for congestion window. It is ignored if the
the clamp for congestion window. It is ignored if the
.B lock
flag is not used.
......@@ -437,7 +437,7 @@ The default value is zero, meaning to use Slow Start value.
.TP
.BI features " FEATURES " (3.18+ only)
Enable or disable per-route features. Only available feature at this
Enable or disable per-route features. Only available feature at this
time is
.B ecn
to enable explicit congestion notification when initiating connections to the
......@@ -469,7 +469,7 @@ use the proposed algorithm.
.TP
.BI advmss " NUMBER " "(2.3.15+ only)"
the MSS ('Maximal Segment Size') to advertise to these
destinations when establishing TCP connections. If it is not given,
destinations when establishing TCP connections. If it is not given,
Linux uses a default value calculated from the first hop device MTU.
(If the path to these destination is asymmetric, this guess may be wrong.)
......@@ -532,7 +532,7 @@ If the routing protocol ID is not given,
.B ip assumes protocol
.B boot
(i.e. it assumes the route was added by someone who doesn't
understand what they are doing). Several protocol values have
understand what they are doing). Several protocol values have
a fixed interpretation.
Namely:
......@@ -603,7 +603,7 @@ but their semantics are a bit different.
Key values
.RB "(" to ", " tos ", " preference " and " table ")"
select the route to delete. If optional attributes are present,
select the route to delete. If optional attributes are present,
.B ip
verifies that they coincide with the attributes of the route to delete.
If no route with the given key and attributes was found,
......@@ -660,7 +660,7 @@ only select routes with the given TOS.
.TP
.BI table " TABLEID"
show the routes from this table(s). The default setting is to show table
show the routes from this table(s). The default setting is to show table
.BR main "."
.I TABLEID
may either be the ID of a real table or one of the special values:
......@@ -734,7 +734,7 @@ this command flushes routes selected by some criteria.
.sp
The arguments have the same syntax and semantics as the arguments of
.BR "ip route show" ,
but routing tables are not listed but purged. The only difference is
but routing tables are not listed but purged. The only difference is
the default action:
.B show
dumps all the IP main routing table but
......@@ -796,7 +796,7 @@ Note that this operation is not equivalent to
.B show
shows existing routes.
.B get
resolves them and creates new clones if necessary. Essentially,
resolves them and creates new clones if necessary. Essentially,
.B get
is equivalent to sending a packet along this path.
If the
......@@ -806,7 +806,7 @@ to output packets towards the requested destination.
This is equivalent to pinging the destination
with a subsequent
.BR "ip route ls cache" ,
however, no packets are actually sent. With the
however, no packets are actually sent. With the
.B iif
argument, the kernel pretends that a packet arrived from this interface
and searches for a path to forward the packet.
......@@ -830,8 +830,8 @@ This command expects to read a data stream as returned from
.BR "ip route save" .
It will attempt to restore the routing table information exactly as
it was at the time of the save, so any translation of information
in the stream (such as device indexes) must be done first. Any existing
routes are left unchanged. Any routes specified in the data stream that
in the stream (such as device indexes) must be done first. Any existing
routes are left unchanged. Any routes specified in the data stream that
already exist in the table will be ignored.
.RE
......
......@@ -86,7 +86,7 @@ and an
The RPDB is scanned in order of decreasing priority. The selector
of each rule is applied to {source address, destination address, incoming
interface, tos, fwmark} and, if the selector matches the packet,
the action is performed. The action predicate may return with success.
the action is performed. The action predicate may return with success.
In this case, it will either give a route or failure indication
and the RPDB lookup is terminated. Otherwise, the RPDB program
continues with the next rule.
......@@ -131,18 +131,18 @@ table
(ID 253).
The
.B default
table is empty. It is reserved for some post-processing if no previous
table is empty. It is reserved for some post-processing if no previous
default rules selected the packet.
This rule may also be deleted.
.P
Each RPDB entry has additional
attributes. F.e. each rule has a pointer to some routing
table. NAT and masquerading rules have an attribute to select new IP
address to translate/masquerade. Besides that, rules have some
attributes. F.e. each rule has a pointer to some routing
table. NAT and masquerading rules have an attribute to select new IP
address to translate/masquerade. Besides that, rules have some
optional attributes, which routes have, namely
.BR "realms" .
These values do not override those contained in the routing tables. They
These values do not override those contained in the routing tables. They
are only used if the route did not select any attributes.
.sp
......@@ -175,7 +175,7 @@ of the IP packet into some other value.
.RS
.TP
.BI type " TYPE " (default)
the type of this rule. The list of valid types was given in the previous
the type of this rule. The list of valid types was given in the previous
subsection.
.TP
......@@ -188,14 +188,14 @@ select the destination prefix to match.
.TP
.BI iif " NAME"
select the incoming device to match. If the interface is loopback,
the rule only matches packets originating from this host. This means
select the incoming device to match. If the interface is loopback,
the rule only matches packets originating from this host. This means
that you may create separate routing tables for forwarded and local
packets and, hence, completely segregate them.
.TP
.BI oif " NAME"
select the outgoing device to match. The outgoing interface is only
select the outgoing device to match. The outgoing interface is only
available for packets originating from local sockets that are bound to
a device.
......@@ -213,7 +213,7 @@ value to match.
.TP
.BI priority " PREFERENCE"
the priority of this rule. Each rule should have an explicitly
the priority of this rule. Each rule should have an explicitly
set
.I unique
priority value.
......@@ -236,7 +236,7 @@ group GROUP.
.TP
.BI realms " FROM/TO"
Realms to select if the rule matched and the routing table lookup
succeeded. Realm
succeeded. Realm
.I TO
is only used if the route did not select any realm.
......@@ -253,7 +253,7 @@ Using map-to instead of nat means the same thing.
.B Warning:
Changes to the RPDB made with these commands do not become active
immediately. It is assumed that after a script finishes a batch of
immediately. It is assumed that after a script finishes a batch of
updates, it flushes the routing cache with
.BR "ip route flush cache" .
.RE
......
......@@ -86,7 +86,7 @@ objects are tunnels, encapsulating packets in IP packets and then
sending them over the IP infrastructure.
The encapsulating (or outer) address family is specified by the
.B -f
option. The default is IPv4.
option. The default is IPv4.
.TP
.B ip tunnel add
......@@ -168,7 +168,7 @@ changes.
.TP
.B nopmtudisc
disable Path MTU Discovery on this tunnel.
It is enabled by default. Note that a fixed ttl is incompatible
It is enabled by default. Note that a fixed ttl is incompatible
with this option: tunneling with a fixed ttl always makes pmtu
discovery.
......@@ -199,7 +199,7 @@ flag calculates checksums for outgoing packets.
The
.B icsum
flag requires that all input packets have the correct
checksum. The
checksum. The
.B csum
flag is equivalent to the combination
.BR "icsum ocsum" .
......@@ -223,7 +223,7 @@ flag is equivalent to the combination
.TP
.BI encaplim " ELIM"
.RB ( " only IPv6 tunnels " )
set a fixed encapsulation limit. Default is 4.
set a fixed encapsulation limit. Default is 4.
.TP
.BI flowlabel " FLOWLABEL"
......
......@@ -56,7 +56,7 @@ If there were any errors during execution of the commands, the application retur
.TP
.BR "\-s" , " \-stats" , " \-statistics"
Output more information. If the option
Output more information. If the option
appears twice or more, the amount of information increases.
As a rule, the information is statistics or some time values.
......@@ -67,7 +67,7 @@ Output more detailed information.
.TP
.BR "\-l" , " \-loops " <COUNT>
Specify maximum number of loops the 'ip addr flush' logic
will attempt before giving up. The default is 10.
will attempt before giving up. The default is 10.
Zero (0) means loop until all addresses are removed.
.TP
......@@ -77,7 +77,7 @@ Specifies the protocol family to use. The protocol family identifier can be one
or
.BR link .
If this 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
family,
.B ip
......@@ -259,9 +259,9 @@ and
(or
.B list
) objects, but some objects do not allow all of these operations
or have some additional commands. The
or have some additional commands. The
.B help
command is available for all objects. It prints
command is available for all objects. It prints
out a list of available commands and argument syntax conventions.
.sp
If no command is given, some default command is assumed.
......
......@@ -34,7 +34,7 @@ Show summary of options.
.TP
.B file FILE [ all | LISTofOBJECTS ]
Log output to FILE. LISTofOBJECTS is the list of object types that we
want to monitor. It may contain 'link', 'address', 'route'
want to monitor. It may contain 'link', 'address', 'route'
and 'all'. 'link' specifies the network device, 'address' the protocol
(IP or IPv6) address on a device, 'route' the routing table entry
and 'all' does what the name says.
......
......@@ -58,8 +58,8 @@ interval timeconstant
.SH DESCRIPTION
Class Based Queueing is a classful qdisc that implements a rich
linksharing hierarchy of classes. It contains shaping elements as
well as prioritizing capabilities. Shaping is performed using link
linksharing hierarchy of classes. It contains shaping elements as
well as prioritizing capabilities. Shaping is performed using link
idle time calculations based on the timing of dequeue events and
underlying link bandwidth.
......
......@@ -60,8 +60,8 @@ interval timeconstant
.SH DESCRIPTION
Class Based Queueing is a classful qdisc that implements a rich
linksharing hierarchy of classes. It contains shaping elements as
well as prioritizing capabilities. Shaping is performed using link
linksharing hierarchy of classes. It contains shaping elements as
well as prioritizing capabilities. Shaping is performed using link
idle time calculations based on the timing of dequeue events and
underlying link bandwidth.
......
......@@ -22,12 +22,12 @@ chance
CHOKe (CHOose and Keep for responsive flows, CHOose and Kill for unresponsive flows)
is a classless qdisc designed to both identify and penalize flows that monopolize the
queue. CHOKe is a variation of RED, and the configuration is similar to RED.
queue. CHOKe is a variation of RED, and the configuration is similar to RED.
.SH ALGORITHM
Once the queue hits a certain average length, a random packet is drawn from the
queue. If both the to-be-queued and the drawn packet belong to the same flow,
both packets are dropped. Otherwise, if the queue length is still below the maximum length,
queue. If both the to-be-queued and the drawn packet belong to the same flow,
both packets are dropped. Otherwise, if the queue length is still below the maximum length,
the new packet has a configurable chance of being marked (which may mean dropped).
If the queue length exceeds
.BR max ,
......
......@@ -69,10 +69,10 @@ is used to ensure that the measured minimum delay does not become too stale. The
minimum delay must be experienced in the last epoch of length
.B interval.
It should be set on the order of the worst-case RTT through the bottleneck to
give endpoints sufficient time to react. Default value is 100ms.
give endpoints sufficient time to react. Default value is 100ms.
.SS ecn | noecn
can be used to mark packets instead of dropping them. If
can be used to mark packets instead of dropping them. If
.B ecn
has been enabled,
.B noecn
......
......@@ -23,9 +23,9 @@ Each class is assigned a deficit counter, initialized to
.B quantum.
DRR maintains an (internal) ''active'' list of classes whose qdiscs are
non-empty. This list is used for dequeuing. A packet is dequeued from
non-empty. This list is used for dequeuing. A packet is dequeued from
the class at the head of the list if the packet size is smaller or equal
to the deficit counter. If the counter is too small, it is increased by
to the deficit counter. If the counter is too small, it is increased by
.B quantum
and the scheduler moves on to the next class in the active list.
......@@ -34,7 +34,7 @@ and the scheduler moves on to the next class in the active list.
.TP
quantum
Amount of bytes a flow is allowed to dequeue before the scheduler moves to
the next class. Defaults to the MTU of the interface. The minimum value is 1.
the next class. Defaults to the MTU of the interface. The minimum value is 1.
.SH EXAMPLE & USAGE
......@@ -54,9 +54,9 @@ You also need to add at least one filter to classify packets.
.P
Like SFQ, DRR is only useful when it owns the queue \-\- it is a pure scheduler and does
not delay packets. Attaching non-work-conserving qdiscs like tbf to it does not make
not delay packets. Attaching non-work-conserving qdiscs like tbf to it does not make
sense \-\- other qdiscs in the active list will also become inactive until the dequeue
operation succeeds. Embed DRR within another qdisc like HTB or HFSC to ensure it owns the queue.
operation succeeds. Embed DRR within another qdisc like HTB or HFSC to ensure it owns the queue.
.P
You can mimic SFQ behavior by assigning packets to the attached classes using the
flow filter:
......
......@@ -47,7 +47,7 @@ has the same semantics as
.B codel
and is the acceptable minimum
standing/persistent queue delay. This minimum delay is identified by tracking
the local minimum queue delay that packets experience. Default value is 5ms.
the local minimum queue delay that packets experience. Default value is 5ms.
.SS interval
has the same semantics as
......@@ -55,7 +55,7 @@ has the same semantics as
and is used to ensure that the measured minimum delay does not become too stale.
The minimum delay must be experienced in the last epoch of length .B interval.
It should be set on the order of the worst-case RTT through the bottleneck to
give endpoints sufficient time to react. Default value is 100ms.
give endpoints sufficient time to react. Default value is 100ms.
.SS quantum
is the number of bytes used as 'deficit' in the fair queuing algorithm. Default
......@@ -65,7 +65,7 @@ header length of 14 bytes.
.SS ecn | noecn
has the same semantics as
.B codel
and can be used to mark packets instead of dropping them. If
and can be used to mark packets instead of dropping them. If
.B ecn
has been enabled,
.B noecn
......
......@@ -32,7 +32,7 @@ For description of BYTE, BPS and SEC \- please see \fBUNITS\fR
section of \fBtc\fR(8).
.
.SH DESCRIPTION (qdisc)
HFSC qdisc has only one optional parameter \- \fBdefault\fR. CLASSID specifies
HFSC qdisc has only one optional parameter \- \fBdefault\fR. CLASSID specifies
the minor part of the default classid, where packets not classified by other
means (e.g. u32 filter, CLASSIFY target of iptables) will be enqueued. If
\fBdefault\fR is not specified, unclassified packets will be dropped.
......
......@@ -151,7 +151,7 @@ header compression scheme. The third parameter - an unsigned value - specify
the cellsize. Cellsize can be used to simulate link layer schemes. ATM for
example has an payload cellsize of 48 bytes and 5 byte per cell header. If a
packet is 50 byte then ATM must use two cells: 2 * 48 bytes payload including 2
* 5 byte header, thus consume 106 byte on the wire. The last optional value
* 5 byte header, thus consume 106 byte on the wire. The last optional value
.I CELLOVERHEAD
can be used to specify per cell overhead - for our ATM example 5.
.I CELLOVERHEAD
......
......@@ -49,7 +49,7 @@ the deviation between the current and target latency changes probability. beta e
additional adjustments depending on the latency trend.
The drop probabilty is used to mark packets in ecn mode. However, as in RED,
beyond 10% packets are dropped based on this probability. The bytemode is used
beyond 10% packets are dropped based on this probability. The bytemode is used
to drop packets proportional to the packet size.
Additional details can be found in the paper cited below.
......
......@@ -112,7 +112,7 @@ ecn
As mentioned before, RED can either 'mark' or 'drop'. Explicit Congestion
Notification allows RED to notify remote hosts that their rate exceeds the
amount of bandwidth available. Non-ECN capable hosts can only be notified by
dropping a packet. If this parameter is specified, packets which indicate
dropping a packet. If this parameter is specified, packets which indicate
that their hosts honor ECN will only be marked and not dropped, unless the
queue size hits
.B limit
......@@ -156,7 +156,7 @@ Adaptive RED : http://icir.org/floyd/papers/adaptiveRed.pdf
.SH AUTHORS
Alexey N. Kuznetsov, <kuznet@ms2.inr.ac.ru>, Alexey Makarenko
<makar@phoenix.kharkov.ua>, J Hadi Salim <hadi@nortelnetworks.com>,
Eric Dumazet <eric.dumazet@gmail.com>.
Eric Dumazet <eric.dumazet@gmail.com>.
This manpage maintained by bert hubert <ahu@ds9a.nl>
......@@ -35,7 +35,7 @@ tries to determine the ideal marking probability automatically.
The
.B BLUE
algorithm maintains a probability which is used to mark or drop packets
that are to be queued. If the queue overflows, the mark/drop probability
that are to be queued. If the queue overflows, the mark/drop probability
is increased. If the queue becomes empty, the probability is decreased. The
.B Stochastic Fair Blue
(SFB) algorithm is designed to protect TCP flows against non-responsive flows.
......@@ -44,8 +44,8 @@ This SFB implementation maintains 8 levels of 16 bins each for accounting.
Each flow is mapped into a bin of each level using a per-level hash value.
Every bin maintains a marking probability, which gets increased or decreased
based on bin occupancy. If the number of packets exceeds the size of that
bin, the marking probability is increased. If the number drops to zero, it
based on bin occupancy. If the number of packets exceeds the size of that
bin, the marking probability is increased. If the number drops to zero, it
is decreased.
The marking probability is based on the minimum value of all bins a flow is
......@@ -63,7 +63,7 @@ with a non-responsive flow, causing the responsive flow to be misidentified as
being non-responsive.
The probability of a responsive flow to be misidentified is dependent on
the number of non-responsive flows, M. It is (1 - (1 - (1 / 16.0)) ** M) **8,
the number of non-responsive flows, M. It is (1 - (1 - (1 / 16.0)) ** M) **8,
so for example with 10 non-responsive flows approximately 0.2% of responsive flows
will be misidentified.
......@@ -89,7 +89,7 @@ implementation maintains a second set of levels/bins as described in section
4.4 of the SFB reference.
While one set is used to manage the queue, a second set is warmed up:
Whenever a flow is then determined to be non-responsive, the marking
probabilities in the second set are updated. When the rehashing
probabilities in the second set are updated. When the rehashing
happens, these bins will be used to manage the queue and all non-responsive
flows can be rate-limited immediately.
This value determines how much time has to pass before the 2nd set
......@@ -100,19 +100,19 @@ rehash.
.TP
limit
Hard limit on the real (not average) total queue size in packets.
Further packets are dropped. Defaults to the transmit queue length of the
Further packets are dropped. Defaults to the transmit queue length of the
device the qdisc is attached to.
.TP
max
Maximum length of a buckets queue, in packets, before packets start being
dropped. Should be sightly larger than
dropped. Should be sightly larger than
.B target
, but should not be set to values exceeding 1.5 times that of
.B target .
Defaults to 25.
.TP
target
The desired average bin length. If the bin queue length reaches this value,
The desired average bin length. If the bin queue length reaches this value,
the marking probability is increased by
.B increment.
The default value depends on the
......@@ -123,11 +123,11 @@ will default to 20.
.TP
increment
A value used to increase the marking probability when the queue appears
to be over-used. Must be between 0 and 1.0. Defaults to 0.00050.
to be over-used. Must be between 0 and 1.0. Defaults to 0.00050.
.TP
decrement
Value used to decrease the marking probability when the queue is found
to be empty. Must be between 0 and 1.0.
to be empty. Must be between 0 and 1.0.
Defaults to 0.00005.
.TP
penalty_rate
......@@ -153,7 +153,7 @@ The number of packets dropped before a per-flow queue was full.
ratedrop
The number of packets dropped because of rate-limiting.
If this value is high, there are many non-reactive flows being
sent through sfb. In such cases, it might be better to
sent through sfb. In such cases, it might be better to
embed sfb within a classful qdisc to better control such
flows using a different, shaping qdisc.
.TP
......@@ -163,7 +163,7 @@ High bucketdrop may point to a high number of aggressive, short-lived
flows.
.TP
queuedrop
The number of packets dropped due to reaching limit. This should normally be 0.
The number of packets dropped due to reaching limit. This should normally be 0.
.TP
marked
The number of packets marked with ECN.
......@@ -172,7 +172,7 @@ maxqlen
The length of the current longest per-flow (virtual) queue.
.TP
maxprob
The maximum per-flow drop probability. 1 means that some
The maximum per-flow drop probability. 1 means that some
flows have been detected as non-reactive.
.SH NOTES
......
......@@ -150,7 +150,7 @@ ecn
RED can either 'mark' or 'drop'. Explicit Congestion
Notification allows RED to notify remote hosts that their rate exceeds the
amount of bandwidth available. Non-ECN capable hosts can only be notified by
dropping a packet. If this parameter is specified, packets which indicate
dropping a packet. If this parameter is specified, packets which indicate
that their hosts honor ECN will only be marked and not dropped, unless the
queue size hits
.B depth
......
......@@ -102,7 +102,7 @@ Furthermore, if a peakrate is desired, the following parameters are available:
.TP
peakrate
Maximum depletion rate of the bucket. The peakrate does not
Maximum depletion rate of the bucket. The peakrate does not
need to be set, it is only necessary if perfect millisecond timescale
shaping is required.
......
......@@ -21,6 +21,7 @@
#include <arpa/inet.h>
#include <string.h>
#include <math.h>
#include <errno.h>
#include "utils.h"
#include "names.h"
......@@ -33,15 +34,25 @@
static struct db_names *cls_names = NULL;
#define NAMES_DB "/etc/iproute2/cls_names"
#define NAMES_DB "/etc/iproute2/tc_cls"
int cls_names_init(char *path)
{
cls_names = db_names_alloc(path ?: NAMES_DB);
if (!cls_names) {
fprintf(stderr, "Error while opening class names file\n");
int ret;
cls_names = db_names_alloc();
if (!cls_names)
return -1;
ret = db_names_load(cls_names, path ?: NAMES_DB);
if (ret == -ENOENT && path) {
fprintf(stderr, "Can't open class names file: %s\n", path);
return -1;
}
if (ret) {
db_names_free(cls_names);
cls_names = NULL;
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment