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
28d84b42
Commit
28d84b42
authored
Sep 28, 2014
by
Jiri Pirko
Committed by
Stephen Hemminger
Sep 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bridge master device support
Signed-off-by:
Jiri Pirko
<
jiri@resnulli.us
>
parent
8c39db39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
94 additions
and
1 deletion
+94
-1
ip/Makefile
ip/Makefile
+1
-1
ip/iplink_bridge.c
ip/iplink_bridge.c
+93
-0
No files found.
ip/Makefile
View file @
28d84b42
...
...
@@ -6,7 +6,7 @@ IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o link_vti6.o
\
iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o
\
link_iptnl.o link_gre6.o iplink_bond.o iplink_bond_slave.o iplink_hsr.o
\
iplink_bridge_slave.o
iplink_bridge
.o iplink_bridge
_slave.o
RTMONOBJ
=
rtmon.o
...
...
ip/iplink_bridge.c
0 → 100644
View file @
28d84b42
/*
* iplink_bridge.c Bridge 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: Jiri Pirko <jiri@resnulli.us>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <linux/if_link.h>
#include "utils.h"
#include "ip_common.h"
static
void
explain
(
void
)
{
fprintf
(
stderr
,
"Usage: ... bridge [ forward_delay FORWARD_DELAY ]
\n
"
" [ hello_time HELLO_TIME ]
\n
"
" [ max_age MAX_AGE ]
\n
"
);
}
static
int
bridge_parse_opt
(
struct
link_util
*
lu
,
int
argc
,
char
**
argv
,
struct
nlmsghdr
*
n
)
{
__u32
val
;
while
(
argc
>
0
)
{
if
(
matches
(
*
argv
,
"forward_delay"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u32
(
&
val
,
*
argv
,
0
))
{
invarg
(
"invalid forward_delay"
,
*
argv
);
return
-
1
;
}
addattr32
(
n
,
1024
,
IFLA_BR_FORWARD_DELAY
,
val
);
}
else
if
(
matches
(
*
argv
,
"hello_time"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u32
(
&
val
,
*
argv
,
0
))
{
invarg
(
"invalid hello_time"
,
*
argv
);
return
-
1
;
}
addattr32
(
n
,
1024
,
IFLA_BR_HELLO_TIME
,
val
);
}
else
if
(
matches
(
*
argv
,
"max_age"
)
==
0
)
{
NEXT_ARG
();
if
(
get_u32
(
&
val
,
*
argv
,
0
))
{
invarg
(
"invalid max_age"
,
*
argv
);
return
-
1
;
}
addattr32
(
n
,
1024
,
IFLA_BR_MAX_AGE
,
val
);
}
else
if
(
matches
(
*
argv
,
"help"
)
==
0
)
{
explain
();
return
-
1
;
}
else
{
fprintf
(
stderr
,
"bridge: unknown command
\"
%s
\"
?
\n
"
,
*
argv
);
explain
();
return
-
1
;
}
argc
--
,
argv
++
;
}
return
0
;
}
static
void
bridge_print_opt
(
struct
link_util
*
lu
,
FILE
*
f
,
struct
rtattr
*
tb
[])
{
if
(
!
tb
)
return
;
if
(
tb
[
IFLA_BR_FORWARD_DELAY
])
fprintf
(
f
,
"forward_delay %u "
,
rta_getattr_u32
(
tb
[
IFLA_BR_FORWARD_DELAY
]));
if
(
tb
[
IFLA_BR_HELLO_TIME
])
fprintf
(
f
,
"hello_time %u "
,
rta_getattr_u32
(
tb
[
IFLA_BR_HELLO_TIME
]));
if
(
tb
[
IFLA_BR_MAX_AGE
])
fprintf
(
f
,
"max_age %u "
,
rta_getattr_u32
(
tb
[
IFLA_BR_MAX_AGE
]));
}
struct
link_util
bridge_link_util
=
{
.
id
=
"bridge"
,
.
maxattr
=
IFLA_BR_MAX
,
.
parse_opt
=
bridge_parse_opt
,
.
print_opt
=
bridge_print_opt
,
};
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