From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE62CC169C4 for ; Thu, 31 Jan 2019 12:49:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC6A420869 for ; Thu, 31 Jan 2019 12:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733115AbfAaMtR (ORCPT ); Thu, 31 Jan 2019 07:49:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55574 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727108AbfAaMtR (ORCPT ); Thu, 31 Jan 2019 07:49:17 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A7F178763B; Thu, 31 Jan 2019 12:49:16 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E83A5C229; Thu, 31 Jan 2019 12:49:11 +0000 (UTC) Date: Thu, 31 Jan 2019 13:49:05 +0100 From: Stefano Brivio To: Phil Sutter , Alexander Wirt , Luca Boccassi , Santiago Garcia Mantinan , Steve Langasek , Christian Hesse , Ronald van Haren , Terry Chvatal Cc: David Ahern , Eric Garver , Tomas Dolezal , Stephen Hemminger , Lennert Buytenhek , netdev@vger.kernel.org Subject: Re: [PATCH iproute2-next] Introduce ip-brctl shell script Message-ID: <20190131134905.7a4d60b2@redhat.com> In-Reply-To: References: Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 31 Jan 2019 12:49:16 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi, For your information: I recently submitted a patch that implements brctl as a wrapper using ip-link and 'bridge' from iproute2, that allows to drop bridge-utils while still providing brctl functionality: https://patchwork.ozlabs.org/patch/1027627/ This wasn't exactly met with enthusiasm upstream (full discussion at: https://marc.info/?l=linux-netdev&m=154783087917432), but feel free to carry it downstream if you're interested. Thanks, -- Stefano On Fri, 18 Jan 2019 18:00:45 +0100 Stefano Brivio wrote: > This script wraps 'ip' and 'bridge' tools to provide a drop-in replacement > of the standalone 'brctl' utility. > > It's bug-to-bug compatible with brctl as of bridge-utils version 1.6, > has no dependencies other than a POSIX shell, and it's less than half > the binary size of brctl on x86_64. > > As many users (including myself) seem to find brctl usage vastly more > intuitive than ip-link, possibly due to habit, this might be a lightweight > approach to provide brctl syntax without the need to maintain bridge-utils > any longer. > > Signed-off-by: Stefano Brivio > Acked-by: Phil Sutter > --- > man/man8/Makefile | 5 +- > man/man8/ip-brctl.8 | 187 +++++++++++++++ > misc/Makefile | 9 +- > misc/ip-brctl.in | 572 ++++++++++++++++++++++++++++++++++++++++++++ > 4 files changed, 770 insertions(+), 3 deletions(-) > create mode 100644 man/man8/ip-brctl.8 > create mode 100755 misc/ip-brctl.in > > diff --git a/man/man8/Makefile b/man/man8/Makefile > index 932ba1f3c488..26d2370a9cbe 100644 > --- a/man/man8/Makefile > +++ b/man/man8/Makefile > @@ -1,5 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > -TARGETS = ip-address.8 ip-link.8 ip-route.8 > +TARGETS = ip-address.8 ip-link.8 ip-route.8 brctl.8 > > MAN8PAGES = $(TARGETS) $(filter-out $(TARGETS),$(wildcard *.8)) > > @@ -14,6 +14,9 @@ ip-link.8: ip-link.8.in > ip-route.8: ip-route.8.in > sed "s|@SYSCONFDIR@|$(CONFDIR)|g" $< > $@ > > +brctl.8: ip-brctl.8 > + echo '.so man8/ip-brctl.8' >$@ > + > distclean: clean > > clean: > diff --git a/man/man8/ip-brctl.8 b/man/man8/ip-brctl.8 > new file mode 100644 > index 000000000000..63c1bcdebe9f > --- /dev/null > +++ b/man/man8/ip-brctl.8 > @@ -0,0 +1,187 @@ > +.\" > +.\" 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. > +.\" > +.\" This program is distributed in the hope that it will be useful, > +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of > +.\" MERCHANTABILITY or 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., 675 Mass Ave, Cambridge, MA 02139, USA. > +.\" > +.\" > +.TH IP-BRCTL 8 "January 18, 2019" "" "" > +.SH NAME > +ip-brctl \- ethernet bridge administration > +.SH SYNOPSIS > +.BR "brctl [command]" > +.SH DESCRIPTION > +.B ip-brctl > +is a reimplementation of the traditional > +.B brctl > +utility in shell making use of > +.BR ip " and " bridge > +tools internally. It is supposed to behave identically to > +.BR brctl , > +hence the remainder of this document will use that name instead of > +.BR ip-brctl . > + > +.B brctl > +is used to set up, maintain, and inspect the ethernet bridge > +configuration in the Linux kernel. > + > +An ethernet bridge is a device commonly used to connect different > +networks of ethernets together, so that these ethernets will appear as > +one ethernet to the participants. > + > +Each of the ethernets being connected corresponds to one physical > +interface in the bridge. These individual ethernets are bundled into > +one bigger ('logical') ethernet, this bigger ethernet corresponds to > +the bridge network interface. > + > + > +.SH INSTANCES > +The command > +.B brctl addbr > +creates a new instance of the ethernet bridge. The network interface > +corresponding to the bridge will be called . > + > +The command > +.B brctl delbr > +deletes the instance of the ethernet bridge. The network > +interface corresponding to the bridge must be down before it can be > +deleted! > + > +The command > +.B brctl show > +shows all current instances of the ethernet bridge. > + > + > +.SH PORTS > +Each bridge has a number of ports attached to it. Network traffic > +coming in on any of these ports will be forwarded to the other ports > +transparently, so that the bridge is invisible to the rest of the > +network (i.e. it will not show up in > +.IR traceroute(8) > +). > + > +The command > +.B brctl addif > +will make the interface a port of the bridge . This > +means that all frames received on will be processed as if > +destined for the bridge. Also, when sending frames on , > + will be considered as a potential output interface. > + > +The command > +.B brctl delif > +will detach the interface from the bridge . > + > +The command > +.B brctl show > +will show some information on the bridge and its attached ports. > + > + > +.SH AGEING > +The bridge keeps track of ethernet addresses seen on each port. When > +it needs to forward a frame, and it happens to know on which port the > +destination ethernet address (specified in the frame) is located, it > +can 'cheat' by forwarding the frame to that port only, thus saving a > +lot of redundant copies and transmits. > + > +However, the ethernet address location data is not static > +data. Machines can move to other ports, network cards can be replaced > +(which changes the machine's ethernet address), etc. > + > +.B brctl showmacs > +shows a list of learned MAC addresses for this bridge. > + > +.B brctl setageing