Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
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@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
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? 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? 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 bruno ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
On 18/02/2016 17:36, Bruno Randolf wrote: > On 02/18/2016 02:00 PM, Jakub Jančo wrote: >> You should add all important options to networking: >> metric >> defaultroute >> peerdns >> These are important for remote management and dns resolving. >> >> You can see my not yet applied patch >> http://patchwork.ozlabs.org/patch/581065/ >> It works for me. > > Hi Jakub, > > You are right and I will soon send a v2 of the patch which includes your > changes. Thanks, > > bruno > 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. John ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
On 02/18/2016 02:00 PM, Jakub Jančo wrote: > You should add all important options to networking: > metric > defaultroute > peerdns > These are important for remote management and dns resolving. > > You can see my not yet applied patch http://patchwork.ozlabs.org/patch/581065/ > It works for me. Hi Jakub, You are right and I will soon send a v2 of the patch which includes your changes. Thanks, bruno > -- > S pozdravom Jakub Janco > > > On Wed, Feb 17, 2016 at 7:21 PM, Bruno Randolfwrote: >> Same as for other network interfaces, the option 'metric' should be >> respected. >> >> (Unfortunately I could not test these changes, since I don't have these >> modems >> and QMI is broken on trunk for me... But the same method is used in the >> "HiLink" script I just added before.) >> >> Signed-off-by: Bruno Randolf >> --- >> package/network/utils/comgt/files/directip.sh | 7 +-- >> package/network/utils/comgt/files/ncm.sh | 7 +-- >> package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 7 +-- >> package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 11 +++ >> 4 files changed, 22 insertions(+), 10 deletions(-) >> >> diff --git a/package/network/utils/comgt/files/directip.sh >> b/package/network/utils/comgt/files/directip.sh >> index d828052..048b647 100644 >> --- a/package/network/utils/comgt/files/directip.sh >> +++ b/package/network/utils/comgt/files/directip.sh >> @@ -15,14 +15,15 @@ proto_directip_init_config() { >> proto_config_add_string "auth" >> proto_config_add_string "username" >> proto_config_add_string "password" >> + proto_config_add_string "metric" >> } >> >> proto_directip_setup() { >> local interface="$1" >> local chat devpath devname >> >> - local device apn pincode ifname auth username password >> - json_get_vars device apn pincode auth username password >> + local device apn pincode ifname auth username password metric >> + json_get_vars device apn pincode auth username password metric >> >> [ -n "$ctl_device" ] && device=$ctl_device >> >> @@ -80,6 +81,7 @@ proto_directip_setup() { >> json_add_string name "${interface}_4" >> json_add_string ifname "@$interface" >> json_add_string proto "dhcp" >> + json_add_int metric $metric >> ubus call network add_dynamic "$(json_dump)" >> >> json_init >> @@ -87,6 +89,7 @@ proto_directip_setup() { >> json_add_string ifname "@$interface" >> json_add_string proto "dhcpv6" >> json_add_string extendprefix 1 >> + json_add_int metric $metric >> ubus call network add_dynamic "$(json_dump)" >> >> return 0 >> diff --git a/package/network/utils/comgt/files/ncm.sh >> b/package/network/utils/comgt/files/ncm.sh >> index 571cfaa..39bdaaf 100644 >> --- a/package/network/utils/comgt/files/ncm.sh >> +++ b/package/network/utils/comgt/files/ncm.sh >> @@ -19,6 +19,7 @@ proto_ncm_init_config() { >> proto_config_add_string mode >> proto_config_add_string pdptype >> proto_config_add_boolean ipv6 >> + proto_config_add_string metric >> } >> >> proto_ncm_setup() { >> @@ -26,8 +27,8 @@ proto_ncm_setup() { >> >> local manufacturer initialize setmode connect ifname devname devpath >> >> - local device apn auth username password pincode delay mode pdptype >> ipv6 >> - json_get_vars device apn auth username password pincode delay mode >> pdptype ipv6 >> + local device apn auth username password pincode delay mode pdptype >> ipv6 metric >> + json_get_vars device apn auth username password pincode delay mode >> pdptype ipv6 metric >> >> if [ "$ipv6" = 0 ]; then >> ipv6="" >> @@ -141,6 +142,7 @@ proto_ncm_setup() { >> json_add_string name "${interface}_4" >> json_add_string ifname "@$interface" >> json_add_string proto "dhcp" >> + json_add_int metric $metric >> ubus call network add_dynamic "$(json_dump)" >> >> [ -n "$ipv6" ] && { >> @@ -149,6 +151,7 @@ proto_ncm_setup() { >> json_add_string ifname "@$interface" >> json_add_string proto "dhcpv6" >> json_add_string extendprefix 1 >> + json_add_int metric $metric >> ubus call network add_dynamic "$(json_dump)" >> } >> } >> diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh >> b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh >> index f8b2c06..ab62ed6 100755 >> --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh >> +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh >> @@ -17,6 +17,7 @@ proto_mbim_init_config() { >> proto_config_add_string auth >> proto_config_add_string username >> proto_config_add_string password >> + proto_config_add_string metric >>
Re: [OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
You should add all important options to networking: metric defaultroute peerdns These are important for remote management and dns resolving. You can see my not yet applied patch http://patchwork.ozlabs.org/patch/581065/ It works for me. -- S pozdravom Jakub Janco On Wed, Feb 17, 2016 at 7:21 PM, Bruno Randolfwrote: > Same as for other network interfaces, the option 'metric' should be respected. > > (Unfortunately I could not test these changes, since I don't have these modems > and QMI is broken on trunk for me... But the same method is used in the > "HiLink" script I just added before.) > > Signed-off-by: Bruno Randolf > --- > package/network/utils/comgt/files/directip.sh | 7 +-- > package/network/utils/comgt/files/ncm.sh | 7 +-- > package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 7 +-- > package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 11 +++ > 4 files changed, 22 insertions(+), 10 deletions(-) > > diff --git a/package/network/utils/comgt/files/directip.sh > b/package/network/utils/comgt/files/directip.sh > index d828052..048b647 100644 > --- a/package/network/utils/comgt/files/directip.sh > +++ b/package/network/utils/comgt/files/directip.sh > @@ -15,14 +15,15 @@ proto_directip_init_config() { > proto_config_add_string "auth" > proto_config_add_string "username" > proto_config_add_string "password" > + proto_config_add_string "metric" > } > > proto_directip_setup() { > local interface="$1" > local chat devpath devname > > - local device apn pincode ifname auth username password > - json_get_vars device apn pincode auth username password > + local device apn pincode ifname auth username password metric > + json_get_vars device apn pincode auth username password metric > > [ -n "$ctl_device" ] && device=$ctl_device > > @@ -80,6 +81,7 @@ proto_directip_setup() { > json_add_string name "${interface}_4" > json_add_string ifname "@$interface" > json_add_string proto "dhcp" > + json_add_int metric $metric > ubus call network add_dynamic "$(json_dump)" > > json_init > @@ -87,6 +89,7 @@ proto_directip_setup() { > json_add_string ifname "@$interface" > json_add_string proto "dhcpv6" > json_add_string extendprefix 1 > + json_add_int metric $metric > ubus call network add_dynamic "$(json_dump)" > > return 0 > diff --git a/package/network/utils/comgt/files/ncm.sh > b/package/network/utils/comgt/files/ncm.sh > index 571cfaa..39bdaaf 100644 > --- a/package/network/utils/comgt/files/ncm.sh > +++ b/package/network/utils/comgt/files/ncm.sh > @@ -19,6 +19,7 @@ proto_ncm_init_config() { > proto_config_add_string mode > proto_config_add_string pdptype > proto_config_add_boolean ipv6 > + proto_config_add_string metric > } > > proto_ncm_setup() { > @@ -26,8 +27,8 @@ proto_ncm_setup() { > > local manufacturer initialize setmode connect ifname devname devpath > > - local device apn auth username password pincode delay mode pdptype > ipv6 > - json_get_vars device apn auth username password pincode delay mode > pdptype ipv6 > + local device apn auth username password pincode delay mode pdptype > ipv6 metric > + json_get_vars device apn auth username password pincode delay mode > pdptype ipv6 metric > > if [ "$ipv6" = 0 ]; then > ipv6="" > @@ -141,6 +142,7 @@ proto_ncm_setup() { > json_add_string name "${interface}_4" > json_add_string ifname "@$interface" > json_add_string proto "dhcp" > + json_add_int metric $metric > ubus call network add_dynamic "$(json_dump)" > > [ -n "$ipv6" ] && { > @@ -149,6 +151,7 @@ proto_ncm_setup() { > json_add_string ifname "@$interface" > json_add_string proto "dhcpv6" > json_add_string extendprefix 1 > + json_add_int metric $metric > ubus call network add_dynamic "$(json_dump)" > } > } > diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh > b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh > index f8b2c06..ab62ed6 100755 > --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh > +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh > @@ -17,6 +17,7 @@ proto_mbim_init_config() { > proto_config_add_string auth > proto_config_add_string username > proto_config_add_string password > + proto_config_add_string metric > } > > _proto_mbim_setup() { > @@ -24,8 +25,8 @@ _proto_mbim_setup() { > local tid=2 > local ret > > - local device apn pincode delay > - json_get_vars device apn pincode delay auth username password > + local device apn pincode delay metric > +
[OpenWrt-Devel] [PATCH 2/2] Add support for 'metric' to QMI, NCM, MBIM and DirectIP
Same as for other network interfaces, the option 'metric' should be respected. (Unfortunately I could not test these changes, since I don't have these modems and QMI is broken on trunk for me... But the same method is used in the "HiLink" script I just added before.) Signed-off-by: Bruno Randolf--- package/network/utils/comgt/files/directip.sh | 7 +-- package/network/utils/comgt/files/ncm.sh | 7 +-- package/network/utils/umbim/files/lib/netifd/proto/mbim.sh | 7 +-- package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh | 11 +++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/package/network/utils/comgt/files/directip.sh b/package/network/utils/comgt/files/directip.sh index d828052..048b647 100644 --- a/package/network/utils/comgt/files/directip.sh +++ b/package/network/utils/comgt/files/directip.sh @@ -15,14 +15,15 @@ proto_directip_init_config() { proto_config_add_string "auth" proto_config_add_string "username" proto_config_add_string "password" + proto_config_add_string "metric" } proto_directip_setup() { local interface="$1" local chat devpath devname - local device apn pincode ifname auth username password - json_get_vars device apn pincode auth username password + local device apn pincode ifname auth username password metric + json_get_vars device apn pincode auth username password metric [ -n "$ctl_device" ] && device=$ctl_device @@ -80,6 +81,7 @@ proto_directip_setup() { json_add_string name "${interface}_4" json_add_string ifname "@$interface" json_add_string proto "dhcp" + json_add_int metric $metric ubus call network add_dynamic "$(json_dump)" json_init @@ -87,6 +89,7 @@ proto_directip_setup() { json_add_string ifname "@$interface" json_add_string proto "dhcpv6" json_add_string extendprefix 1 + json_add_int metric $metric ubus call network add_dynamic "$(json_dump)" return 0 diff --git a/package/network/utils/comgt/files/ncm.sh b/package/network/utils/comgt/files/ncm.sh index 571cfaa..39bdaaf 100644 --- a/package/network/utils/comgt/files/ncm.sh +++ b/package/network/utils/comgt/files/ncm.sh @@ -19,6 +19,7 @@ proto_ncm_init_config() { proto_config_add_string mode proto_config_add_string pdptype proto_config_add_boolean ipv6 + proto_config_add_string metric } proto_ncm_setup() { @@ -26,8 +27,8 @@ proto_ncm_setup() { local manufacturer initialize setmode connect ifname devname devpath - local device apn auth username password pincode delay mode pdptype ipv6 - json_get_vars device apn auth username password pincode delay mode pdptype ipv6 + local device apn auth username password pincode delay mode pdptype ipv6 metric + json_get_vars device apn auth username password pincode delay mode pdptype ipv6 metric if [ "$ipv6" = 0 ]; then ipv6="" @@ -141,6 +142,7 @@ proto_ncm_setup() { json_add_string name "${interface}_4" json_add_string ifname "@$interface" json_add_string proto "dhcp" + json_add_int metric $metric ubus call network add_dynamic "$(json_dump)" [ -n "$ipv6" ] && { @@ -149,6 +151,7 @@ proto_ncm_setup() { json_add_string ifname "@$interface" json_add_string proto "dhcpv6" json_add_string extendprefix 1 + json_add_int metric $metric ubus call network add_dynamic "$(json_dump)" } } diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh index f8b2c06..ab62ed6 100755 --- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh +++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh @@ -17,6 +17,7 @@ proto_mbim_init_config() { proto_config_add_string auth proto_config_add_string username proto_config_add_string password + proto_config_add_string metric } _proto_mbim_setup() { @@ -24,8 +25,8 @@ _proto_mbim_setup() { local tid=2 local ret - local device apn pincode delay - json_get_vars device apn pincode delay auth username password + local device apn pincode delay metric + json_get_vars device apn pincode delay auth username password metric [ -n "$ctl_device" ] && device=$ctl_device @@ -130,6 +131,7 @@ _proto_mbim_setup() { json_add_string name "${interface}_4" json_add_string ifname "@$interface" json_add_string proto "dhcp" + json_add_int metric $metric json_close_object ubus call network add_dynamic "$(json_dump)" @@ -138,6 +140,7 @@ _proto_mbim_setup() { json_add_string ifname "@$interface" json_add_string proto "dhcpv6"