diff mbox

[OpenWrt-Devel,v2] axs10x: initilaze network for wireless access-point

Message ID 1449506718-16547-1-git-send-email-abrodkin@synopsys.com
State Rejected
Headers show

Commit Message

Alexey Brodkin Dec. 7, 2015, 4:45 p.m. UTC
ARC SDP board sports only 1 network interface - eth0,
so to operate as an access point it requires at least
another interface (preferably wireless),
so USB Wi-Fi dongle is what we want.

And with USB Wi-Fi dongle attached ARC SDP board could be
used as a "dumb" wireless access point.

Now with modified network setup script it is only required
to enable wireless radio on the first boot with
-------------->8------------
uci set wireless.radio0.disabled=0
uci commit wireless
wifi
-------------->8------------

Note if by the time initscripts are executed USB Wi-Fi
dongle not yet recognized and set up by Linux kernel
its autodetection by "wifi" tool may not happen
automatically. In that case before issuing command above
one needs to populate /etc/config/wireless config:
-------------->8------------
wifi detect > /etc/config/wireless
-------------->8------------

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Felix Fietkau <nbd@openwrt.org>
Cc: Jo-Philipp Wich <jow@openwrt.org>
Cc: Jonas Gorski <jogo@openwrt.org>
---

Changes compared to v1:
 * Rebased on top of current master

 target/linux/arc770/base-files/etc/board.d/02_network | 1 +
 1 file changed, 1 insertion(+)

Comments

Felix Fietkau Dec. 7, 2015, 4:49 p.m. UTC | #1
On 2015-12-07 17:45, Alexey Brodkin wrote:
> ARC SDP board sports only 1 network interface - eth0,
> so to operate as an access point it requires at least
> another interface (preferably wireless),
> so USB Wi-Fi dongle is what we want.
> 
> And with USB Wi-Fi dongle attached ARC SDP board could be
> used as a "dumb" wireless access point.
> 
> Now with modified network setup script it is only required
> to enable wireless radio on the first boot with
> -------------->8------------
> uci set wireless.radio0.disabled=0
> uci commit wireless
> wifi
> -------------->8------------
> 
> Note if by the time initscripts are executed USB Wi-Fi
> dongle not yet recognized and set up by Linux kernel
> its autodetection by "wifi" tool may not happen
> automatically. In that case before issuing command above
> one needs to populate /etc/config/wireless config:
> -------------->8------------
> wifi detect > /etc/config/wireless
> -------------->8------------
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Felix Fietkau <nbd@openwrt.org>
> Cc: Jo-Philipp Wich <jow@openwrt.org>
> Cc: Jonas Gorski <jogo@openwrt.org>
> ---
> 
> Changes compared to v1:
>  * Rebased on top of current master
> 
>  target/linux/arc770/base-files/etc/board.d/02_network | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base-files/etc/board.d/02_network
> index cd5ad2d..7c74d2d 100755
> --- a/target/linux/arc770/base-files/etc/board.d/02_network
> +++ b/target/linux/arc770/base-files/etc/board.d/02_network
> @@ -11,6 +11,7 @@ board_config_update
>  case "$( arc_board_name )" in
>  "arc-sdp"*)
>  	ucidef_set_interface_lan "eth0" "dhcp"
> +	uci set network.lan.type='bridge'
board.d files should not be calling uci, and I don't think this line
even works. By the way, I don't think such a change is needed anymore,
did you test the current code as-is?

- Felix
Alexey Brodkin Dec. 7, 2015, 4:57 p.m. UTC | #2
Hi Felix,

On Mon, 2015-12-07 at 17:49 +0100, Felix Fietkau wrote:
> On 2015-12-07 17:45, Alexey Brodkin wrote:
> > ARC SDP board sports only 1 network interface - eth0,
> > so to operate as an access point it requires at least
> > another interface (preferably wireless),
> > so USB Wi-Fi dongle is what we want.
> > 
> > And with USB Wi-Fi dongle attached ARC SDP board could be
> > used as a "dumb" wireless access point.
> > 
> > Now with modified network setup script it is only required
> > to enable wireless radio on the first boot with
> > -------------->8------------
> > uci set wireless.radio0.disabled=0
> > uci commit wireless
> > wifi
> > -------------->8------------
> > 
> > Note if by the time initscripts are executed USB Wi-Fi
> > dongle not yet recognized and set up by Linux kernel
> > its autodetection by "wifi" tool may not happen
> > automatically. In that case before issuing command above
> > one needs to populate /etc/config/wireless config:
> > -------------->8------------
> > wifi detect > /etc/config/wireless
> > -------------->8------------
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > Cc: Felix Fietkau <nbd@openwrt.org>
> > Cc: Jo-Philipp Wich <jow@openwrt.org>
> > Cc: Jonas Gorski <jogo@openwrt.org>
> > ---
> > 
> > Changes compared to v1:
> >  * Rebased on top of current master
> > 
> >  target/linux/arc770/base-files/etc/board.d/02_network | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base
> > -files/etc/board.d/02_network
> > index cd5ad2d..7c74d2d 100755
> > --- a/target/linux/arc770/base-files/etc/board.d/02_network
> > +++ b/target/linux/arc770/base-files/etc/board.d/02_network
> > @@ -11,6 +11,7 @@ board_config_update
> >  case "$( arc_board_name )" in
> >  "arc-sdp"*)
> >  	ucidef_set_interface_lan "eth0" "dhcp"
> > +	uci set network.lan.type='bridge'
> board.d files should not be calling uci, and I don't think this line
> even works. By the way, I don't think such a change is needed anymore,
> did you test the current code as-is?

Frankly I havent's tested it yet.
From that patch http://git.openwrt.org/?p=openwrt.git;a=commitdiff;h=d0c35cbea6d55ddf2bff16e909ddf4feb6779aa5
I was under impression that this is only a matter of where init scripts
were moved.

BTW I should have named that patch v3, because v2 was sitting in patchwork
for about 2 weeks already. And since "real" v2 patch does work, see http://patchwork.ozlabs.org/patch/548641/
(which is tested many times as of today) I floated "v3" right after rebase of my local repo.

Any thoughts how I may setup a bridge on eth0 in init scripts in board.d?

-Alexey
Jo-Philipp Wich Dec. 7, 2015, 5:01 p.m. UTC | #3
Hi Alexey,
> Any thoughts how I may setup a bridge on eth0 in init scripts in board.d?

with board.d, the lan interface will always be of type bridge. There is
no way to declare non-bridge lan ifaces anymore.

~ Jow
Felix Fietkau Dec. 7, 2015, 5:01 p.m. UTC | #4
On 2015-12-07 17:57, Alexey Brodkin wrote:
> Hi Felix,
> 
> On Mon, 2015-12-07 at 17:49 +0100, Felix Fietkau wrote:
>> On 2015-12-07 17:45, Alexey Brodkin wrote:
>> > ARC SDP board sports only 1 network interface - eth0,
>> > so to operate as an access point it requires at least
>> > another interface (preferably wireless),
>> > so USB Wi-Fi dongle is what we want.
>> > 
>> > And with USB Wi-Fi dongle attached ARC SDP board could be
>> > used as a "dumb" wireless access point.
>> > 
>> > Now with modified network setup script it is only required
>> > to enable wireless radio on the first boot with
>> > -------------->8------------
>> > uci set wireless.radio0.disabled=0
>> > uci commit wireless
>> > wifi
>> > -------------->8------------
>> > 
>> > Note if by the time initscripts are executed USB Wi-Fi
>> > dongle not yet recognized and set up by Linux kernel
>> > its autodetection by "wifi" tool may not happen
>> > automatically. In that case before issuing command above
>> > one needs to populate /etc/config/wireless config:
>> > -------------->8------------
>> > wifi detect > /etc/config/wireless
>> > -------------->8------------
>> > 
>> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
>> > Cc: Felix Fietkau <nbd@openwrt.org>
>> > Cc: Jo-Philipp Wich <jow@openwrt.org>
>> > Cc: Jonas Gorski <jogo@openwrt.org>
>> > ---
>> > 
>> > Changes compared to v1:
>> >  * Rebased on top of current master
>> > 
>> >  target/linux/arc770/base-files/etc/board.d/02_network | 1 +
>> >  1 file changed, 1 insertion(+)
>> > 
>> > diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base
>> > -files/etc/board.d/02_network
>> > index cd5ad2d..7c74d2d 100755
>> > --- a/target/linux/arc770/base-files/etc/board.d/02_network
>> > +++ b/target/linux/arc770/base-files/etc/board.d/02_network
>> > @@ -11,6 +11,7 @@ board_config_update
>> >  case "$( arc_board_name )" in
>> >  "arc-sdp"*)
>> >  	ucidef_set_interface_lan "eth0" "dhcp"
>> > +	uci set network.lan.type='bridge'
>> board.d files should not be calling uci, and I don't think this line
>> even works. By the way, I don't think such a change is needed anymore,
>> did you test the current code as-is?
> 
> Frankly I havent's tested it yet.
> From that patch http://git.openwrt.org/?p=openwrt.git;a=commitdiff;h=d0c35cbea6d55ddf2bff16e909ddf4feb6779aa5
> I was under impression that this is only a matter of where init scripts
> were moved.
Not quite. The new files use a different implementation of a similar API
which doesn't generate any uci calls directly anymore. Instead, an
intermediate file - /etc/board.json - is emitted, which gets used to
generate the default config in a generic way.

> BTW I should have named that patch v3, because v2 was sitting in patchwork
> for about 2 weeks already. And since "real" v2 patch does work, see http://patchwork.ozlabs.org/patch/548641/
> (which is tested many times as of today) I floated "v3" right after rebase of my local repo.
> 
> Any thoughts how I may setup a bridge on eth0 in init scripts in board.d?
Please test the current code, it should have a bridge automatically
without any changes to the existing scripts.

- Felix
Alexey Brodkin Dec. 7, 2015, 5:05 p.m. UTC | #5
Hi Felix,

On Mon, 2015-12-07 at 18:01 +0100, Felix Fietkau wrote:
> On 2015-12-07 17:57, Alexey Brodkin wrote:
> > Hi Felix,
> > 
> > On Mon, 2015-12-07 at 17:49 +0100, Felix Fietkau wrote:
> > > On 2015-12-07 17:45, Alexey Brodkin wrote:
> > > > ARC SDP board sports only 1 network interface - eth0,
> > > > so to operate as an access point it requires at least
> > > > another interface (preferably wireless),
> > > > so USB Wi-Fi dongle is what we want.
> > > > 
> > > > And with USB Wi-Fi dongle attached ARC SDP board could be
> > > > used as a "dumb" wireless access point.
> > > > 
> > > > Now with modified network setup script it is only required
> > > > to enable wireless radio on the first boot with
> > > > -------------->8------------
> > > > uci set wireless.radio0.disabled=0
> > > > uci commit wireless
> > > > wifi
> > > > -------------->8------------
> > > > 
> > > > Note if by the time initscripts are executed USB Wi-Fi
> > > > dongle not yet recognized and set up by Linux kernel
> > > > its autodetection by "wifi" tool may not happen
> > > > automatically. In that case before issuing command above
> > > > one needs to populate /etc/config/wireless config:
> > > > -------------->8------------
> > > > wifi detect > /etc/config/wireless
> > > > -------------->8------------
> > > > 
> > > > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > > > Cc: Felix Fietkau <nbd@openwrt.org>
> > > > Cc: Jo-Philipp Wich <jow@openwrt.org>
> > > > Cc: Jonas Gorski <jogo@openwrt.org>
> > > > ---
> > > > 
> > > > Changes compared to v1:
> > > >  * Rebased on top of current master
> > > > 
> > > >  target/linux/arc770/base-files/etc/board.d/02_network | 1 +
> > > >  1 file changed, 1 insertion(+)
> > > > 
> > > > diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base
> > > > -files/etc/board.d/02_network
> > > > index cd5ad2d..7c74d2d 100755
> > > > --- a/target/linux/arc770/base-files/etc/board.d/02_network
> > > > +++ b/target/linux/arc770/base-files/etc/board.d/02_network
> > > > @@ -11,6 +11,7 @@ board_config_update
> > > >  case "$( arc_board_name )" in
> > > >  "arc-sdp"*)
> > > >  	ucidef_set_interface_lan "eth0" "dhcp"
> > > > +	uci set network.lan.type='bridge'
> > > board.d files should not be calling uci, and I don't think this line
> > > even works. By the way, I don't think such a change is needed anymore,
> > > did you test the current code as-is?
> > 
> > Frankly I havent's tested it yet.
> > From that patch http://git.openwrt.org/?p=openwrt.git;a=commitdiff;h=d0c35cbea6d55ddf2bff16e909ddf4feb6779aa5
> > I was under impression that this is only a matter of where init scripts
> > were moved.
> Not quite. The new files use a different implementation of a similar API
> which doesn't generate any uci calls directly anymore. Instead, an
> intermediate file - /etc/board.json - is emitted, which gets used to
> generate the default config in a generic way.

Thanks for explanation.

> > BTW I should have named that patch v3, because v2 was sitting in patchwork
> > for about 2 weeks already. And since "real" v2 patch does work, see http://patchwork.ozlabs.org/patch/548641/
> > (which is tested many times as of today) I floated "v3" right after rebase of my local repo.
> > 
> > Any thoughts how I may setup a bridge on eth0 in init scripts in board.d?
> Please test the current code, it should have a bridge automatically
> without any changes to the existing scripts.

Sure, let me try it on my board and if I still see any issues
I'll let you know.

-Alexey
diff mbox

Patch

diff --git a/target/linux/arc770/base-files/etc/board.d/02_network b/target/linux/arc770/base-files/etc/board.d/02_network
index cd5ad2d..7c74d2d 100755
--- a/target/linux/arc770/base-files/etc/board.d/02_network
+++ b/target/linux/arc770/base-files/etc/board.d/02_network
@@ -11,6 +11,7 @@  board_config_update
 case "$( arc_board_name )" in
 "arc-sdp"*)
 	ucidef_set_interface_lan "eth0" "dhcp"
+	uci set network.lan.type='bridge'
 	;;
 esac