From: Arne Kappen <[email protected]> This extension is based on an idea by Felix Fietkau which I implemented as part of a student project at TU Berlin in 2015 and during Google Summer of Code 2016 for Freifunk. I've since been using this prototype to allow for native UCI configuration of Open vSwitch devices through /etc/config/network - to add wifi interfaces to it, configure OpenFlow controllers etc. The project recently got some attention and I was asked to publish it. The concept is as follows: Add an interface to netifd which allows other programs to fulfill the device handler function (struct device_type) for a certain device class (ovs in my case). The communication happens over ubus and thus device handling logic for a specific type of devices can evolve independently from netifd. To realize this netifd generates device handler stubs from JSON descriptions which simply relay calls against the device handler API to the external device configuration daemon over ubus. The JSON file also contains the UCI config options for the device class. That way, netifd can create a blobmsg_policy to parse config options that are unknown at compile time. As a convention I had to add the UCI option 'depends_on' for expressing dependencies between devices. There are 2 general external device types: regular devices and bridge devices. Since my use case with Open vSwitch only involved bridge devices the regular device part is untested. It is a lot less complex than the bridge part, though. For the bridge part I followed the structure in bridge.c as much as possible and it works with Open vSwitch but I don't know if it is generic enough for other bridge device classes. I was hoping to get some feedback on that.
I've broken down my work into 3 patches. Unfortunately almost the entire thing comes as a huge block in patch 3. Patch 1 just cleans up an irrelevant comment on a line which I contributed in 2016 in preparation for publication of this extension which eventually didn't happen. Patch 2 prepares the device handler stub generation using a mechanism similar to how proto handlers are constructed. Patch 3 adds extdev.c which is the meat of the extension. If you want to test it with Open vSwitch these are the repositories for my external device handler 'ovsd' and its package feed: - https://github.com/arkap/package-ovsd.git - https://github.com/arkap/ovsd.git Arne Kappen (3): device: remove left-over comment handler: add mechanism to generate external device handler stubs extdev: add support for external device handlers CMakeLists.txt | 3 +- device.c | 3 - extdev.c | 1383 ++++++++++++++++++++++++++++++++++++++++++++++++ extdev.h | 20 + handler.c | 114 ++++ handler.h | 5 + main.c | 2 + ubus.c | 7 + ubus.h | 3 + 9 files changed, 1536 insertions(+), 4 deletions(-) create mode 100644 extdev.c create mode 100644 extdev.h -- 2.29.2 _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
