[PATCH] relayd: don't break localhost

2021-07-09 Thread Dmitry Ivanov via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Relayd is adding default route to its routing tables when it's found in
DHCP response. Adding default route to routing table associated with
loopback interface makes no sense other than breaking localhost so that
DNS requests to local dnsmasq and even "ping 127.0.0.1" go to default
gateway.

This patch prevents insertion of default route into "localhost" policy
routing table created by relayd.

Signed-off-by: Dmitry Ivanov 
---
 route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/route.c b/route.c
index c552d1f..f7cf815 100644
--- a/route.c
+++ b/route.c
@@ -243,7 +243,7 @@ rtnl_route_set(struct relayd_host *host, struct 
relayd_route *route, bool add)
 
rtnl_route_request(rif, host, route, add);
}
-   if (local_route_table)
+   if (local_route_table && route && route->mask)
rtnl_route_request(NULL, host, route, add);
 }
 
-- 
2.30.2





--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2] wpa_supplicant: set regulatory domain the same way as hostapd

2015-12-23 Thread Dmitry Ivanov
In sta-only configuration, wpa_supplicant needs correct regulatory
domain because otherwise it may skip channel of its AP during scan.

Another alternative is to fix "iw reg set" in mac80211 netifd script.
Currently it fails if some phy has private regulatory domain which
matches configured one.

Signed-off-by: Dmitry Ivanov 
---
 package/network/services/hostapd/files/netifd.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 5541e4d..6aca7f7 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -536,9 +536,15 @@ wpa_supplicant_prepare_interface() {
_w_modestr="mode=1"
}
 
+   local country_str=
+   [ -n "$country" ] && {
+   country_str="country=$country"
+   }
+
wpa_supplicant_teardown_interface "$ifname"
cat > "$_config" <https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] wpa_supplicant: set regulatory domain the same way as hostapd

2015-12-23 Thread Dmitry Ivanov
In sta-only configuration, wpa_supplicant needs correct regulatory
domain because otherwise it may skip channel of its AP during scan.

Another alternative is to fix "iw reg set" in mac80211 netifd script.
Currently it fails if some phy has private regulatory domain which
matches configured one.

Signed-off-by: Dmitry Ivanov 
---
 package/network/services/hostapd/files/netifd.sh | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/package/network/services/hostapd/files/netifd.sh 
b/package/network/services/hostapd/files/netifd.sh
index 5541e4d..6aca7f7 100644
--- a/package/network/services/hostapd/files/netifd.sh
+++ b/package/network/services/hostapd/files/netifd.sh
@@ -536,9 +536,15 @@ wpa_supplicant_prepare_interface() {
_w_modestr="mode=1"
}
 
+   local country_str=
+   [ -n "$network_bridge" ] && {
+   country_str="country=$country"
+   }
+
wpa_supplicant_teardown_interface "$ifname"
cat > "$_config" <https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Allow scan of single channel

2015-12-17 Thread Dmitry Ivanov
Sometimes it is enough to scan single channel only. This is much faster
than scanning all of them and ingnoring unnecessary data.

Signed-off-by: Dmitry Ivanov 
---
 include/iwinfo.h |  1 +
 iwinfo_cli.c | 65 
 iwinfo_nl80211.c | 33 +---
 3 files changed, 73 insertions(+), 26 deletions(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index f8cec73..e5ea48e 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -202,6 +202,7 @@ struct iwinfo_ops {
int (*assoclist)(const char *, char *, int *);
int (*txpwrlist)(const char *, char *, int *);
int (*scanlist)(const char *, char *, int *);
+   int (*scanlist2)(const char *, char *, int *, unsigned int);
int (*freqlist)(const char *, char *, int *);
int (*countrylist)(const char *, char *, int *);
int (*lookup_phy)(const char *, char *);
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index 7cb90c2..b0cc76d 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -562,18 +562,32 @@ static void print_info(const struct iwinfo_ops *iw, const 
char *ifname)
 }
 
 
-static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname)
+static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname, 
unsigned int freq)
 {
int i, x, len;
char buf[IWINFO_BUFSIZE];
struct iwinfo_scanlist_entry *e;
 
-   if (iw->scanlist(ifname, buf, &len))
+   if (freq)
+   {
+   if (!iw->scanlist2)
+   {
+   printf("Scanning of specific frequency not 
implemented\n\n");
+   return;
+   }
+   if (iw->scanlist2(ifname, buf, &len, freq))
+   {
+   printf("Scanning of specific frequency not 
possible\n\n");
+   return;
+   }
+   }
+   else if (iw->scanlist(ifname, buf, &len))
{
printf("Scanning not possible\n\n");
return;
}
-   else if (len <= 0)
+
+   if (len <= 0)
{
printf("No scan results\n\n");
return;
@@ -794,6 +808,7 @@ int main(int argc, char **argv)
"Usage:\n"
"   iwinfo  info\n"
"   iwinfo  scan\n"
+   "   iwinfo  scan \n"
"   iwinfo  txpowerlist\n"
"   iwinfo  freqlist\n"
"   iwinfo  assoclist\n"
@@ -831,25 +846,37 @@ int main(int argc, char **argv)
 
if (argc > 3)
{
-   iw = iwinfo_backend_by_name(argv[1]);
-
-   if (!iw)
-   {
-   fprintf(stderr, "No such wireless backend: %s\n", 
argv[1]);
-   rv = 1;
-   }
-   else
+   switch (argv[2][0])
{
-   switch (argv[2][0])
+   case 'p':
+   iw = iwinfo_backend_by_name(argv[1]);
+
+   if (!iw)
{
-   case 'p':
-   lookup_phy(iw, argv[3]);
-   break;
+   fprintf(stderr, "No such wireless backend: 
%s\n", argv[1]);
+   rv = 1;
+   goto finish;
+   }
+
+   lookup_phy(iw, argv[3]);
+   break;
+
+   case 's':
+   iw = iwinfo_backend(argv[1]);
 
-   default:
-   fprintf(stderr, "Unknown command: %s\n", 
argv[2]);
+   if (!iw)
+   {
+   fprintf(stderr, "No such wireless device: 
%s\n", argv[1]);
rv = 1;
+   goto finish;
}
+
+   print_scanlist(iw, argv[1], atoi(argv[3]));
+   break;
+
+   default:
+   fprintf(stderr, "Unknown command: %s\n", argv[2]);
+   rv = 1;
}
}
else
@@ -872,7 +899,7 @@ int main(int argc, char **argv)
break;
 
case 's':
-   print_scanlist(iw, argv[1]);
+   print_scanlist(iw, argv[1], 0);
break;
 
case 't':
@@ -903,6 +930,8 @@ int main(int argc, char **argv)
 

[OpenWrt-Devel] [PATCH] Hostapd: wait longer for inactive client probe (empty data frame)

2015-10-06 Thread Dmitry Ivanov
Hostapd: wait longer for inactive client probe (empty data frame).

One second is not enough for some devices to ackowledge null data frame
which is sent at the end of ap_max_inactivity interval. In particular,
this causes severe Wi-Fi instability with Apple iPhone which may take
up to 3 seconds to respond.

Signed-off-by: Dmitry Ivanov 
---
 .../hostapd/patches/470-wait-for-nullfunc-longer.patch| 11 +++
 1 file changed, 11 insertions(+)
 create mode 100644 
package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch

diff --git 
a/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch 
b/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
new file mode 100644
index 000..e6bbddd
--- /dev/null
+++ 
b/package/network/services/hostapd/patches/470-wait-for-nullfunc-longer.patch
@@ -0,0 +1,11 @@
+--- a/src/ap/sta_info.h
 b/src/ap/sta_info.h
+@@ -179,7 +179,7 @@ struct sta_info {
+  * AP_DISASSOC_DELAY seconds. Similarly, the station will be deauthenticated
+  * after AP_DEAUTH_DELAY seconds has passed after disassociation. */
+ #define AP_MAX_INACTIVITY (5 * 60)
+-#define AP_DISASSOC_DELAY (1)
++#define AP_DISASSOC_DELAY (3)
+ #define AP_DEAUTH_DELAY (1)
+ /* Number of seconds to keep STA entry with Authenticated flag after it has
+  * been disassociated. */
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][odhcpd] Limit size of IPv4 DHCP reply

2015-09-29 Thread Dmitry Ivanov
Limit size of IPv4 DHCP reply.
In other words, remove zero padding after end option (0xff).

Signed-off-by: Dmitry Ivanov 
---
 src/dhcpv4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index a657e13..c8014ea 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -497,7 +497,7 @@ static void handle_dhcpv4(void *addr, void *data, size_t 
len,
inet_ntoa(dest.sin_addr));
}
 
-   sendto(sock, &reply, sizeof(reply), MSG_DONTWAIT,
+   sendto(sock, &reply, cookie - (uint8_t*) &reply - 1, MSG_DONTWAIT,
(struct sockaddr*)&dest, sizeof(dest));
 }
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH v2][netifd] Initialize wireless interface attributes in proper function

2015-09-14 Thread Dmitry Ivanov
Initialize wireless interface attributes in proper function.

Currently multicast to unicast feature may be configured for incorrect wireless 
interface in case of reconfiguration.

Test case:

Initial wireless configuration:

config wifi-iface
  option mode ap
  option disabled 1

config wifi-iface
  option mode sta
  option disabled 0

config wifi-iface
  option mode ap
  option disabled 0

After reboot, multicast to unicast feature is configured for interface #3 
(wlan0-1) only.

Next, enable interface #1 and issue "wifi" command. Now, multicast to unicast 
feature is configured for interface #2 (wlan0) which is wrong.
It should be configured for interfaces #1 and #3 only. This patch resolves this 
problem.


Signed-off-by: Dmitry Ivanov 
---
 wireless.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/wireless.c b/wireless.c
index dcadfad..f0b19aa 100644
--- a/wireless.c
+++ b/wireless.c
@@ -559,6 +559,14 @@ wireless_interface_init_config(struct wireless_interface 
*vif)
 
if ((cur = tb[VIF_ATTR_NETWORK]))
vif->network = cur;
+
+   cur = tb[VIF_ATTR_ISOLATE];
+   if (cur && blobmsg_get_bool(cur))
+   vif->isolate = blobmsg_get_bool(cur);
+
+   cur = tb[VIF_ATTR_MODE];
+   if (cur)
+   vif->ap_mode = !strcmp(blobmsg_get_string(cur), "ap");
 }
 
 static void
@@ -715,14 +723,6 @@ void wireless_interface_create(struct wireless_device 
*wdev, struct blob_attr *d
vif->section = section;
vif->isolate = false;
 
-   cur = tb[VIF_ATTR_ISOLATE];
-   if (cur && blobmsg_get_bool(cur))
-   vif->isolate = blobmsg_get_bool(cur);
-
-   cur = tb[VIF_ATTR_MODE];
-   if (cur && !strcmp(blobmsg_get_string(cur), "ap"))
-   vif->ap_mode = true;
-
vlist_add(&wdev->interfaces, &vif->node, vif->name);
 }
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][netifd] Initialize wireless interface attributes in proper function

2015-09-14 Thread Dmitry Ivanov
Initialize wireless interface attributes in proper function.

Currently multicast to unicast feature may be configured for incorrect wireless 
interface in case of reconfiguration.

Test case:

Initial wireless configuration:

config wifi-iface
  option mode ap
  option disabled 1

config wifi-iface
  option mode sta
  option disabled 0

config wifi-iface
  option mode ap
  option disabled 0

After reboot, multicast to unicast feature is configured for interface #3 
(wlan0-1) only.

Next, enable interface #1 and issue "wifi" command. Now, multicast to unicast 
feature is configured for interface #2 (wlan0) which is wrong.
It should be configured for interfaces #1 and #3 only. This patch resolves this 
problem.


Signed-off-by: Dmitry Ivanov 
---
 wireless.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/wireless.c b/wireless.c
index dcadfad..f0b19aa 100644
--- a/wireless.c
+++ b/wireless.c
@@ -559,6 +559,14 @@ wireless_interface_init_config(struct wireless_interface 
*vif)
 
if ((cur = tb[VIF_ATTR_NETWORK]))
vif->network = cur;
+
+   cur = tb[VIF_ATTR_ISOLATE];
+   if (cur && blobmsg_get_bool(cur))
+   vif->isolate = blobmsg_get_bool(cur);
+
+   cur = tb[VIF_ATTR_MODE];
+   if (cur)
+   vif->ap_mode = !!!strcmp(blobmsg_get_string(cur), "ap");
 }
 
 static void
@@ -715,14 +723,6 @@ void wireless_interface_create(struct wireless_device 
*wdev, struct blob_attr *d
vif->section = section;
vif->isolate = false;
 
-   cur = tb[VIF_ATTR_ISOLATE];
-   if (cur && blobmsg_get_bool(cur))
-   vif->isolate = blobmsg_get_bool(cur);
-
-   cur = tb[VIF_ATTR_MODE];
-   if (cur && !strcmp(blobmsg_get_string(cur), "ap"))
-   vif->ap_mode = true;
-
vlist_add(&wdev->interfaces, &vif->node, vif->name);
 }
 
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH][netifd] Bridge hairpin mode must be off by default

2015-09-10 Thread Dmitry Ivanov
Felix, this patch resolves duplicate packet issue in WDS setup. Thanks!

On Thu, 10 Sep 2015 15:37:35 +0200
Felix Fietkau  wrote:

> On 2015-09-10 15:00, Dmitry Ivanov wrote:
> > Bridge hairpin mode must be off by default when multicast_to_unicast is
> > off. Enabling this mode leads to broadcast frames such as ARP and DHCP
> > being retransmitted back to AP in WDS configurations.
> > 
> > Signed-off-by: Dmitry Ivanov 
> Please try this patch instead: 
> ---
> diff --git a/device.h b/device.h
> index b2c0ba9..37814c8 100644
> --- a/device.h
> +++ b/device.h
> @@ -182,6 +182,7 @@ struct device {
>   bool iface_config;
>   bool default_config;
>   bool wireless;
> + bool wireless_ap;
>   bool wireless_isolate;
>  
>   struct interface *config_iface;
> diff --git a/system-linux.c b/system-linux.c
> index 01500a5..f51c078 100644
> --- a/system-linux.c
> +++ b/system-linux.c
> @@ -576,7 +576,7 @@ static char *system_get_bridge(const char *name, char 
> *buf, int buflen)
>  static void
>  system_bridge_set_wireless(struct device *bridge, struct device *dev)
>  {
> - bool mcast_to_ucast = true;
> + bool mcast_to_ucast = dev->wireless_ap;
>   bool hairpin = true;
>  
>   if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST &&
> diff --git a/wireless.c b/wireless.c
> index d0d2942..7e8dc93 100644
> --- a/wireless.c
> +++ b/wireless.c
> @@ -36,6 +36,7 @@ enum {
>   VIF_ATTR_DISABLED,
>   VIF_ATTR_NETWORK,
>   VIF_ATTR_ISOLATE,
> + VIF_ATTR_MODE,
>   __VIF_ATTR_MAX,
>  };
>  
> @@ -43,6 +44,7 @@ static const struct blobmsg_policy 
> vif_policy[__VIF_ATTR_MAX] = {
>   [VIF_ATTR_DISABLED] = { .name = "disabled", .type = BLOBMSG_TYPE_BOOL },
>   [VIF_ATTR_NETWORK] = { .name = "network", .type = BLOBMSG_TYPE_ARRAY },
>   [VIF_ATTR_ISOLATE] = { .name = "isolate", .type = BLOBMSG_TYPE_BOOL },
> + [VIF_ATTR_MODE] = { .name = "mode", .type = BLOBMSG_TYPE_STRING },
>  };
>  
>  static const struct uci_blob_param_list vif_param = {
> @@ -213,6 +215,7 @@ static void wireless_interface_handle_link(struct 
> wireless_interface *vif, bool
>   if (dev) {
>   dev->wireless_isolate = vif->isolate;
>   dev->wireless = true;
> + dev->wireless_ap = vif->ap_mode;
>   }
>   }
>  
> @@ -714,6 +717,10 @@ void wireless_interface_create(struct wireless_device 
> *wdev, struct blob_attr *d
>   if (cur && blobmsg_get_bool(cur))
>   vif->isolate = blobmsg_get_bool(cur);
>  
> + cur = tb[VIF_ATTR_MODE];
> + if (cur && !strcmp(blobmsg_get_string(cur), "ap"))
> + vif->ap_mode = true;
> +
>   vlist_add(&wdev->interfaces, &vif->node, vif->name);
>  }
>  
> diff --git a/wireless.h b/wireless.h
> index 476c63e..cb725b2 100644
> --- a/wireless.h
> +++ b/wireless.h
> @@ -78,6 +78,7 @@ struct wireless_interface {
>   const char *ifname;
>   struct blob_attr *network;
>   bool isolate;
> + bool ap_mode;
>  };
>  
>  struct wireless_process {
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][netifd] Do not enable multicast_to_unicast by default

2015-09-10 Thread Dmitry Ivanov
Do not enable multicast_to_unicast by default. Duplicate broadcast and
multicast frames may cause problems in WDS setup. Wireless clients
cannot obtain IP address etc.

Signed-off-by: Dmitry Ivanov 
---
 scripts/netifd-wireless.sh | 2 +-
 system-linux.c | 7 +++
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/scripts/netifd-wireless.sh b/scripts/netifd-wireless.sh
index 83a8223..774a503 100644
--- a/scripts/netifd-wireless.sh
+++ b/scripts/netifd-wireless.sh
@@ -256,7 +256,7 @@ _wireless_set_brsnoop_isolation() {
 
[ $isolate -gt 0 -o -z "$network_bridge" ] && return
 
-   [ -z "$multicast_to_unicast" ] && multicast_to_unicast=1
+   [ -z "$multicast_to_unicast" ] && multicast_to_unicast=0
[ $multicast_to_unicast -gt 0 ] && json_add_boolean isolate 1
 }
 
diff --git a/system-linux.c b/system-linux.c
index 01500a5..6994ace 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -576,12 +576,11 @@ static char *system_get_bridge(const char *name, char 
*buf, int buflen)
 static void
 system_bridge_set_wireless(struct device *bridge, struct device *dev)
 {
-   bool mcast_to_ucast = true;
+   bool mcast_to_ucast = false;
bool hairpin = true;
 
-   if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST &&
-   !bridge->settings.multicast_to_unicast)
-   mcast_to_ucast = false;
+   if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST)
+   mcast_to_ucast = bridge->settings.multicast_to_unicast;
 
if (!mcast_to_ucast || dev->wireless_isolate)
hairpin = false;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH][netifd] Bridge hairpin mode must be off by default

2015-09-10 Thread Dmitry Ivanov
Bridge hairpin mode must be off by default when multicast_to_unicast is
off. Enabling this mode leads to broadcast frames such as ARP and DHCP
being retransmitted back to AP in WDS configurations.

Signed-off-by: Dmitry Ivanov 
---
 system-linux.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/system-linux.c b/system-linux.c
index 01500a5..6994ace 100644
--- a/system-linux.c
+++ b/system-linux.c
@@ -576,12 +576,11 @@ static char *system_get_bridge(const char *name, char 
*buf, int buflen)
 static void
 system_bridge_set_wireless(struct device *bridge, struct device *dev)
 {
-   bool mcast_to_ucast = true;
+   bool mcast_to_ucast = false;
bool hairpin = true;
 
-   if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST &&
-   !bridge->settings.multicast_to_unicast)
-   mcast_to_ucast = false;
+   if (bridge->settings.flags & DEV_OPT_MULTICAST_TO_UNICAST)
+   mcast_to_ucast = bridge->settings.multicast_to_unicast;
 
if (!mcast_to_ucast || dev->wireless_isolate)
hairpin = false;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Restore 640-bridge_no_eap_forward.patch to its original form

2015-09-08 Thread Dmitry Ivanov
Restore 640-bridge_no_eap_forward.patch to its original form.
It was corrupted in rev 62a2176cb144. The most obvious symptom is repeated 
messages like this:

Tue Sep  8 08:25:18 2015 kern.warn kernel: [77141.972226] br-lan: received 
packet on wlan0 with own address as source address

Signed-off-by: Dmitry Ivanov 
---
 target/linux/generic/patches-3.18/640-bridge_no_eap_forward.patch | 2 +-
 target/linux/generic/patches-4.0/640-bridge_no_eap_forward.patch  | 2 +-
 target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/target/linux/generic/patches-3.18/640-bridge_no_eap_forward.patch 
b/target/linux/generic/patches-3.18/640-bridge_no_eap_forward.patch
index acbf1e2..69a9949 100644
--- a/target/linux/generic/patches-3.18/640-bridge_no_eap_forward.patch
+++ b/target/linux/generic/patches-3.18/640-bridge_no_eap_forward.patch
@@ -8,7 +8,7 @@
 +  if (skb->protocol == htons(ETH_P_PAE)) {
 +  skb2 = skb;
 +  /* Do not forward 802.1x/EAP frames */
-+
++  skb = NULL;
 +  } else if (is_broadcast_ether_addr(dest)) {
skb2 = skb;
unicast = false;
diff --git a/target/linux/generic/patches-4.0/640-bridge_no_eap_forward.patch 
b/target/linux/generic/patches-4.0/640-bridge_no_eap_forward.patch
index 7a9dc26..c9b8613 100644
--- a/target/linux/generic/patches-4.0/640-bridge_no_eap_forward.patch
+++ b/target/linux/generic/patches-4.0/640-bridge_no_eap_forward.patch
@@ -8,7 +8,7 @@
 +  if (skb->protocol == htons(ETH_P_PAE)) {
 +  skb2 = skb;
 +  /* Do not forward 802.1x/EAP frames */
-+
++  skb = NULL;
 +  } else if (is_broadcast_ether_addr(dest)) {
if (IS_ENABLED(CONFIG_INET) &&
p->flags & BR_PROXYARP &&
diff --git a/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch 
b/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch
index 283bc85..d3871eb 100644
--- a/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch
+++ b/target/linux/generic/patches-4.1/640-bridge_no_eap_forward.patch
@@ -8,7 +8,7 @@
 +  if (skb->protocol == htons(ETH_P_PAE)) {
 +  skb2 = skb;
 +  /* Do not forward 802.1x/EAP frames */
-+
++  skb = NULL;
 +  } else if (is_broadcast_ether_addr(dest)) {
skb2 = skb;
unicast = false;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Restore AP scan patch

2015-07-31 Thread Dmitry Ivanov
Restore AP scan patch.

Signed-off-by: Dmitry Ivanov 
---
 package/kernel/mac80211/patches/210-ap_scan.patch | 11 +++
 1 file changed, 11 insertions(+)
 create mode 100644 package/kernel/mac80211/patches/210-ap_scan.patch

diff --git a/package/kernel/mac80211/patches/210-ap_scan.patch 
b/package/kernel/mac80211/patches/210-ap_scan.patch
new file mode 100644
index 000..29f05c4
--- /dev/null
+++ b/package/kernel/mac80211/patches/210-ap_scan.patch
@@ -0,0 +1,11 @@
+--- a/net/mac80211/cfg.c
 b/net/mac80211/cfg.c
+@@ -2008,7 +2008,7 @@ static int ieee80211_scan(struct wiphy *
+* the  frames sent while scanning on other channel will be
+* lost)
+*/
+-  if (sdata->u.ap.beacon &&
++  if (0 && sdata->u.ap.beacon &&
+   (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
+!(req->flags & NL80211_SCAN_FLAG_AP)))
+   return -EOPNOTSUPP;
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] iwinfo: do not wait for scan results if scan request failed.

2015-07-31 Thread Dmitry Ivanov
Do not wait for scan results if scan request failed.

Signed-off-by: Dmitry Ivanov 
---
 iwinfo_nl80211.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 900eef2..251ec33 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -389,11 +389,12 @@ static struct nl80211_msg_conveyor * nl80211_send(
while (err > 0)
nl_recvmsgs(nls->nl_sock, cv->cb);
 
+   if (err)
+   goto err;
+
return &rcv;
 
 err:
-   nl_cb_put(cv->cb);
-   nlmsg_free(cv->msg);
 
return NULL;
 }
@@ -2016,16 +2017,21 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, 
void *arg)
 
 static int nl80211_get_scanlist_nl(const char *ifname, char *buf, int *len)
 {
-   struct nl80211_msg_conveyor *req;
+   struct nl80211_msg_conveyor *req, *scan_res = NULL;
struct nl80211_scanlist sl = { .e = (struct iwinfo_scanlist_entry *)buf 
};
 
req = nl80211_msg(ifname, NL80211_CMD_TRIGGER_SCAN, 0);
if (req)
{
-   nl80211_send(req, NULL, NULL);
+   scan_res = nl80211_send(req, NULL, NULL);
nl80211_free(req);
}
 
+   if (!scan_res)
+   {
+   return -1;
+   }
+
nl80211_wait("nl80211", "scan", NL80211_CMD_NEW_SCAN_RESULTS);
 
req = nl80211_msg(ifname, NL80211_CMD_GET_SCAN, NLM_F_DUMP);
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] Bugfix: use correct PLL configuration register bitmask for QCA956x SoC

2015-07-28 Thread Dmitry Ivanov
Bugfix: use correct PLL configuration register bitmask for
QCA956x SoC.

Incorrect value causes clock inaccuracy as huge as 1/60.

Signed-off-by: Dmitry Ivanov 
---
 .../patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch | 4 ++--
 .../patches-4.1/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
 
b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index 3b8e6c5..2596e1c 100644
--- 
a/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ 
b/target/linux/ar71xx/patches-3.18/735-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -528,7 +528,7 @@
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK  0x1f
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK  0x3fff
++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK  0x1fff
 +#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT18
 +#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff
 +
@@ -540,7 +540,7 @@
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK  0x1f
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK  0x3fff
++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK  0x1fff
 +#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT18
 +#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff
 +
diff --git 
a/target/linux/ar71xx/patches-4.1/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
 
b/target/linux/ar71xx/patches-4.1/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
index b23c18e..c7e564d 100644
--- 
a/target/linux/ar71xx/patches-4.1/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
+++ 
b/target/linux/ar71xx/patches-4.1/621-MIPS-ath79-add-support-for-QCA956x-SoC.patch
@@ -528,7 +528,7 @@
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_SHIFT 0
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_L_MASK  0x1f
 +#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK  0x3fff
++#define QCA956X_PLL_CPU_CONFIG1_NFRAC_H_MASK  0x1fff
 +#define QCA956X_PLL_CPU_CONFIG1_NINT_SHIFT18
 +#define QCA956X_PLL_CPU_CONFIG1_NINT_MASK 0x1ff
 +
@@ -540,7 +540,7 @@
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_SHIFT 0
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_L_MASK  0x1f
 +#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_SHIFT 5
-+#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK  0x3fff
++#define QCA956X_PLL_DDR_CONFIG1_NFRAC_H_MASK  0x1fff
 +#define QCA956X_PLL_DDR_CONFIG1_NINT_SHIFT18
 +#define QCA956X_PLL_DDR_CONFIG1_NINT_MASK 0x1ff
 +
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] [iwinfo] Allow non-negative RSSI reading

2015-05-08 Thread Dmitry Ivanov
WLAN RSSI reading can be non-negative, i.e. 0 dBm and more.
For example, this occurs with QCA9561 when transmitter is very close.
Driver, Linux kernel and iw tool do allow this.

This patch allows non-negative RSSI in iwinfo too.

Signed-off-by: Dmitry Ivanov 
---
 include/iwinfo.h   |  4 +++-
 iwinfo_cli.c   | 10 +-
 iwinfo_madwifi.c   |  1 +
 iwinfo_nl80211.c   | 52 +---
 iwinfo_wext_scan.c |  1 +
 iwinfo_wl.c| 12 
 6 files changed, 47 insertions(+), 33 deletions(-)

diff --git a/include/iwinfo.h b/include/iwinfo.h
index 57a88e2..c1628b8 100644
--- a/include/iwinfo.h
+++ b/include/iwinfo.h
@@ -76,6 +76,7 @@ struct iwinfo_rate_entry {
 struct iwinfo_assoclist_entry {
uint8_t mac[6];
int8_t signal;
+   uint8_t signal_known;
int8_t noise;
uint32_t inactive;
uint32_t rx_packets;
@@ -109,7 +110,8 @@ struct iwinfo_scanlist_entry {
uint8_t ssid[IWINFO_ESSID_MAX_SIZE+1];
enum iwinfo_opmode mode;
uint8_t channel;
-   uint8_t signal;
+   int8_t  signal;
+   uint8_t signal_known;
uint8_t quality;
uint8_t quality_max;
struct iwinfo_crypto_entry crypto;
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index d9a59e2..d89eb04 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -104,11 +104,11 @@ static char * format_quality_max(int qmax)
return buf;
 }
 
-static char * format_signal(int sig)
+static char * format_signal(int sig, unsigned int sig_known)
 {
static char buf[10];
 
-   if (!sig)
+   if (!sig_known)
snprintf(buf, sizeof(buf), "unknown");
else
snprintf(buf, sizeof(buf), "%d dBm", sig);
@@ -461,7 +461,7 @@ static char * print_signal(const struct iwinfo_ops *iw, 
const char *ifname)
if (iw->signal(ifname, &sig))
sig = 0;
 
-   return format_signal(sig);
+   return format_signal(sig, 1);
 }
 
 static char * print_noise(const struct iwinfo_ops *iw, const char *ifname)
@@ -592,7 +592,7 @@ static void print_scanlist(const struct iwinfo_ops *iw, 
const char *ifname)
IWINFO_OPMODE_NAMES[e->mode],
format_channel(e->channel));
printf("  Signal: %s  Quality: %s/%s\n",
-   format_signal(e->signal - 0x100),
+   format_signal(e->signal, e->signal_known),
format_quality(e->quality),
format_quality_max(e->quality_max));
printf("  Encryption: %s\n\n",
@@ -682,7 +682,7 @@ static void print_assoclist(const struct iwinfo_ops *iw, 
const char *ifname)
 
printf("%s  %s / %s (SNR %d)  %d ms ago\n",
format_bssid(e->mac),
-   format_signal(e->signal),
+   format_signal(e->signal, e->signal_known),
format_noise(e->noise),
(e->signal - e->noise),
e->inactive);
diff --git a/iwinfo_madwifi.c b/iwinfo_madwifi.c
index bb7fc63..da21bfe 100644
--- a/iwinfo_madwifi.c
+++ b/iwinfo_madwifi.c
@@ -763,6 +763,7 @@ static int madwifi_get_assoclist(const char *ifname, char 
*buf, int *len)
memset(&entry, 0, sizeof(entry));
 
entry.signal = (si->isi_rssi - 95);
+   entry.signal_known - 1;
entry.noise  = noise;
memcpy(entry.mac, &si->isi_macaddr, 6);
 
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 2562492..daed8ef 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -1606,7 +1606,10 @@ static int nl80211_get_assoclist_cb(struct nl_msg *msg, 
void *arg)
  attr[NL80211_ATTR_STA_INFO], stats_policy))
{
if (sinfo[NL80211_STA_INFO_SIGNAL])
+   {
e->signal = nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]);
+   e->signal_known = 1;
+   }
 
if (sinfo[NL80211_STA_INFO_INACTIVE_TIME])
e->inactive = 
nla_get_u32(sinfo[NL80211_STA_INFO_INACTIVE_TIME]);
@@ -1889,7 +1892,7 @@ static void nl80211_get_scanlist_ie(struct nlattr **bss,
 
 static int nl80211_get_scanlist_cb(struct nl_msg *msg, void *arg)
 {
-   int8_t rssi;
+   int8_t rssi, rssi_limited;
uint16_t caps;
 
struct nl80211_scanlist *sl = arg;
@@ -1945,17 +1948,17 @@ static int nl80211_get_scanlist_cb(struct nl_msg *msg, 
void *arg)
 
if (bss[NL80211_BSS_SIGNAL_MBM])
{
-   sl->e->signal =
-   
(uint8_t)((int32_t)nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM]) / 100);
+   rssi = ((int32_t)nla_get_u32(bss[NL80211_BSS_SIGNAL_MBM])) /

[OpenWrt-Devel] [PATCH] [rpcd] Allow non-negative RSSI reading

2015-05-08 Thread Dmitry Ivanov
WLAN RSSI reading can be non-negative, i.e. 0 dBm and more.
For example, this occurs with QCA9561 when transmitter is very close.
Driver, Linux kernel and iw tool do allow this.

This patch allows non-negative RSSI in rpcd too.

Signed-off-by: Dmitry Ivanov 
---
 iwinfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iwinfo.c b/iwinfo.c
index 325c07a..7e39b73 100644
--- a/iwinfo.c
+++ b/iwinfo.c
@@ -356,7 +356,7 @@ rpc_iwinfo_scan(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_string(&buf, "mode", 
IWINFO_OPMODE_NAMES[e->mode]);
 
blobmsg_add_u32(&buf, "channel", e->channel);
-   blobmsg_add_u32(&buf, "signal", (uint32_t)(e->signal - 
0x100));
+   blobmsg_add_u32(&buf, "signal", (uint32_t)(e->signal));
 
blobmsg_add_u32(&buf, "quality", e->quality);
blobmsg_add_u32(&buf, "quality_max", e->quality_max);
-- 
2.1.4
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel