Re: [LEDE-DEV] [PATCH] netifd-proto.sh: add ip4table & ip6table to `proto_add_dynamic_defaults()`

2017-09-10 Thread Alexandru Ardelean
On Sat, Sep 9, 2017 at 10:51 PM, Baptiste Jonglez
 wrote:
> On 09-09-17, Baptiste Jonglez wrote:
>> On 05-09-17, Alexandru Ardelean wrote:
>> > The `proto_add_dynamic_defaults()` seems to be called mostly
>> > in the context of LTE/3G modems (via wwan, qmi, etc) setup.
>> >
>> > When they get setup, these devices override default routes.
>> >
>> > However, depending on setup, we want these modems to
>> > be part of a another routing table.
>> > This change allows that.
>> >
>> > ip4table/ip6table are of string type in netifd to allow
>> > for `default`, `local` routing table names to be specified.
>>
>> Just a remark on the names: "ip4table" and "ip6table" make it looks like
>> it's related to firewall.  But this has nothing to do with firewalls.
>>
>> Maybe use "routingtable" and "routingtablev6" instead?  Or just
>> "table"/"tablev6"?
>
> It seems that "ip4table" and "ip6table" is already understood by other
> protocols, so you can disregard my remark:
>
> https://wiki.openwrt.org/doc/uci/network#options_valid_for_all_protocol_types

This got into my spam folder for some reason.
GMail is weird sometimes.

I still have to try this out a bit more.
I'm load-balancing various stuff, so I did not get to try out stuff in depth.

Atm I'm doing:
config interface 'usb0_1'
 option ifname 'usb0'
 option proto 'wwan'
 option ip4table 100
 option ip6table 100

This seems to make an interface [in netifd] called
network.interface.usb0_1  which adds the ip4table/ip6table to usb0.
However, for some reason [likely a bug with my config generation code]
the DHCP part is not initializing properly ; well for some reason no
RX packets are incoming.
I'll dig into that.

My trip through getting LTE setup on our system was a bit interesting.
At some point, I've found that the modem needs a backport from the
upstream kernel.
For the 4.4 kernel, this is needed for some QMI modems:
https://github.com/torvalds/linux/commit/93725149794d3d418cf1eddcae60c7b536c5faa1

Otherwise, the modem does not init. That patch should be in 4.5 though.


>
>
>> > Signed-off-by: Alexandru Ardelean 
>> > ---
>> >  scripts/netifd-proto.sh | 2 ++
>> >  1 file changed, 2 insertions(+)
>> >
>> > diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
>> > index cc7031a..fd7b596 100644
>> > --- a/scripts/netifd-proto.sh
>> > +++ b/scripts/netifd-proto.sh
>> > @@ -26,6 +26,8 @@ proto_add_dynamic_defaults() {
>> > [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
>> > [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
>> > [ -n "$metric" ] && json_add_int metric "$metric"
>> > +   [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
>> > +   [ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
>> >  }
>> >
>> >  _proto_do_teardown() {
>
>

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] netifd-proto.sh: add ip4table & ip6table to `proto_add_dynamic_defaults()`

2017-09-09 Thread Baptiste Jonglez
On 09-09-17, Baptiste Jonglez wrote:
> On 05-09-17, Alexandru Ardelean wrote:
> > The `proto_add_dynamic_defaults()` seems to be called mostly
> > in the context of LTE/3G modems (via wwan, qmi, etc) setup.
> > 
> > When they get setup, these devices override default routes.
> > 
> > However, depending on setup, we want these modems to
> > be part of a another routing table.
> > This change allows that.
> > 
> > ip4table/ip6table are of string type in netifd to allow
> > for `default`, `local` routing table names to be specified.
> 
> Just a remark on the names: "ip4table" and "ip6table" make it looks like
> it's related to firewall.  But this has nothing to do with firewalls.
> 
> Maybe use "routingtable" and "routingtablev6" instead?  Or just
> "table"/"tablev6"?

It seems that "ip4table" and "ip6table" is already understood by other
protocols, so you can disregard my remark:

https://wiki.openwrt.org/doc/uci/network#options_valid_for_all_protocol_types


> > Signed-off-by: Alexandru Ardelean 
> > ---
> >  scripts/netifd-proto.sh | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
> > index cc7031a..fd7b596 100644
> > --- a/scripts/netifd-proto.sh
> > +++ b/scripts/netifd-proto.sh
> > @@ -26,6 +26,8 @@ proto_add_dynamic_defaults() {
> > [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
> > [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
> > [ -n "$metric" ] && json_add_int metric "$metric"
> > +   [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
> > +   [ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
> >  }
> >  
> >  _proto_do_teardown() {




signature.asc
Description: PGP signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] netifd-proto.sh: add ip4table & ip6table to `proto_add_dynamic_defaults()`

2017-09-09 Thread Baptiste Jonglez
Hi,

On 05-09-17, Alexandru Ardelean wrote:
> The `proto_add_dynamic_defaults()` seems to be called mostly
> in the context of LTE/3G modems (via wwan, qmi, etc) setup.
> 
> When they get setup, these devices override default routes.
> 
> However, depending on setup, we want these modems to
> be part of a another routing table.
> This change allows that.
> 
> ip4table/ip6table are of string type in netifd to allow
> for `default`, `local` routing table names to be specified.

Just a remark on the names: "ip4table" and "ip6table" make it looks like
it's related to firewall.  But this has nothing to do with firewalls.

Maybe use "routingtable" and "routingtablev6" instead?  Or just
"table"/"tablev6"?

> Signed-off-by: Alexandru Ardelean 
> ---
>  scripts/netifd-proto.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
> index cc7031a..fd7b596 100644
> --- a/scripts/netifd-proto.sh
> +++ b/scripts/netifd-proto.sh
> @@ -26,6 +26,8 @@ proto_add_dynamic_defaults() {
>   [ -n "$defaultroute" ] && json_add_boolean defaultroute "$defaultroute"
>   [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
>   [ -n "$metric" ] && json_add_int metric "$metric"
> + [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
> + [ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
>  }
>  
>  _proto_do_teardown() {


signature.asc
Description: PGP signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] netifd-proto.sh: add ip4table & ip6table to `proto_add_dynamic_defaults()`

2017-09-05 Thread Alexandru Ardelean
On Tue, Sep 5, 2017 at 11:05 PM, Hans Dedecker  wrote:
> On Tue, Sep 5, 2017 at 1:39 PM, Alexandru Ardelean
>  wrote:
>> The `proto_add_dynamic_defaults()` seems to be called mostly
>> in the context of LTE/3G modems (via wwan, qmi, etc) setup.
>>
>> When they get setup, these devices override default routes.
>>
>> However, depending on setup, we want these modems to
>> be part of a another routing table.
>> This change allows that.
>>
>> ip4table/ip6table are of string type in netifd to allow
>> for `default`, `local` routing table names to be specified.
>>
>> Signed-off-by: Alexandru Ardelean 
>> ---
>>  scripts/netifd-proto.sh | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
>> index cc7031a..fd7b596 100644
>> --- a/scripts/netifd-proto.sh
>> +++ b/scripts/netifd-proto.sh
>> @@ -26,6 +26,8 @@ proto_add_dynamic_defaults() {
>> [ -n "$defaultroute" ] && json_add_boolean defaultroute 
>> "$defaultroute"
>> [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
>> [ -n "$metric" ] && json_add_int metric "$metric"
>> +   [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
>> +   [ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
> I doubt this is a correct approach as the defaults defaultroute,
> peerdns and metric are common defaults for all IPv4/IPv6 interfaces
> while ip4table is only relevant for IPv4 interface while ip6table only
> for IPv6 interfaces.
> Looking into directip.sh and the usage of proto_add_dynamic_defaults
> this change would add both ip4table but also ip6table (if defined) to
> the dynamic created DHCP interface.
> A better approach would be to add ip4table and ip6table individually
> similar as is done for the extendprefix option (which is also only
> relevant for the DHCPv6 interfaces)
>
> Hans

Thanks for the quick reply.

Will check on your proposed alternative.

Thanks
Alex

>>  }
>>
>>  _proto_do_teardown() {
>> --
>> 2.11.0
>>

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] netifd-proto.sh: add ip4table & ip6table to `proto_add_dynamic_defaults()`

2017-09-05 Thread Hans Dedecker
On Tue, Sep 5, 2017 at 1:39 PM, Alexandru Ardelean
 wrote:
> The `proto_add_dynamic_defaults()` seems to be called mostly
> in the context of LTE/3G modems (via wwan, qmi, etc) setup.
>
> When they get setup, these devices override default routes.
>
> However, depending on setup, we want these modems to
> be part of a another routing table.
> This change allows that.
>
> ip4table/ip6table are of string type in netifd to allow
> for `default`, `local` routing table names to be specified.
>
> Signed-off-by: Alexandru Ardelean 
> ---
>  scripts/netifd-proto.sh | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
> index cc7031a..fd7b596 100644
> --- a/scripts/netifd-proto.sh
> +++ b/scripts/netifd-proto.sh
> @@ -26,6 +26,8 @@ proto_add_dynamic_defaults() {
> [ -n "$defaultroute" ] && json_add_boolean defaultroute 
> "$defaultroute"
> [ -n "$peerdns" ] && json_add_boolean peerdns "$peerdns"
> [ -n "$metric" ] && json_add_int metric "$metric"
> +   [ -n "$ip4table" ] && json_add_string ip4table "$ip4table"
> +   [ -n "$ip6table" ] && json_add_string ip6table "$ip6table"
I doubt this is a correct approach as the defaults defaultroute,
peerdns and metric are common defaults for all IPv4/IPv6 interfaces
while ip4table is only relevant for IPv4 interface while ip6table only
for IPv6 interfaces.
Looking into directip.sh and the usage of proto_add_dynamic_defaults
this change would add both ip4table but also ip6table (if defined) to
the dynamic created DHCP interface.
A better approach would be to add ip4table and ip6table individually
similar as is done for the extendprefix option (which is also only
relevant for the DHCPv6 interfaces)

Hans
>  }
>
>  _proto_do_teardown() {
> --
> 2.11.0
>

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev