[OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP

Felix Fietkau nbd at openwrt.org
Sat Feb 20 04:51:55 EST 2016

On 2016-02-18 17:53, Bruno Randolf wrote:
> On 02/18/2016 04:43 PM, John Crispin wrote:
>> ideally this gets handled generically, which wont be easy as these are
>> all virtual interfaces. maybe if we just add the code in a generic place
>> rather than duplicate it lots of times.
> Ideally - yes... but where?
The helpers should go into netifd.git - scripts/netifd-proto.sh

They could look something like this:

PROTO_DEFAULT_OPTIONS="defaultroute peerdns metric"

proto_config_add_defaults() {
	# add default config options
proto_add_dynamic_defaults() {
	# json_add_* calls for dynamic interfaces

Any proto handler can add $PROTO_DEFAULT_OPTIONS to its json_get_vars
call and optionally filter/override them if necessary, before they get
used by proto_add_dynamic_defaults

> Also I don't understand why these have to be virtual interfaces.
> Wouldn't it be possible to attach the dhcp client to the normal
> interface, just as it is done for ethernet or wifi interfaces?
Well, some proto handlers create multiple dynamic interfaces (for v4 and
v6), and right now we don't have support for dealing with multiple proto
tasks yet.

> That would simplify other things as I have been trying to mention in my
> mail titled: "QMI/NCM/MBIM interfaces netifd ifup event too early"
> https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg37608.html
I think we may need to change netifd to add support for embedding
dynamic interfaces in the proto notification and marking the main
interface as up only if one of its dynamic interfaces was activated.

- Felix
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list