map: fix deleting port based rules
authorFelix Fietkau <nbd@nbd.name>
Mon, 26 Sep 2022 12:42:54 +0000 (14:42 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 26 Sep 2022 12:42:58 +0000 (14:42 +0200)
ensure that they are properly replaced with default values

Signed-off-by: Felix Fietkau <nbd@nbd.name>
map.c

diff --git a/map.c b/map.c
index f88848e4db38266b1bbf4836955f91fb196c9935..4b381555ef072a7f40b576e966f3d4365d92eef2 100644 (file)
--- a/map.c
+++ b/map.c
@@ -196,11 +196,14 @@ void qosify_map_set_dscp_default(enum qosify_map_id id, uint8_t val)
        else
                return;
 
-       if (!memcmp(&qosify_dscp_default[udp], &val, sizeof(val)))
-               return;
+       if (val != 0xff) {
+               if (qosify_dscp_default[udp] == val)
+                       return;
 
-       qosify_dscp_default[udp] = val;
-       __qosify_map_set_dscp_default(id, val);
+               qosify_dscp_default[udp] = val;
+       }
+
+       __qosify_map_set_dscp_default(id, qosify_dscp_default[udp]);
 }
 
 int qosify_map_init(void)
@@ -648,6 +651,9 @@ void qosify_map_reload(void)
                __qosify_map_load_file(f->filename);
 
        qosify_map_gc();
+
+       qosify_map_set_dscp_default(CL_MAP_TCP_PORTS, 0xff);
+       qosify_map_set_dscp_default(CL_MAP_UDP_PORTS, 0xff);
 }
 
 static void qosify_map_free_entry(struct qosify_map_entry *e)