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
bd733e40
Commit
bd733e40
authored
Apr 07, 2015
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into net-next
Conflicts: man/man8/ip-route.8.in
parents
194e9b85
a89d5329
Changes
32
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
236 additions
and
179 deletions
+236
-179
include/names.h
include/names.h
+2
-1
ip/iplink.c
ip/iplink.c
+1
-1
lib/names.c
lib/names.c
+43
-16
man/man8/arpd.8
man/man8/arpd.8
+1
-1
man/man8/bridge.8
man/man8/bridge.8
+30
-30
man/man8/ip-address.8.in
man/man8/ip-address.8.in
+7
-7
man/man8/ip-addrlabel.8
man/man8/ip-addrlabel.8
+1
-1
man/man8/ip-link.8.in
man/man8/ip-link.8.in
+19
-7
man/man8/ip-maddress.8
man/man8/ip-maddress.8
+1
-1
man/man8/ip-monitor.8
man/man8/ip-monitor.8
+2
-2
man/man8/ip-mroute.8
man/man8/ip-mroute.8
+1
-1
man/man8/ip-neighbour.8
man/man8/ip-neighbour.8
+3
-3
man/man8/ip-netns.8
man/man8/ip-netns.8
+13
-7
man/man8/ip-route.8.in
man/man8/ip-route.8.in
+37
-37
man/man8/ip-rule.8
man/man8/ip-rule.8
+13
-13
man/man8/ip-tunnel.8
man/man8/ip-tunnel.8
+4
-4
man/man8/ip.8
man/man8/ip.8
+5
-5
man/man8/rtmon.8
man/man8/rtmon.8
+1
-1
man/man8/tc-cbq-details.8
man/man8/tc-cbq-details.8
+2
-2
man/man8/tc-cbq.8
man/man8/tc-cbq.8
+2
-2
man/man8/tc-choke.8
man/man8/tc-choke.8
+3
-3
man/man8/tc-codel.8
man/man8/tc-codel.8
+2
-2
man/man8/tc-drr.8
man/man8/tc-drr.8
+5
-5
man/man8/tc-fq_codel.8
man/man8/tc-fq_codel.8
+3
-3
man/man8/tc-hfsc.8
man/man8/tc-hfsc.8
+1
-1
man/man8/tc-netem.8
man/man8/tc-netem.8
+1
-1
man/man8/tc-pie.8
man/man8/tc-pie.8
+1
-1
man/man8/tc-red.8
man/man8/tc-red.8
+2
-2
man/man8/tc-sfb.8
man/man8/tc-sfb.8
+13
-13
man/man8/tc-sfq.8
man/man8/tc-sfq.8
+1
-1
man/man8/tc-tbf.8
man/man8/tc-tbf.8
+1
-1
tc/tc_util.c
tc/tc_util.c
+15
-4
No files found.
include/names.h
View file @
bd733e40
...
@@ -16,7 +16,8 @@ struct db_names {
...
@@ -16,7 +16,8 @@ struct db_names {
int
max
;
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
);
void
db_names_free
(
struct
db_names
*
db
);
char
*
id_to_name
(
struct
db_names
*
db
,
int
id
,
char
*
name
);
char
*
id_to_name
(
struct
db_names
*
db
,
int
id
,
char
*
name
);
...
...
ip/iplink.c
View file @
bd733e40
lib/names.c
View file @
bd733e40
...
@@ -11,8 +11,10 @@
...
@@ -11,8 +11,10 @@
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
#include <errno.h>
#include "names.h"
#include "names.h"
#include "utils.h"
#define MAX_ENTRIES 256
#define MAX_ENTRIES 256
#define NAME_MAX_LEN 512
#define NAME_MAX_LEN 512
...
@@ -48,48 +50,65 @@ static int read_id_name(FILE *fp, int *id, char *name)
...
@@ -48,48 +50,65 @@ static int read_id_name(FILE *fp, int *id, char *name)
return
0
;
return
0
;
}
}
struct
db_names
*
db_names_alloc
(
const
char
*
path
)
struct
db_names
*
db_names_alloc
(
void
)
{
{
struct
db_names
*
db
;
struct
db_names
*
db
;
struct
db_entry
*
entry
;
FILE
*
fp
;
int
id
;
char
namebuf
[
NAME_MAX_LEN
]
=
{
0
};
int
ret
;
fp
=
fopen
(
path
,
"r"
);
db
=
malloc
(
sizeof
(
*
db
));
if
(
!
fp
)
{
if
(
!
db
)
fprintf
(
stderr
,
"Can't open file: %s
\n
"
,
path
);
return
NULL
;
return
NULL
;
}
db
=
malloc
(
sizeof
(
*
db
));
memset
(
db
,
0
,
sizeof
(
*
db
));
memset
(
db
,
0
,
sizeof
(
*
db
));
db
->
size
=
MAX_ENTRIES
;
db
->
size
=
MAX_ENTRIES
;
db
->
hash
=
malloc
(
sizeof
(
struct
db_entry
*
)
*
db
->
size
);
db
->
hash
=
malloc
(
sizeof
(
struct
db_entry
*
)
*
db
->
size
);
memset
(
db
->
hash
,
0
,
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
])))
{
while
((
ret
=
read_id_name
(
fp
,
&
id
,
&
namebuf
[
0
])))
{
if
(
ret
==
-
1
)
{
if
(
ret
==
-
1
)
{
fprintf
(
stderr
,
"Database %s is corrupted at %s
\n
"
,
fprintf
(
stderr
,
"Database %s is corrupted at %s
\n
"
,
path
,
namebuf
);
path
,
namebuf
);
fclose
(
fp
);
goto
Exit
;
return
NULL
;
}
}
ret
=
-
1
;
if
(
id
<
0
)
if
(
id
<
0
)
continue
;
continue
;
entry
=
malloc
(
sizeof
(
*
entry
));
entry
=
malloc
(
sizeof
(
*
entry
));
entry
->
id
=
id
;
if
(
!
entry
)
goto
Exit
;
entry
->
name
=
strdup
(
namebuf
);
entry
->
name
=
strdup
(
namebuf
);
if
(
!
entry
->
name
)
{
free
(
entry
);
goto
Exit
;
}
entry
->
id
=
id
;
entry
->
next
=
db
->
hash
[
id
&
(
db
->
size
-
1
)];
entry
->
next
=
db
->
hash
[
id
&
(
db
->
size
-
1
)];
db
->
hash
[
id
&
(
db
->
size
-
1
)]
=
entry
;
db
->
hash
[
id
&
(
db
->
size
-
1
)]
=
entry
;
}
}
ret
=
0
;
Exit:
fclose
(
fp
);
fclose
(
fp
);
return
db
;
return
ret
;
}
}
void
db_names_free
(
struct
db_names
*
db
)
void
db_names_free
(
struct
db_names
*
db
)
...
@@ -117,8 +136,12 @@ 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
)
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
)
while
(
entry
&&
entry
->
id
!=
id
)
entry
=
entry
->
next
;
entry
=
entry
->
next
;
...
@@ -136,6 +159,9 @@ int name_to_id(struct db_names *db, int *id, const char *name)
...
@@ -136,6 +159,9 @@ int name_to_id(struct db_names *db, int *id, const char *name)
struct
db_entry
*
entry
;
struct
db_entry
*
entry
;
int
i
;
int
i
;
if
(
!
db
)
return
-
1
;
if
(
db
->
cached
&&
strcmp
(
db
->
cached
->
name
,
name
)
==
0
)
{
if
(
db
->
cached
&&
strcmp
(
db
->
cached
->
name
,
name
)
==
0
)
{
*
id
=
db
->
cached
->
id
;
*
id
=
db
->
cached
->
id
;
return
0
;
return
0
;
...
@@ -145,6 +171,7 @@ int name_to_id(struct db_names *db, int *id, const char *name)
...
@@ -145,6 +171,7 @@ int name_to_id(struct db_names *db, int *id, const char *name)
entry
=
db
->
hash
[
i
];
entry
=
db
->
hash
[
i
];
while
(
entry
&&
strcmp
(
entry
->
name
,
name
))
while
(
entry
&&
strcmp
(
entry
->
name
,
name
))
entry
=
entry
->
next
;
entry
=
entry
->
next
;
if
(
entry
)
{
if
(
entry
)
{
db
->
cached
=
entry
;
db
->
cached
=
entry
;
*
id
=
entry
->
id
;
*
id
=
entry
->
id
;
...
...
man/man8/arpd.8
View file @
bd733e40
man/man8/bridge.8
View file @
bd733e40
man/man8/ip-address.8.in
View file @
bd733e40
man/man8/ip-addrlabel.8
View file @
bd733e40
man/man8/ip-link.8.in
View file @
bd733e40
...
@@ -72,7 +72,10 @@ ip-link \- network device configuration
...
@@ -72,7 +72,10 @@ ip-link \- network device configuration
.BR gre " |"
.BR gre " |"
.BR gretap " |"
.BR gretap " |"
.BR ip6gre " |"
.BR ip6gre " |"
.BR ip6gretap " ]"
.BR ip6gretap " |"
.BR vti " |"
.BR nlmon " |"
.BR ipvlan " ]"
.ti -8
.ti -8
.BI "ip link delete " DEVICE
.BI "ip link delete " DEVICE
...
@@ -228,6 +231,15 @@ Link types:
...
@@ -228,6 +231,15 @@ Link types:
.sp
.sp
.BR ip6gretap
.BR ip6gretap
- Virtual L2 tunnel interface GRE over IPv6
- 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
.in -8
.TP
.TP
...
...
man/man8/ip-maddress.8
View file @
bd733e40
man/man8/ip-monitor.8
View file @
bd733e40
man/man8/ip-mroute.8
View file @
bd733e40
man/man8/ip-neighbour.8
View file @
bd733e40
man/man8/ip-netns.8
View file @
bd733e40
...
@@ -116,12 +116,18 @@ $ ip netns exec net0 SOME_PROCESS_IN_BACKGROUND
...
@@ -116,12 +116,18 @@ $ ip netns exec net0 SOME_PROCESS_IN_BACKGROUND
$ ip netns del net0
$ ip netns del net0
.RE
.RE
.RS
and eth0 will appear in the default netns only after SOME_PROCESS_IN_BACKGROUND
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
will exit or will be killed. To prevent this the processes running in net0
should be killed before deleting the netns:
should be killed before deleting the netns:
$ ip netns pids net0 | xargs kill
.RE
$ ip netns del net0
.RS 10
$ ip netns pids net0 | xargs kill
.RE
.RS 10
$ ip netns del net0
.RE
.TP
.TP
.B ip netns set NAME NETNSID - assign an id to a peer network namespace
.B ip netns set NAME NETNSID - assign an id to a peer network namespace
...
...
man/man8/ip-route.8.in
View file @
bd733e40
man/man8/ip-rule.8
View file @
bd733e40
man/man8/ip-tunnel.8
View file @
bd733e40
man/man8/ip.8
View file @
bd733e40
man/man8/rtmon.8
View file @
bd733e40
man/man8/tc-cbq-details.8
View file @
bd733e40
man/man8/tc-cbq.8
View file @
bd733e40
man/man8/tc-choke.8
View file @
bd733e40
man/man8/tc-codel.8
View file @
bd733e40
man/man8/tc-drr.8
View file @
bd733e40
man/man8/tc-fq_codel.8
View file @
bd733e40
man/man8/tc-hfsc.8
View file @
bd733e40
man/man8/tc-netem.8
View file @
bd733e40
man/man8/tc-pie.8
View file @
bd733e40
man/man8/tc-red.8
View file @
bd733e40
man/man8/tc-sfb.8
View file @
bd733e40
man/man8/tc-sfq.8
View file @
bd733e40
man/man8/tc-tbf.8
View file @
bd733e40
tc/tc_util.c
View file @
bd733e40
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <string.h>
#include <string.h>
#include <math.h>
#include <math.h>
#include <errno.h>
#include "utils.h"
#include "utils.h"
#include "names.h"
#include "names.h"
...
@@ -33,15 +34,25 @@
...
@@ -33,15 +34,25 @@
static
struct
db_names
*
cls_names
=
NULL
;
static
struct
db_names
*
cls_names
=
NULL
;
#define NAMES_DB "/etc/iproute2/
cls_name
s"
#define NAMES_DB "/etc/iproute2/
tc_cl
s"
int
cls_names_init
(
char
*
path
)
int
cls_names_init
(
char
*
path
)
{
{
cls_names
=
db_names_alloc
(
path
?:
NAMES_DB
);
int
ret
;
if
(
!
cls_names
)
{
fprintf
(
stderr
,
"Error while opening class names file
\n
"
);
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
;
return
-
1
;
}
}
if
(
ret
)
{
db_names_free
(
cls_names
);
cls_names
=
NULL
;
}
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