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
ef056b21
Commit
ef056b21
authored
Jan 09, 2014
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into net-next-for-3.13
parents
a4c51eb3
4de8d885
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
241 additions
and
77 deletions
+241
-77
examples/cbq.init-v0.7.3
examples/cbq.init-v0.7.3
+1
-2
include/libnetlink.h
include/libnetlink.h
+20
-8
include/utils.h
include/utils.h
+1
-1
ip/Makefile
ip/Makefile
+1
-1
ip/ip6tunnel.c
ip/ip6tunnel.c
+1
-2
ip/ipaddrlabel.c
ip/ipaddrlabel.c
+1
-2
ip/iplink.c
ip/iplink.c
+13
-4
ip/iplink_hsr.c
ip/iplink_hsr.c
+129
-0
ip/ipnetconf.c
ip/ipnetconf.c
+4
-1
ip/ipntable.c
ip/ipntable.c
+1
-2
ip/ipprefix.c
ip/ipprefix.c
+1
-2
ip/iptunnel.c
ip/iptunnel.c
+3
-2
ip/ipxfrm.c
ip/ipxfrm.c
+1
-2
ip/link_veth.c
ip/link_veth.c
+14
-2
ip/tunnel.c
ip/tunnel.c
+1
-2
ip/tunnel.h
ip/tunnel.h
+1
-2
ip/xfrm.h
ip/xfrm.h
+1
-2
ip/xfrm_monitor.c
ip/xfrm_monitor.c
+1
-2
ip/xfrm_policy.c
ip/xfrm_policy.c
+1
-2
ip/xfrm_state.c
ip/xfrm_state.c
+1
-2
man/man8/ip-link.8.in
man/man8/ip-link.8.in
+7
-0
misc/arpd.c
misc/arpd.c
+5
-1
misc/ss.c
misc/ss.c
+3
-1
tc/m_action.c
tc/m_action.c
+2
-3
tc/m_police.c
tc/m_police.c
+2
-3
tc/m_simple.c
tc/m_simple.c
+1
-1
tc/m_skbedit.c
tc/m_skbedit.c
+9
-3
tc/q_multiq.c
tc/q_multiq.c
+2
-3
tc/tc_util.c
tc/tc_util.c
+13
-19
No files found.
examples/cbq.init-v0.7.3
View file @
ef056b21
...
...
@@ -18,8 +18,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# To get the latest version, check on Freshmeat for actual location:
#
...
...
include/libnetlink.h
View file @
ef056b21
...
...
@@ -22,13 +22,22 @@ struct rtnl_handle
extern
int
rcvbuf
;
extern
int
rtnl_open
(
struct
rtnl_handle
*
rth
,
unsigned
subscriptions
);
extern
int
rtnl_open_byproto
(
struct
rtnl_handle
*
rth
,
unsigned
subscriptions
,
int
protocol
);
extern
int
rtnl_open
(
struct
rtnl_handle
*
rth
,
unsigned
subscriptions
)
__attribute__
((
warn_unused_result
));
extern
int
rtnl_open_byproto
(
struct
rtnl_handle
*
rth
,
unsigned
subscriptions
,
int
protocol
)
__attribute__
((
warn_unused_result
));
extern
void
rtnl_close
(
struct
rtnl_handle
*
rth
);
extern
int
rtnl_wilddump_request
(
struct
rtnl_handle
*
rth
,
int
fam
,
int
type
);
extern
int
rtnl_wilddump_request
(
struct
rtnl_handle
*
rth
,
int
fam
,
int
type
)
__attribute__
((
warn_unused_result
));
extern
int
rtnl_wilddump_req_filter
(
struct
rtnl_handle
*
rth
,
int
fam
,
int
type
,
__u32
filt_mask
);
extern
int
rtnl_dump_request
(
struct
rtnl_handle
*
rth
,
int
type
,
void
*
req
,
int
len
);
__u32
filt_mask
)
__attribute__
((
warn_unused_result
));
extern
int
rtnl_dump_request
(
struct
rtnl_handle
*
rth
,
int
type
,
void
*
req
,
int
len
)
__attribute__
((
warn_unused_result
));
typedef
int
(
*
rtnl_filter_t
)(
const
struct
sockaddr_nl
*
,
struct
nlmsghdr
*
n
,
void
*
);
...
...
@@ -44,9 +53,12 @@ extern int rtnl_dump_filter_l(struct rtnl_handle *rth,
extern
int
rtnl_dump_filter
(
struct
rtnl_handle
*
rth
,
rtnl_filter_t
filter
,
void
*
arg
);
extern
int
rtnl_talk
(
struct
rtnl_handle
*
rtnl
,
struct
nlmsghdr
*
n
,
pid_t
peer
,
unsigned
groups
,
struct
nlmsghdr
*
answer
);
extern
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
);
extern
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
);
unsigned
groups
,
struct
nlmsghdr
*
answer
)
__attribute__
((
warn_unused_result
));
extern
int
rtnl_send
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
)
__attribute__
((
warn_unused_result
));
extern
int
rtnl_send_check
(
struct
rtnl_handle
*
rth
,
const
void
*
buf
,
int
)
__attribute__
((
warn_unused_result
));
extern
int
addattr
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
);
extern
int
addattr8
(
struct
nlmsghdr
*
n
,
int
maxlen
,
int
type
,
__u8
data
);
...
...
include/utils.h
View file @
ef056b21
...
...
@@ -156,5 +156,5 @@ extern int inet_get_addr(const char *src, __u32 *dst, struct in6_addr *dst6);
struct
iplink_req
;
int
iplink_parse
(
int
argc
,
char
**
argv
,
struct
iplink_req
*
req
,
char
**
name
,
char
**
type
,
char
**
link
,
char
**
dev
,
int
*
group
);
int
*
group
,
int
*
index
);
#endif
/* __UTILS_H__ */
ip/Makefile
View file @
ef056b21
...
...
@@ -5,7 +5,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
iplink_vlan.o link_veth.o link_gre.o iplink_can.o
\
iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o
\
iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o
\
link_iptnl.o link_gre6.o iplink_bond.o
link_iptnl.o link_gre6.o iplink_bond.o
iplink_hsr.o
RTMONOBJ
=
rtmon.o
...
...
ip/ip6tunnel.c
View file @
ef056b21
...
...
@@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* Author:
...
...
ip/ipaddrlabel.c
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Based on iprule.c.
...
...
ip/iplink.c
View file @
ef056b21
...
...
@@ -47,7 +47,7 @@ void iplink_usage(void)
fprintf
(
stderr
,
" [ txqueuelen PACKETS ]
\n
"
);
fprintf
(
stderr
,
" [ address LLADDR ]
\n
"
);
fprintf
(
stderr
,
" [ broadcast LLADDR ]
\n
"
);
fprintf
(
stderr
,
" [ mtu MTU ]
\n
"
);
fprintf
(
stderr
,
" [ mtu MTU ]
[index IDX ]
\n
"
);
fprintf
(
stderr
,
" [ numtxqueues QUEUE_COUNT ]
\n
"
);
fprintf
(
stderr
,
" [ numrxqueues QUEUE_COUNT ]
\n
"
);
fprintf
(
stderr
,
" type TYPE [ ARGS ]
\n
"
);
...
...
@@ -178,7 +178,10 @@ static int iplink_have_newlink(void)
req
.
n
.
nlmsg_type
=
RTM_NEWLINK
;
req
.
i
.
ifi_family
=
AF_UNSPEC
;
rtnl_send
(
&
rth
,
&
req
.
n
,
req
.
n
.
nlmsg_len
);
if
(
rtnl_send
(
&
rth
,
&
req
.
n
,
req
.
n
.
nlmsg_len
)
<
0
)
{
perror
(
"request send failed"
);
exit
(
1
);
}
rtnl_listen
(
&
rth
,
accept_msg
,
NULL
);
}
return
have_rtnl_newlink
;
...
...
@@ -288,7 +291,7 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp,
}
int
iplink_parse
(
int
argc
,
char
**
argv
,
struct
iplink_req
*
req
,
char
**
name
,
char
**
type
,
char
**
link
,
char
**
dev
,
int
*
group
)
char
**
name
,
char
**
type
,
char
**
link
,
char
**
dev
,
int
*
group
,
int
*
index
)
{
int
ret
,
len
;
char
abuf
[
32
];
...
...
@@ -312,6 +315,9 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
}
else
if
(
strcmp
(
*
argv
,
"name"
)
==
0
)
{
NEXT_ARG
();
*
name
=
*
argv
;
}
else
if
(
strcmp
(
*
argv
,
"index"
)
==
0
)
{
NEXT_ARG
();
*
index
=
atoi
(
*
argv
);
}
else
if
(
matches
(
*
argv
,
"link"
)
==
0
)
{
NEXT_ARG
();
*
link
=
*
argv
;
...
...
@@ -503,6 +509,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
char
*
name
=
NULL
;
char
*
link
=
NULL
;
char
*
type
=
NULL
;
int
index
=
0
;
int
group
;
struct
link_util
*
lu
=
NULL
;
struct
iplink_req
req
;
...
...
@@ -515,7 +522,7 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
req
.
n
.
nlmsg_type
=
cmd
;
req
.
i
.
ifi_family
=
preferred_family
;
ret
=
iplink_parse
(
argc
,
argv
,
&
req
,
&
name
,
&
type
,
&
link
,
&
dev
,
&
group
);
ret
=
iplink_parse
(
argc
,
argv
,
&
req
,
&
name
,
&
type
,
&
link
,
&
dev
,
&
group
,
&
index
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -575,6 +582,8 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
}
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
IFLA_LINK
,
&
ifindex
,
4
);
}
req
.
i
.
ifi_index
=
index
;
}
if
(
name
)
{
...
...
ip/iplink_hsr.c
0 → 100644
View file @
ef056b21
/*
* iplink_hsr.c HSR device support
*
* 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 the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Authors: Arvid Brodin <arvid.brodin@alten.se>
*
* Based on iplink_vlan.c by Patrick McHardy <kaber@trash.net>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
/* Needed by linux/if.h for some reason */
#include <linux/if.h>
#include <linux/if_arp.h>
#include "rt_names.h"
#include "utils.h"
#include "ip_common.h"
static
void
usage
(
void
)
{
fprintf
(
stderr
,
"Usage:
\t
ip link add name NAME type hsr slave1 SLAVE1-IF slave2 SLAVE2-IF
\n
"
"
\t
[ supervision ADDR-BYTE ]
\n
"
"
\n
"
"NAME
\n
"
" name of new hsr device (e.g. hsr0)
\n
"
"SLAVE1-IF, SLAVE2-IF
\n
"
" the two slave devices bound to the HSR device
\n
"
"ADDR-BYTE
\n
"
" 0-255; the last byte of the multicast address used for HSR supervision
\n
"
" frames (default = 0)
\n
"
);
}
static
int
hsr_parse_opt
(
struct
link_util
*
lu
,
int
argc
,
char
**
argv
,
struct
nlmsghdr
*
n
)
{
int
ifindex
;
unsigned
char
multicast_spec
;
while
(
argc
>
0
)
{
if
(
matches
(
*
argv
,
"supervision"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u8
(
&
multicast_spec
,
*
argv
,
0
))
invarg
(
"ADDR-BYTE is invalid"
,
*
argv
);
addattr_l
(
n
,
1024
,
IFLA_HSR_MULTICAST_SPEC
,
&
multicast_spec
,
1
);
}
else
if
(
matches
(
*
argv
,
"slave1"
)
==
0
)
{
NEXT_ARG
();
ifindex
=
ll_name_to_index
(
*
argv
);
if
(
ifindex
==
0
)
invarg
(
"No such interface"
,
*
argv
);
addattr_l
(
n
,
1024
,
IFLA_HSR_SLAVE1
,
&
ifindex
,
4
);
}
else
if
(
matches
(
*
argv
,
"slave2"
)
==
0
)
{
NEXT_ARG
();
ifindex
=
ll_name_to_index
(
*
argv
);
if
(
ifindex
==
0
)
invarg
(
"No such interface"
,
*
argv
);
addattr_l
(
n
,
1024
,
IFLA_HSR_SLAVE2
,
&
ifindex
,
4
);
}
else
if
(
matches
(
*
argv
,
"help"
)
==
0
)
{
usage
();
return
-
1
;
}
else
{
fprintf
(
stderr
,
"hsr: what is
\"
%s
\"
?
\n
"
,
*
argv
);
usage
();
return
-
1
;
}
argc
--
,
argv
++
;
}
return
0
;
}
static
void
hsr_print_opt
(
struct
link_util
*
lu
,
FILE
*
f
,
struct
rtattr
*
tb
[])
{
SPRINT_BUF
(
b1
);
if
(
!
tb
)
return
;
if
(
tb
[
IFLA_HSR_SLAVE1
]
&&
RTA_PAYLOAD
(
tb
[
IFLA_HSR_SLAVE1
])
<
sizeof
(
__u32
))
return
;
if
(
tb
[
IFLA_HSR_SLAVE2
]
&&
RTA_PAYLOAD
(
tb
[
IFLA_HSR_SLAVE2
])
<
sizeof
(
__u32
))
return
;
if
(
tb
[
IFLA_HSR_SEQ_NR
]
&&
RTA_PAYLOAD
(
tb
[
IFLA_HSR_SEQ_NR
])
<
sizeof
(
__u16
))
return
;
if
(
tb
[
IFLA_HSR_SUPERVISION_ADDR
]
&&
RTA_PAYLOAD
(
tb
[
IFLA_HSR_SUPERVISION_ADDR
])
<
ETH_ALEN
)
return
;
fprintf
(
f
,
"slave1 "
);
if
(
tb
[
IFLA_HSR_SLAVE1
])
fprintf
(
f
,
"%s "
,
ll_index_to_name
(
rta_getattr_u32
(
tb
[
IFLA_HSR_SLAVE1
])));
else
fprintf
(
f
,
"<none> "
);
fprintf
(
f
,
"slave2 "
);
if
(
tb
[
IFLA_HSR_SLAVE2
])
fprintf
(
f
,
"%s "
,
ll_index_to_name
(
rta_getattr_u32
(
tb
[
IFLA_HSR_SLAVE2
])));
else
fprintf
(
f
,
"<none> "
);
if
(
tb
[
IFLA_HSR_SEQ_NR
])
fprintf
(
f
,
"sequence %d "
,
rta_getattr_u16
(
tb
[
IFLA_HSR_SEQ_NR
]));
if
(
tb
[
IFLA_HSR_SUPERVISION_ADDR
])
fprintf
(
f
,
"supervision %s "
,
ll_addr_n2a
(
RTA_DATA
(
tb
[
IFLA_HSR_SUPERVISION_ADDR
]),
RTA_PAYLOAD
(
tb
[
IFLA_HSR_SUPERVISION_ADDR
]),
ARPHRD_VOID
,
b1
,
sizeof
(
b1
)));
}
struct
link_util
hsr_link_util
=
{
.
id
=
"hsr"
,
.
maxattr
=
IFLA_VLAN_MAX
,
.
parse_opt
=
hsr_parse_opt
,
.
print_opt
=
hsr_print_opt
,
};
ip/ipnetconf.c
View file @
ef056b21
...
...
@@ -165,7 +165,10 @@ static int do_show(int argc, char **argv)
addattr_l
(
&
req
.
n
,
sizeof
(
req
),
NETCONFA_IFINDEX
,
&
filter
.
ifindex
,
sizeof
(
filter
.
ifindex
));
rtnl_send
(
&
rth
,
&
req
.
n
,
req
.
n
.
nlmsg_len
);
if
(
rtnl_send
(
&
rth
,
&
req
.
n
,
req
.
n
.
nlmsg_len
)
<
0
)
{
perror
(
"Can not send request"
);
exit
(
1
);
}
rtnl_listen
(
&
rth
,
print_netconf
,
stdout
);
}
else
{
dump:
...
...
ip/ipntable.c
View file @
ef056b21
...
...
@@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on ipneigh.c
...
...
ip/ipprefix.c
View file @
ef056b21
...
...
@@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on ip.c, iproute.c
...
...
ip/iptunnel.c
View file @
ef056b21
...
...
@@ -240,8 +240,9 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
}
}
if
(
p
->
iph
.
protocol
==
IPPROTO_IPIP
||
p
->
iph
.
protocol
==
IPPROTO_IPV6
)
{
if
((
p
->
i_flags
&
GRE_KEY
)
||
(
p
->
o_flags
&
GRE_KEY
))
{
if
((
p
->
i_flags
&
GRE_KEY
)
||
(
p
->
o_flags
&
GRE_KEY
))
{
if
(
!
(
p
->
i_flags
&
VTI_ISVTI
)
&&
(
p
->
iph
.
protocol
!=
IPPROTO_GRE
))
{
fprintf
(
stderr
,
"Keys are not allowed with ipip and sit tunnels
\n
"
);
return
-
1
;
}
...
...
ip/ipxfrm.c
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on ip.c, iproute.c
...
...
ip/link_veth.c
View file @
ef056b21
...
...
@@ -26,7 +26,11 @@ static void usage(void)
static
int
veth_parse_opt
(
struct
link_util
*
lu
,
int
argc
,
char
**
argv
,
struct
nlmsghdr
*
hdr
)
{
char
*
name
,
*
type
,
*
link
,
*
dev
;
char
*
dev
=
NULL
;
char
*
name
=
NULL
;
char
*
link
=
NULL
;
char
*
type
=
NULL
;
int
index
=
0
;
int
err
,
len
;
struct
rtattr
*
data
;
int
group
;
...
...
@@ -42,7 +46,7 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
hdr
->
nlmsg_len
+=
sizeof
(
struct
ifinfomsg
);
err
=
iplink_parse
(
argc
-
1
,
argv
+
1
,
(
struct
iplink_req
*
)
hdr
,
&
name
,
&
type
,
&
link
,
&
dev
,
&
group
);
&
name
,
&
type
,
&
link
,
&
dev
,
&
group
,
&
index
);
if
(
err
<
0
)
return
err
;
...
...
@@ -53,6 +57,14 @@ static int veth_parse_opt(struct link_util *lu, int argc, char **argv,
addattr_l
(
hdr
,
1024
,
IFLA_IFNAME
,
name
,
len
);
}
if
(
index
)
{
struct
ifinfomsg
*
ifi
=
(
struct
ifinfomsg
*
)(
data
+
1
);
ifi
->
ifi_index
=
index
;
}
if
(
group
!=
-
1
)
addattr32
(
hdr
,
1024
,
IFLA_GROUP
,
group
);
data
->
rta_len
=
(
void
*
)
NLMSG_TAIL
(
hdr
)
-
(
void
*
)
data
;
return
argc
-
1
-
err
;
}
...
...
ip/tunnel.c
View file @
ef056b21
...
...
@@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* split from ip_tunnel.c
...
...
ip/tunnel.h
View file @
ef056b21
...
...
@@ -12,8 +12,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* Author:
...
...
ip/xfrm.h
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* Authors:
...
...
ip/xfrm_monitor.c
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on ipmonitor.c
...
...
ip/xfrm_policy.c
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on iproute.c
...
...
ip/xfrm_state.c
View file @
ef056b21
...
...
@@ -14,8 +14,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* along with this program; if not, see <http://www.gnu.org/licenses>.
*/
/*
* based on iproute.c
...
...
man/man8/ip-link.8.in
View file @
ef056b21
...
...
@@ -39,6 +39,8 @@ ip-link \- network device configuration
.br
.RB "[ " mtu
.IR MTU " ]"
.RB "[ " index
.IR IDX " ]"
.br
.RB "[ " numtxqueues
.IR QUEUE_COUNT " ]"
...
...
@@ -54,6 +56,7 @@ ip-link \- network device configuration
.BR bond " ]"
.BR can " | "
.BR dummy " | "
.BR hsr " | "
.BR ifb " | "
.BR ipoib " |"
.BR macvlan " | "
...
...
@@ -216,6 +219,10 @@ specifies the number of transmit queues for new device.
.BI numrxqueues " QUEUE_COUNT "
specifies the number of receive queues for new device.
.TP
.BI index " IDX "
specifies the desired index of the new virtual device. The link creation fails, if the index is busy.
.TP
VXLAN Type Support
For a link of type
...
...
misc/arpd.c
View file @
ef056b21
...
...
@@ -428,7 +428,11 @@ static int do_one_request(struct nlmsghdr *n)
static
void
load_initial_table
(
void
)
{
rtnl_wilddump_request
(
&
rth
,
AF_INET
,
RTM_GETNEIGH
);
if
(
rtnl_wilddump_request
(
&
rth
,
AF_INET
,
RTM_GETNEIGH
)
<
0
)
{
perror
(
"dump request failed"
);
exit
(
1
);
}
}
static
void
get_kern_msg
(
void
)
...
...
misc/ss.c
View file @
ef056b21
...
...
@@ -996,7 +996,9 @@ static int xll_initted = 0;
static
void
xll_init
(
void
)
{
struct
rtnl_handle
rth
;
rtnl_open
(
&
rth
,
0
);
if
(
rtnl_open
(
&
rth
,
0
)
<
0
)
exit
(
1
);
ll_init_map
(
&
rth
);
rtnl_close
(
&
rth
);
xll_initted
=
1
;
...
...
tc/m_action.c
View file @
ef056b21
...
...
@@ -32,7 +32,6 @@ static struct action_util * action_list;
#ifdef CONFIG_GACT
int
gact_ld
=
0
;
//fuckin backward compatibility
#endif
int
batch_c
=
0
;
int
tab_flush
=
0
;
static
void
act_usage
(
void
)
...
...
@@ -144,6 +143,7 @@ new_cmd(char **argv)
if
((
matches
(
*
argv
,
"change"
)
==
0
)
||
(
matches
(
*
argv
,
"replace"
)
==
0
)
||
(
matches
(
*
argv
,
"delete"
)
==
0
)
||
(
matches
(
*
argv
,
"get"
)
==
0
)
||
(
matches
(
*
argv
,
"add"
)
==
0
))
return
1
;
...
...
@@ -303,7 +303,7 @@ tc_print_action(FILE * f, const struct rtattr *arg)
for
(
i
=
0
;
i
<
TCA_ACT_MAX_PRIO
;
i
++
)
{
if
(
tb
[
i
])
{
fprintf
(
f
,
"
\n\t
action order %d: "
,
i
+
batch_c
);
fprintf
(
f
,
"
\n\t
action order %d: "
,
i
);
if
(
0
>
tc_print_one_action
(
f
,
tb
[
i
]))
{
fprintf
(
f
,
"Error printing action
\n
"
);
}
...
...
@@ -311,7 +311,6 @@ tc_print_action(FILE * f, const struct rtattr *arg)
}
batch_c
+=
TCA_ACT_MAX_PRIO
;
return
0
;
}
...
...
tc/m_police.c
View file @
ef056b21
...
...
@@ -38,7 +38,6 @@ static void usage(void)
fprintf
(
stderr
,
" [ peakrate BPS ] [ avrate BPS ] [ overhead BYTES ]
\n
"
);
fprintf
(
stderr
,
" [ linklayer TYPE ] [ ACTIONTERM ]
\n
"
);
fprintf
(
stderr
,
"Old Syntax ACTIONTERM := action <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
fprintf
(
stderr
,
"New Syntax ACTIONTERM := conform-exceed <EXCEEDACT>[/NOTEXCEEDACT]
\n
"
);
fprintf
(
stderr
,
"Where: *EXCEEDACT := pipe | ok | reclassify | drop | continue
\n
"
);
fprintf
(
stderr
,
"Where: pipe is only valid for new syntax
\n
"
);
...
...
@@ -150,6 +149,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
while
(
argc
>
0
)
{
fprintf
(
stderr
,
"police argc %d argv %s
\n
"
,
argc
,
*
argv
);
if
(
matches
(
*
argv
,
"index"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u32
(
&
p
.
index
,
*
argv
,
10
))
{
...
...
@@ -230,8 +230,7 @@ int act_parse_police(struct action_util *a,int *argc_p, char ***argv_p, int tca_
p
.
action
=
TC_POLICE_OK
;
}
else
if
(
matches
(
*
argv
,
"pipe"
)
==
0
)
{
p
.
action
=
TC_POLICE_PIPE
;
}
else
if
(
strcmp
(
*
argv
,
"action"
)
==
0
||
strcmp
(
*
argv
,
"conform-exceed"
)
==
0
)
{
}
else
if
(
strcmp
(
*
argv
,
"conform-exceed"
)
==
0
)
{
NEXT_ARG
();
if
(
get_police_result
(
&
p
.
action
,
&
presult
,
*
argv
))
{
fprintf
(
stderr
,
"Illegal
\"
action
\"\n
"
);
...
...
tc/m_simple.c
View file @
ef056b21
...
...
@@ -188,9 +188,9 @@ static int print_simple(struct action_util *au, FILE * f, struct rtattr *arg)
if
(
tb
[
TCA_DEF_TM
])
{
struct
tcf_t
*
tm
=
RTA_DATA
(
tb
[
TCA_DEF_TM
]);
print_tm
(
f
,
tm
);
fprintf
(
f
,
"
\n
"
);
}
}
fprintf
(
f
,
"
\n
"
);
return
0
;
}
...
...
tc/m_skbedit.c
View file @
ef056b21
...
...
@@ -12,9 +12,8 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Authors: Alexander Duyck <alexander.h.duyck@intel.com>
*
...
...
@@ -100,6 +99,7 @@ parse_skbedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
argv
++
;
}
sel
.
action
=
TC_ACT_PIPE
;
if
(
argc
)
{
if
(
matches
(
*
argv
,
"reclassify"
)
==
0
)
{
sel
.
action
=
TC_ACT_RECLASSIFY
;
...
...
@@ -165,6 +165,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
__u32
*
priority
;
__u32
*
mark
;
__u16
*
queue_mapping
;
struct
tc_skbedit
*
p
=
NULL
;
if
(
arg
==
NULL
)
return
-
1
;
...
...
@@ -175,6 +176,7 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
fprintf
(
f
,
"[NULL skbedit parameters]"
);
return
-
1
;
}
p
=
RTA_DATA
(
tb
[
TCA_SKBEDIT_PARMS
]);
fprintf
(
f
,
" skbedit"
);
...
...
@@ -191,6 +193,8 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
fprintf
(
f
,
" mark %d"
,
*
mark
);
}
fprintf
(
f
,
"
\n\t
index %d ref %d bind %d"
,
p
->
index
,
p
->
refcnt
,
p
->
bindcnt
);
if
(
show_stats
)
{
if
(
tb
[
TCA_SKBEDIT_TM
])
{
struct
tcf_t
*
tm
=
RTA_DATA
(
tb
[
TCA_SKBEDIT_TM
]);
...
...
@@ -198,6 +202,8 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg)
}
}
fprintf
(
f
,
"
\n
"
);
return
0
;
}
...
...
tc/q_multiq.c
View file @
ef056b21
...
...
@@ -12,9 +12,8 @@
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place - Suite 330, Boston, MA 02111-1307 USA.
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses>.
*
* Author: Alexander Duyck <alexander.h.duyck@intel.com>
*
...
...
tc/tc_util.c
View file @
ef056b21
...
...
@@ -198,28 +198,22 @@ int get_rate64(__u64 *rate, const char *str)
void
print_rate
(
char
*
buf
,
int
len
,
__u64
rate
)
{
double
tmp
=
(
double
)
rate
*
8
;
extern
int
use_iec
;
unsigned
long
kilo
=
use_iec
?
1024
:
1000
;
const
char
*
str
=
use_iec
?
"i"
:
""
;
int
i
=
0
;
static
char
*
units
[
5
]
=
{
""
,
"K"
,
"M"
,
"G"
,
"T"
};
if
(
use_iec
)
{
if
(
tmp
>=
1000
.
0
*
1024
.
0
*
1024
.
0
*
1024
.
0
)
snprintf
(
buf
,
len
,
"%.0fGibit"
,
tmp
/
(
1024
.
0
*
1024
.
0
*
1024
.
0
));
else
if
(
tmp
>=
1000
.
0
*
1024
.
0
*
1024
.
0
)
snprintf
(
buf
,
len
,
"%.0fMibit"
,
tmp
/
(
1024
.
0
*
1024
.
0
));
else
if
(
tmp
>=
1000
.
0
*
1024
)
snprintf
(
buf
,
len
,
"%.0fKibit"
,
tmp
/
1024
);
else
snprintf
(
buf
,
len
,
"%.0fbit"
,
tmp
);
}
else
{
if
(
tmp
>=
1000
.
0
*
1000000000
.
0
)
snprintf
(
buf
,
len
,
"%.0fGbit"
,
tmp
/
1000000000
.
0
);
else
if
(
tmp
>=
1000
.
0
*
1000000
.
0
)
snprintf
(
buf
,
len
,
"%.0fMbit"
,
tmp
/
1000000
.
0
);
else
if
(
tmp
>=
1000
.
0
*
1000
.
0
)
snprintf
(
buf
,
len
,
"%.0fKbit"
,
tmp
/
1000
.
0
);
else
snprintf
(
buf
,
len
,
"%.0fbit"
,
tmp
);
rate
<<=
3
;
/* bytes/sec -> bits/sec */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
units
);
i
++
)
{
if
(
rate
<
kilo
)
break
;
if
(((
rate
%
kilo
)
!=
0
)
&&
rate
<
1000
*
kilo
)
break
;
rate
/=
kilo
;
}
snprintf
(
buf
,
len
,
"%.0f%s%sbit"
,
(
double
)
rate
,
units
[
i
],
str
);
}
char
*
sprint_rate
(
__u64
rate
,
char
*
buf
)
...
...
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