]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
setaliases: Use "secondary" flag instead of scope
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Sep 2022 13:58:15 +0000 (13:58 +0000)
committerPeter Müller <peter.mueller@ipfire.org>
Sun, 11 Sep 2022 07:40:46 +0000 (07:40 +0000)
The scope option does not seem to work at all now, which is surprising
since I tested it quite well.

The secondary flag cannot be set from userspace (aparently), but it
works, so I would prefer to go with this option for now.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/misc-progs/setaliases.c

index a541a4fd20b418b0629b9515c9875455d5dac9e5..4b18ba325bf345f3815968f45373bee1152fc615 100644 (file)
@@ -28,8 +28,6 @@
 struct keyvalue *kv = NULL;
 FILE *file = NULL;
 
-#define SCOPE 128
-
 void exithandler(void)
 {
        if (kv) freekeyvalues(kv);
@@ -125,7 +123,7 @@ int main(void)
        alias = 0;
        do {
                snprintf(command, STRING_SIZE - 1,
-                       "ip addr flush dev red%d scope %d 2>/dev/null", alias++, SCOPE);
+                       "ip addr flush secondary dev red%d 2>/dev/null", alias++);
        } while (safe_system(command) == 0);
 
        /* Now set up the new aliases from the config file */
@@ -184,8 +182,8 @@ int main(void)
                if (!intf)
                        intf = red_dev;
 
-               snprintf(command, STRING_SIZE - 1, "ip addr add %s/%s dev %s scope %d",
-                       aliasip, red_netmask, intf, SCOPE);
+               snprintf(command, STRING_SIZE - 1, "ip addr add %s/%s secondary dev %s 2>/dev/null",
+                       aliasip, red_netmask, intf);
                safe_system(command);
 
                alias++;