From linux-hotplug Fri Aug 17 16:22:53 2012 From: Stephen Hemminger Date: Fri, 17 Aug 2012 16:22:53 +0000 To: linux-hotplug Subject: Re: NCD, a light scripting language for network configs and much more Message-Id: <20120817092253.41ade51b () nehalam ! linuxnetplumber ! net> X-MARC-Message: https://marc.info/?l=linux-hotplug&m=134522059224548 On Fri, 17 Aug 2012 12:03:55 +0200 Ambroz Bizjak wrote: > Hi. I'm developing a special kind of scripting language which many > might find useful: http://code.google.com/p/badvpn/wiki/NCD > > It was (originally) designed for programming dynamic configuration of > network interfaces, iptables etc. For example, there are commands that > observe the presence and link status of network interfaces. Many > commands are reversible, which makes it very easy to do cleanup > automatically and implicitly, like removing IP addresses or routes > when the link goes down on an interface. > > The major advantage of this language compared to existing systems like > NetworkManager and wicd is that it's extremely hackable; you can fine > tune almost any part of the process. For example, this simple script > will create a network bridge, ensure that interfaces eth0 and eth1 are > in the bridge whenever they exist (consider hotplugging USB > interfaces), and only after eth0 (!) is up and running will it obtain > an IP address on br0 (!) using DHCP (since we know DHCP server is on > eth0 not eth1). > > process bridge { > # Choose name of bridge. > var("br6") bridge_dev; > > # Create the bridge (and destroy it on deinit). > run({"/sbin/brctl", "addbr", bridge_dev}, > {"/sbin/brctl", "delbr", bridge_dev}); > > # Set bridge up. > net.up(bridge_dev); > > # Wake up ports. > provide("BRIDGE"); FYI - you can use ip commands now to control bridge. For all the new features planned, they won't be controllable via brctl. -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html