Message ID | 1455733287-5194-2-git-send-email-br1@einfach.org |
---|---|
State | Superseded |
Headers | show |
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 Randolf <br1@einfach.org> wrote: > 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 <br1@einfach.org> > --- > 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" > json_add_string extendprefix 1 > + json_add_int metric $metric > ubus call network add_dynamic "$(json_dump)" > } > > diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh > index 48864be..b129a7c 100755 > --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh > +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh > @@ -19,15 +19,16 @@ proto_qmi_init_config() { > proto_config_add_string modes > proto_config_add_boolean ipv6 > proto_config_add_boolean dhcp > + proto_config_add_string metric > } > > proto_qmi_setup() { > local interface="$1" > > - local device apn auth username password pincode delay modes ipv6 dhcp > + local device apn auth username password pincode delay modes ipv6 dhcp metric > local cid_4 pdh_4 cid_6 pdh_6 ipv4 > local ip subnet gateway dns1 dns2 ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 > - json_get_vars device apn auth username password pincode delay modes ipv6 dhcp > + json_get_vars device apn auth username password pincode delay modes ipv6 dhcp metric > > ipv4=1 > > @@ -152,7 +153,7 @@ proto_qmi_setup() { > proto_add_ipv4_address "$ip" "$subnet" > proto_add_dns_server "$dns1" > proto_add_dns_server "$dns2" > - proto_add_ipv4_route "0.0.0.0" 0 "$gateway" > + proto_add_ipv4_route "0.0.0.0" 0 "$gateway" "" "$metric" > proto_add_data > json_add_string "cid_4" "$cid_4" > json_add_string "pdh_4" "$pdh_4" > @@ -175,7 +176,7 @@ proto_qmi_setup() { > proto_add_ipv6_address "$ip_6" "128" > proto_add_ipv6_prefix "${ip_6}/${ip_prefix_length}" > proto_add_ipv6_route "$gateway_6" "128" > - proto_add_ipv6_route "::0" 0 "$gateway_6" "" "" "${ip_6}/${ip_prefix_length}" > + proto_add_ipv6_route "::0" 0 "$gateway_6" "$metric" "" "${ip_6}/${ip_prefix_length}" > proto_add_dns_server "$dns1_6" > proto_add_dns_server "$dns2_6" > proto_add_data > @@ -204,6 +205,7 @@ proto_qmi_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)" > } > @@ -215,6 +217,7 @@ proto_qmi_setup() { > json_add_string proto "dhcpv6" > # RFC 7278: Extend an IPv6 /64 Prefix to LAN > json_add_string extendprefix 1 > + json_add_int metric $metric > json_close_object > ubus call network add_dynamic "$(json_dump)" > } > -- > 1.9.1 > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
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 Randolf <br1@einfach.org> wrote: >> 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 <br1@einfach.org> >> --- >> 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" >> json_add_string extendprefix 1 >> + json_add_int metric $metric >> ubus call network add_dynamic "$(json_dump)" >> } >> >> diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh >> index 48864be..b129a7c 100755 >> --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh >> +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh >> @@ -19,15 +19,16 @@ proto_qmi_init_config() { >> proto_config_add_string modes >> proto_config_add_boolean ipv6 >> proto_config_add_boolean dhcp >> + proto_config_add_string metric >> } >> >> proto_qmi_setup() { >> local interface="$1" >> >> - local device apn auth username password pincode delay modes ipv6 dhcp >> + local device apn auth username password pincode delay modes ipv6 dhcp metric >> local cid_4 pdh_4 cid_6 pdh_6 ipv4 >> local ip subnet gateway dns1 dns2 ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 >> - json_get_vars device apn auth username password pincode delay modes ipv6 dhcp >> + json_get_vars device apn auth username password pincode delay modes ipv6 dhcp metric >> >> ipv4=1 >> >> @@ -152,7 +153,7 @@ proto_qmi_setup() { >> proto_add_ipv4_address "$ip" "$subnet" >> proto_add_dns_server "$dns1" >> proto_add_dns_server "$dns2" >> - proto_add_ipv4_route "0.0.0.0" 0 "$gateway" >> + proto_add_ipv4_route "0.0.0.0" 0 "$gateway" "" "$metric" >> proto_add_data >> json_add_string "cid_4" "$cid_4" >> json_add_string "pdh_4" "$pdh_4" >> @@ -175,7 +176,7 @@ proto_qmi_setup() { >> proto_add_ipv6_address "$ip_6" "128" >> proto_add_ipv6_prefix "${ip_6}/${ip_prefix_length}" >> proto_add_ipv6_route "$gateway_6" "128" >> - proto_add_ipv6_route "::0" 0 "$gateway_6" "" "" "${ip_6}/${ip_prefix_length}" >> + proto_add_ipv6_route "::0" 0 "$gateway_6" "$metric" "" "${ip_6}/${ip_prefix_length}" >> proto_add_dns_server "$dns1_6" >> proto_add_dns_server "$dns2_6" >> proto_add_data >> @@ -204,6 +205,7 @@ proto_qmi_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)" >> } >> @@ -215,6 +217,7 @@ proto_qmi_setup() { >> json_add_string proto "dhcpv6" >> # RFC 7278: Extend an IPv6 /64 Prefix to LAN >> json_add_string extendprefix 1 >> + json_add_int metric $metric >> json_close_object >> ubus call network add_dynamic "$(json_dump)" >> } >> -- >> 1.9.1 >> _______________________________________________ >> openwrt-devel mailing list >> openwrt-devel@lists.openwrt.org >> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
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
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
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
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" json_add_string extendprefix 1 + json_add_int metric $metric ubus call network add_dynamic "$(json_dump)" } diff --git a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh index 48864be..b129a7c 100755 --- a/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh +++ b/package/network/utils/uqmi/files/lib/netifd/proto/qmi.sh @@ -19,15 +19,16 @@ proto_qmi_init_config() { proto_config_add_string modes proto_config_add_boolean ipv6 proto_config_add_boolean dhcp + proto_config_add_string metric } proto_qmi_setup() { local interface="$1" - local device apn auth username password pincode delay modes ipv6 dhcp + local device apn auth username password pincode delay modes ipv6 dhcp metric local cid_4 pdh_4 cid_6 pdh_6 ipv4 local ip subnet gateway dns1 dns2 ip_6 ip_prefix_length gateway_6 dns1_6 dns2_6 - json_get_vars device apn auth username password pincode delay modes ipv6 dhcp + json_get_vars device apn auth username password pincode delay modes ipv6 dhcp metric ipv4=1 @@ -152,7 +153,7 @@ proto_qmi_setup() { proto_add_ipv4_address "$ip" "$subnet" proto_add_dns_server "$dns1" proto_add_dns_server "$dns2" - proto_add_ipv4_route "0.0.0.0" 0 "$gateway" + proto_add_ipv4_route "0.0.0.0" 0 "$gateway" "" "$metric" proto_add_data json_add_string "cid_4" "$cid_4" json_add_string "pdh_4" "$pdh_4" @@ -175,7 +176,7 @@ proto_qmi_setup() { proto_add_ipv6_address "$ip_6" "128" proto_add_ipv6_prefix "${ip_6}/${ip_prefix_length}" proto_add_ipv6_route "$gateway_6" "128" - proto_add_ipv6_route "::0" 0 "$gateway_6" "" "" "${ip_6}/${ip_prefix_length}" + proto_add_ipv6_route "::0" 0 "$gateway_6" "$metric" "" "${ip_6}/${ip_prefix_length}" proto_add_dns_server "$dns1_6" proto_add_dns_server "$dns2_6" proto_add_data @@ -204,6 +205,7 @@ proto_qmi_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)" } @@ -215,6 +217,7 @@ proto_qmi_setup() { json_add_string proto "dhcpv6" # RFC 7278: Extend an IPv6 /64 Prefix to LAN json_add_string extendprefix 1 + json_add_int metric $metric json_close_object ubus call network add_dynamic "$(json_dump)" }
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 <br1@einfach.org> --- 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(-)