Skip to contentSkip to conversation

iproute2: add br command

RFC In review Stephen Hemminger 5 participants 11 messages Oct 4, 2011 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CAGXs5wWeFcyHQ4vO562pTOdqLNEKrJwES3W_hFF_M2reNoe1rA@mail.gmail.com

#1 lore raw

RFC 1/1 iproute2: add br command

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

---
 Makefile       |    2 +-
 br/.gitignore  |    1 +
 br/Makefile    |   14 +++
 br/br.c        |  104 ++++++++++++++++++++++++
 br/br_common.h |   13 +++
 br/fdb.c       |  245 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 br/link.c      |  142 ++++++++++++++++++++++++++++++++
 br/monitor.c   |  138 +++++++++++++++++++++++++++++++
 man/man8/br.8  |  177 ++++++++++++++++++++++++++++++++++++++++
 9 files changed, 835 insertions(+), 1 deletions(-)
 create mode 100644 br/.gitignore
 create mode 100644 br/Makefile
 create mode 100644 br/br.c
 create mode 100644 br/br_common.h
 create mode 100644 br/fdb.c
 create mode 100644 br/link.c
 create mode 100644 br/monitor.c
 create mode 100644 man/man8/br.8
Makefile +1 -1
index d1ace1f..f1d360a 100644
@@ -33,7 +33,7 @@ CCOPTS = -D_GNU_SOURCE -O2 -Wstrict-prototypes -Wall
 CFLAGS = $(CCOPTS) -I../include $(DEFINES)
 YACCFLAGS = -d -t -v
 
-SUBDIRS=lib ip tc misc netem genl
+SUBDIRS=lib ip tc br misc netem genl
 
 LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
 LDLIBS += $(LIBNETLINK)
br/.gitignore new file +1 -0
new file mode 100644
index 0000000..b9a724f
@@ -0,0 +1 @@
+br
br/Makefile new file +14 -0
new file mode 100644
index 0000000..2bb18a7
@@ -0,0 +1,14 @@
+BROBJ = br.o fdb.o monitor.o link.o
+
+include ../Config
+
+all: br
+
+br: $(BROBJ) $(LIBNETLINK) 
+
+install: all
+	install -m 0755 br $(DESTDIR)$(SBINDIR)
+
+clean:
+	rm -f $(BROBJ) br
+
br/br.c new file +104 -0

104 lines not on this page · raw message

br/br_common.h new file +13 -0
new file mode 100644
index 0000000..ec1671d
@@ -0,0 +1,13 @@
+extern int print_linkinfo(const struct sockaddr_nl *who,
+			  struct nlmsghdr *n,
+			  void *arg);
+extern int print_fdb(const struct sockaddr_nl *who,
+		     struct nlmsghdr *n, void *arg);
+
+extern int do_fdb(int argc, char **argv);
+extern int do_monitor(int argc, char **argv);
+
+extern int show_stats;
+extern int show_detail;
+extern int timestamp;
+extern struct rtnl_handle rth;
br/fdb.c new file +245 -0

245 lines not on this page · raw message

br/link.c new file +142 -0

142 lines not on this page · raw message

br/monitor.c new file +138 -0

138 lines not on this page · raw message

man/man8/br.8 new file +177 -0

177 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#2 lore raw
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

[...]

This command name is already in use:
http://packages.debian.org/sid/bottlerocket

Ben.

Signature · 3 lines
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
#3 lore raw
Quoted 8 lines · On Tue, 04 Oct 2011 17:58:10 +0100 Ben Hutchings <[email protected]>…
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

[...]

This command name is already in use:
http://packages.debian.org/sid/bottlerocket

Damn name squatters.

#4 lore raw
In reply to Stephen Hemminger
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only
#5 lore raw
Quoted 9 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

-Andi

Ok, but it breaks the existing pattern.

#6 lore raw
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Quoted 5 lines
Quoted 3 lines

Please name it "bridge", not "br"

-Andi

Ok, but it breaks the existing pattern.

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
ip bridge add/del <brname>
ip bridge addif/delif <brname> <ifname>

Thanks
Sridhar

#7 lore raw
Quoted 16 lines · On Tue, 04 Oct 2011 15:17:18 -0700 Sridhar Samudrala <[email protected]> wrote:
Quoted 9 lines · Stephen Hemminger
Quoted 6 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Quoted 5 lines
Quoted 3 lines

Please name it "bridge", not "br"

-Andi

Ok, but it breaks the existing pattern.

Quoted 9 lines

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
ip bridge add/del <brname>
ip bridge addif/delif <brname> <ifname>

You can already use 'ip link' to add/delete bridge, and add interface to bridge by setting master.

#8 lore raw
In reply to Sridhar Samudrala

2011/10/5 Sridhar Samudrala <[email protected]>:

Quoted 9 lines · Stephen Hemminger
Quoted 8 lines
Quoted 5 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

Ok, but it breaks the existing pattern.

Quoted 8 lines

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
  ip bridge add/del <brname>
  ip bridge addif/delif <brname> <ifname>

I'll add one more idea:

ip link add/del <brname> type bridge
ip bridge add/del <brname> <ifname>
ip bridge fdb ...

Best Regards,
Michał Mirosław

#9 lore raw
Quoted 19 lines · On Wed, 5 Oct 2011 00:32:31 +0200 Michał Mirosław <[email protected]> wrote:

2011/10/5 Sridhar Samudrala <[email protected]>:

Quoted 9 lines · Stephen Hemminger
Quoted 8 lines
Quoted 5 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

Ok, but it breaks the existing pattern.

Quoted 8 lines

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
  ip bridge add/del <brname>
  ip bridge addif/delif <brname> <ifname>

Quoted 5 lines

I'll add one more idea:

ip link add/del <brname> type bridge
ip bridge add/del <brname> <ifname>
ip bridge fdb ...

In 3.0 you can already do:

# ip link add dev br3 type bridge
# ip link set dev eth3 master br3

I see no reason to add 'ip bridge' syntax wrappers.

#10 lore raw
Quoted 24 lines · Stephen Hemminger
Quoted 21 lines · On Wed, 5 Oct 2011 00:32:31 +0200 Michał Mirosław <[email protected]> wrote:

2011/10/5 Sridhar Samudrala <[email protected]>:

Quoted 9 lines · Stephen Hemminger
Quoted 8 lines
Quoted 5 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

Ok, but it breaks the existing pattern.

Quoted 8 lines

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
ip bridge add/del <brname>
ip bridge addif/delif <brname> <ifname>

I'll add one more idea:

Quoted 7 lines
Quoted 3 lines

ip link add/del <brname> type bridge
ip bridge add/del <brname> <ifname>
ip bridge fdb ...

In 3.0 you can already do:

# ip link add dev br3 type bridge
# ip link set dev eth3 master br3

I just pulled iproute2 tree from
git://github.com/shemminger/iproute2.git

But i don't see these updates there. Isn't this your latest iproute2 tree?

Quoted 2 lines

I see no reason to add 'ip bridge' syntax wrappers.

If we can make all bridge related commands use 'ip bridge' prefix , i think we wouldn't need a new 'br' command.

Thanks
Sridhar

#11 lore raw
Quoted 29 lines · On Tue, 04 Oct 2011 15:54:07 -0700 Sridhar Samudrala <[email protected]> wrote:
Quoted 28 lines · Stephen Hemminger
Quoted 24 lines · On Wed, 5 Oct 2011 00:32:31 +0200 Michał Mirosław <[email protected]> wrote:

2011/10/5 Sridhar Samudrala <[email protected]>:

Quoted 9 lines · Stephen Hemminger
Quoted 8 lines
Quoted 5 lines · On Tue, 04 Oct 2011 09:58:55 -0700 Andi Kleen <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

This adds a new 'br' command which is the bridging equivalent of the ip command. More of a demo of how to use netlink and bridging at this point.

Please name it "bridge", not "br"

Ok, but it breaks the existing pattern.

Quoted 8 lines

Is this supposed to replace brctl utility?

Can we add/delete a bridge and add/delete interfaces to a bridge using this command?

If so, why not make it
ip bridge add/del <brname>
ip bridge addif/delif <brname> <ifname>

I'll add one more idea:

ip link add/del <brname> type bridge
ip bridge add/del <brname> <ifname>
ip bridge fdb ...

Quoted 8 lines
Quoted 3 lines

In 3.0 you can already do:

# ip link add dev br3 type bridge
# ip link set dev eth3 master br3

I just pulled iproute2 tree from
git://github.com/shemminger/iproute2.git

But i don't see these updates there. Isn't this your latest iproute2 tree?

There is no special code for doing ip link stuff. it just works with correct kernel.

Quoted 5 lines
Quoted 2 lines

I see no reason to add 'ip bridge' syntax wrappers.

If we can make all bridge related commands use 'ip bridge' prefix , i think we wouldn't need a new 'br' command.

Maybe but there is no IP protocol function or requirement for bridging.