wireless: fix mcast_to_ucast handling, only apply it to AP mode
authorFelix Fietkau <nbd@openwrt.org>
Thu, 10 Sep 2015 20:59:33 +0000 (22:59 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 10 Sep 2015 20:59:34 +0000 (22:59 +0200)
Fixes a regression that caused WDS stations to repeat packets back to
the AP.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
device.h
system-linux.c
wireless.c
wireless.h

index b2c0ba9..37814c8 100644 (file)
--- 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;
index 01500a5..f51c078 100644 (file)
@@ -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 &&
index d0d2942..dcadfad 100644 (file)
@@ -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;
                }
        }
 
@@ -582,6 +585,8 @@ vif_update(struct vlist_tree *tree, struct vlist_node *node_new,
                D(WIRELESS, "Update wireless interface %s on device %s\n", vif_new->name, wdev->name);
                free(vif_old->config);
                vif_old->config = blob_memdup(vif_new->config);
+               vif_old->isolate = vif_new->isolate;
+               vif_old->ap_mode = vif_new->ap_mode;
                wireless_interface_init_config(vif_old);
                free(vif_new);
        } else if (vif_new) {
@@ -714,6 +719,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);
 }
 
index 476c63e..cb725b2 100644 (file)
@@ -78,6 +78,7 @@ struct wireless_interface {
        const char *ifname;
        struct blob_attr *network;
        bool isolate;
+       bool ap_mode;
 };
 
 struct wireless_process {