diff mbox series

[LEDE-DEV] base-files: config_generate: keep ipv6 interface in sync

Message ID 20171205162247.13036-1-roman@advem.lv
State Rejected
Headers show
Series [LEDE-DEV] base-files: config_generate: keep ipv6 interface in sync | expand

Commit Message

Roman Yeryomin Dec. 5, 2017, 4:22 p.m. UTC
It's better not to configure ifname separately since they
are tied together.

Signed-off-by: Roman Yeryomin <roman@advem.lv>
---
 package/base-files/files/bin/config_generate | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hans Dedecker Dec. 5, 2017, 7:52 p.m. UTC | #1
On Tue, Dec 5, 2017 at 5:22 PM, Roman Yeryomin <roman@advem.lv> wrote:
> It's better not to configure ifname separately since they
> are tied together.
>
> Signed-off-by: Roman Yeryomin <roman@advem.lv>
> ---
>  package/base-files/files/bin/config_generate | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
> index a8311fc595..d7a6829d77 100755
> --- a/package/base-files/files/bin/config_generate
> +++ b/package/base-files/files/bin/config_generate
> @@ -113,7 +113,7 @@ generate_network() {
>                                 set network.$1.proto='dhcp'
>                                 delete network.${1}6
>                                 set network.${1}6='interface'
> -                               set network.${1}6.ifname='$ifname'
> +                               set network.${1}6.ifname='@${1}'
>                                 set network.${1}6.proto='dhcpv6'
>                         EOF
>                 ;;
> --
> 2.14.1
NACK

This makes the IPv6 interface dependant on the operational status of
the IPv4 interface; meaning the IPv6 interface will not be started if
the IPv4 interface does not get an IP address.
Especially this would break wan connectivity if the  wan link only supports IPv6

Hans
>
> _______________________________________________
> Lede-dev mailing list
> Lede-dev@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/lede-dev
Roman Yeryomin Dec. 5, 2017, 11:40 p.m. UTC | #2
On 2017-12-05 21:52, Hans Dedecker wrote:
> On Tue, Dec 5, 2017 at 5:22 PM, Roman Yeryomin <roman@advem.lv> wrote:
>> It's better not to configure ifname separately since they
>> are tied together.
>> 
>> Signed-off-by: Roman Yeryomin <roman@advem.lv>
>> ---
>>  package/base-files/files/bin/config_generate | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/package/base-files/files/bin/config_generate 
>> b/package/base-files/files/bin/config_generate
>> index a8311fc595..d7a6829d77 100755
>> --- a/package/base-files/files/bin/config_generate
>> +++ b/package/base-files/files/bin/config_generate
>> @@ -113,7 +113,7 @@ generate_network() {
>>                                 set network.$1.proto='dhcp'
>>                                 delete network.${1}6
>>                                 set network.${1}6='interface'
>> -                               set network.${1}6.ifname='$ifname'
>> +                               set network.${1}6.ifname='@${1}'
>>                                 set network.${1}6.proto='dhcpv6'
>>                         EOF
>>                 ;;
>> --
>> 2.14.1
> NACK
> 
> This makes the IPv6 interface dependant on the operational status of
> the IPv4 interface; meaning the IPv6 interface will not be started if
> the IPv4 interface does not get an IP address.
> Especially this would break wan connectivity if the  wan link only 
> supports IPv6
> 

Hmm... right, will just ${1} be better?

Regards,
Roman
Matthias Schiffer Dec. 6, 2017, 4:58 p.m. UTC | #3
On 12/06/2017 12:40 AM, Roman Yeryomin wrote:
> On 2017-12-05 21:52, Hans Dedecker wrote:
>> On Tue, Dec 5, 2017 at 5:22 PM, Roman Yeryomin <roman@advem.lv> wrote:
>>> It's better not to configure ifname separately since they
>>> are tied together.
>>>
>>> Signed-off-by: Roman Yeryomin <roman@advem.lv>
>>> ---
>>>  package/base-files/files/bin/config_generate | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/package/base-files/files/bin/config_generate
>>> b/package/base-files/files/bin/config_generate
>>> index a8311fc595..d7a6829d77 100755
>>> --- a/package/base-files/files/bin/config_generate
>>> +++ b/package/base-files/files/bin/config_generate
>>> @@ -113,7 +113,7 @@ generate_network() {
>>>                                 set network.$1.proto='dhcp'
>>>                                 delete network.${1}6
>>>                                 set network.${1}6='interface'
>>> -                               set network.${1}6.ifname='$ifname'
>>> +                               set network.${1}6.ifname='@${1}'
>>>                                 set network.${1}6.proto='dhcpv6'
>>>                         EOF
>>>                 ;;
>>> -- 
>>> 2.14.1
>> NACK
>>
>> This makes the IPv6 interface dependant on the operational status of
>> the IPv4 interface; meaning the IPv6 interface will not be started if
>> the IPv4 interface does not get an IP address.
>> Especially this would break wan connectivity if the  wan link only
>> supports IPv6
>>
> 
> Hmm... right, will just ${1} be better?
> 
> Regards,
> Roman

No, there is no real interface called 'wan', so it will simply not work at
all. Logical netifd interface names can only be used in alias
configurations, but aliases always add a depenency on the 'up' state of the
aliased interface (so aliases are mostly useful for interfaces that
actually depend on each other, like a interface depending on a lower interface.

If you want two configurations not to depend on each other, as we usually
want for IPv4/IPv6 setup, the current version '$ifname' is exactly right.
It is also the clearest solution semantically: IPv4 and IPv6 uplink are two
independent configurations that just share the same physical link in the
most common setups.

Regards,
Matthias
Daniel Golle Dec. 6, 2017, 5:17 p.m. UTC | #4
On Wed, Dec 06, 2017 at 05:58:18PM +0100, Matthias Schiffer wrote:
> On 12/06/2017 12:40 AM, Roman Yeryomin wrote:
> > On 2017-12-05 21:52, Hans Dedecker wrote:
> >> On Tue, Dec 5, 2017 at 5:22 PM, Roman Yeryomin <roman@advem.lv> wrote:
> >>> It's better not to configure ifname separately since they
> >>> are tied together.
> >>>
> >>> Signed-off-by: Roman Yeryomin <roman@advem.lv>
> >>> ---
> >>>  package/base-files/files/bin/config_generate | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/package/base-files/files/bin/config_generate
> >>> b/package/base-files/files/bin/config_generate
> >>> index a8311fc595..d7a6829d77 100755
> >>> --- a/package/base-files/files/bin/config_generate
> >>> +++ b/package/base-files/files/bin/config_generate
> >>> @@ -113,7 +113,7 @@ generate_network() {
> >>>                                 set network.$1.proto='dhcp'
> >>>                                 delete network.${1}6
> >>>                                 set network.${1}6='interface'
> >>> -                               set network.${1}6.ifname='$ifname'
> >>> +                               set network.${1}6.ifname='@${1}'
> >>>                                 set network.${1}6.proto='dhcpv6'
> >>>                         EOF
> >>>                 ;;
> >>> -- 
> >>> 2.14.1
> >> NACK
> >>
> >> This makes the IPv6 interface dependant on the operational status of
> >> the IPv4 interface; meaning the IPv6 interface will not be started if
> >> the IPv4 interface does not get an IP address.
> >> Especially this would break wan connectivity if the  wan link only
> >> supports IPv6
> >>
> > 
> > Hmm... right, will just ${1} be better?
> > 
> > Regards,
> > Roman
> 
> No, there is no real interface called 'wan', so it will simply not work at
> all. Logical netifd interface names can only be used in alias
> configurations, but aliases always add a depenency on the 'up' state of the
> aliased interface (so aliases are mostly useful for interfaces that
> actually depend on each other, like a interface depending on a lower interface.
> 
> If you want two configurations not to depend on each other, as we usually
> want for IPv4/IPv6 setup, the current version '$ifname' is exactly right.
> It is also the clearest solution semantically: IPv4 and IPv6 uplink are two
> independent configurations that just share the same physical link in the
> most common setups.

In case the interface-name changes dynamically during runtime (such as
for L2TPv3, ...) we could introduce a common parent with proto 'none'
and then have two child interfaces wan4 and wan6 which refer to the
common parent using the '@' notation.


Cheers


Daniel
diff mbox series

Patch

diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index a8311fc595..d7a6829d77 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -113,7 +113,7 @@  generate_network() {
 				set network.$1.proto='dhcp'
 				delete network.${1}6
 				set network.${1}6='interface'
-				set network.${1}6.ifname='$ifname'
+				set network.${1}6.ifname='@${1}'
 				set network.${1}6.proto='dhcpv6'
 			EOF
 		;;