Hi

The patch work ok for me (tested with wr1043nd and rspro, both ath9k)
For information, we still need to disable hwcrypt, for exemple by editing 
'/etc/modules.d/28-ath9k' and putting 'ath9k nohwcrypt=1' in it


Le 03/06/2013 15:57, Emanuel Taube a écrit :
> This patch modifies the uci scripts to be able to
> start meshd-nl80211 for encrypted mesh networks,
> therefor a new script (authsae.sh) is inserted.
>
> Signed-off-by: Emanuel Taube <emanuel.ta...@gmail.com>
>
> diff --git a/package/mac80211/files/lib/wifi/mac80211.sh 
> b/package/mac80211/files/lib/wifi/mac80211.sh
> index a052a1c..a79b6b8 100644
> --- a/package/mac80211/files/lib/wifi/mac80211.sh
> +++ b/package/mac80211/files/lib/wifi/mac80211.sh
> @@ -251,7 +251,7 @@ disable_mac80211() (
>       include /lib/network
>       for wdev in $(list_phy_interfaces "$phy"); do
>               [ -f "/var/run/$wdev.pid" ] && kill $(cat /var/run/$wdev.pid) 
> >&/dev/null 2>&1
> -             for pid in `pidof wpa_supplicant`; do
> +             for pid in `pidof wpa_supplicant` `pidof meshd-nl80211`; do
>                       grep "$wdev" /proc/$pid/cmdline >/dev/null && \
>                               kill $pid
>               done
> @@ -370,8 +370,13 @@ enable_mac80211() {
>                               [ "$apidx" -gt 1 ] || iw phy "$phy" interface 
> add "$ifname" type managed
>                       ;;
>                       mesh)
> -                             config_get mesh_id "$vif" mesh_id
> -                             iw phy "$phy" interface add "$ifname" type mp 
> mesh_id "$mesh_id"
> +                             config_get key "$vif" key ""
> +                             if [ -n "$key" ]; then
> +                                     iw phy "$phy" interface add "$ifname" 
> type mp
> +                             else
> +                                     config_get mesh_id "$vif" mesh_id
> +                                     iw phy "$phy" interface add "$ifname" 
> type mp mesh_id "$mesh_id"
> +                             fi
>                       ;;
>                       monitor)
>                               iw phy "$phy" interface add "$ifname" type 
> monitor
> @@ -426,9 +431,16 @@ enable_mac80211() {
>       rm -f /var/run/hostapd-$phy.conf
>       for vif in $vifs; do
>               config_get mode "$vif" mode
> -             [ "$mode" = "ap" ] || continue
> -             mac80211_hostapd_setup_bss "$phy" "$vif"
> -             start_hostapd=1
> +             case "$mode" in
> +                     ap)
> +                             mac80211_hostapd_setup_bss "$phy" "$vif"
> +                             start_hostapd=1
> +                     ;;
> +                     mesh)
> +                             config_get key "$vif" key ""
> +                             [ -n "$key" ] && authsae_start_interface 
> "$device" "$vif"
> +                     ;;
> +             esac
>       done
>  
>       [ -n "$start_hostapd" ] && {
> diff --git a/package/network/services/authsae/Makefile 
> b/package/network/services/authsae/Makefile
> index 63320ae..4232653 100644
> --- a/package/network/services/authsae/Makefile
> +++ b/package/network/services/authsae/Makefile
> @@ -37,6 +37,8 @@ TARGET_CFLAGS += -D_GNU_SOURCE
>  define Package/authsae/install
>       $(INSTALL_DIR) $(1)/usr/bin
>       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
> +     $(INSTALL_DIR) $(1)/lib/wifi
> +     $(INSTALL_DATA) ./files/lib/wifi/authsae.sh $(1)/lib/wifi/
>  endef
>  
>  $(eval $(call BuildPackage,authsae))
> diff --git a/package/network/services/authsae/files/lib/wifi/authsae.sh 
> b/package/network/services/authsae/files/lib/wifi/authsae.sh
> new file mode 100644
> index 0000000..daa43eb
> --- /dev/null
> +++ b/package/network/services/authsae/files/lib/wifi/authsae.sh
> @@ -0,0 +1,53 @@
> +authsae_start_interface() {
> +     local device="$1" # to use the correct channel
> +     local vif="$2"
> +     local band
> +
> +     cfgfile="/var/run/authsae-$vif.cfg"
> +     config_get channel "$device" channel
> +     config_get hwmode "$device" hwmode
> +     config_get htmode "$device" htmode
> +     config_get ifname "$vif" ifname
> +     config_get key "$vif" key
> +     config_get mesh_id "$vif" mesh_id
> +     config_get mcast_rate "$vif" mcast_rate "12"
> +
> +     case "$htmode" in
> +             HT20|HT40+|HT40-) htmode="$htmode";;
> +             NOHT|none|*) htmode="none";;
> +     esac
> +
> +     case "$hwmode" in
> +             *g*) band=11g;;
> +             *a*) band=11a;;
> +     esac
> +
> +     cat > "$cfgfile" <<EOF
> +authsae:
> +{
> + sae:
> +  {
> +    debug = 0;
> +    password = "$key";
> +    group = [19, 26, 21, 25, 20];
> +    blacklist = 5;
> +    thresh = 5;
> +    lifetime = 3600;
> +  };
> + meshd:
> +  {
> +    meshid = "$mesh_id";
> +    interface = "$ifname";
> +    passive = 0;
> +    debug = 0;
> +    mediaopt = 1;
> +    band = "$band";
> +    channel = $channel;
> +    htmode = "$htmode";
> +    mcast-rate = $mcast_rate;
> +  };
> +};
> +EOF
> +     ifconfig "$ifname" up
> +     meshd-nl80211 -i "$ifname" -s "$mesh_id" -c "$cfgfile" -B
> +}

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to