[multicat-devel] [Git][videolan/multicat][master] 2 commits: multilive: fix output peer interface lookup

Christophe Massiot (@cmassiot) gitlab at videolan.org
Fri Dec 13 16:49:05 UTC 2024



Christophe Massiot pushed to branch master at VideoLAN / multicat


Commits:
e65a0441 by Arnaud de Turckheim at 2024-12-13T17:09:00+01:00
multilive: fix output peer interface lookup

- - - - -
9a322999 by Christophe Massiot at 2024-12-13T17:48:51+01:00
Merge branch 'quarium-multilive-fix-output-ifindex'

- - - - -


1 changed file:

- multilive.c


Changes:

=====================================
multilive.c
=====================================
@@ -343,8 +343,11 @@ static int peer_get_link(struct peer *peer)
             *arg++ = '\0';
 
             if (!strcmp(opt, "ifaddr")) {
-                in_addr_t in_addr = inet_addr(arg);
-                ifindex = in_addr_get_ifindex(&in_addr);
+                struct in_addr in;
+                if (inet_aton(arg, &in))
+                    ifindex = in_addr_get_ifindex(&in.s_addr);
+                else
+                    msg_Err( NULL, "invalid address %s", arg );
             } else if (!strcmp(opt, "ifname")) {
                 ifindex = if_nametoindex(arg);
             } else if (!strcmp(opt, "ifindex")) {
@@ -355,10 +358,16 @@ static int peer_get_link(struct peer *peer)
             }
         }
     } else {
-        const char *arg = strchr(args, '@');
+        char *arg = strchr(args, '@');
         if (arg++) {
-            in_addr_t in_addr = inet_addr(arg);
-            ifindex = in_addr_get_ifindex(&in_addr);
+            char *end = arg + strspn(arg, "0123456789.");
+            *end = '\0';
+
+            struct in_addr in;
+            if (inet_aton(arg, &in))
+                ifindex = in_addr_get_ifindex(&in.s_addr);
+            else
+                msg_Err( NULL, "invalid address %s", arg );
         }
     }
     free(args);



View it on GitLab: https://code.videolan.org/videolan/multicat/-/compare/50f8d810fcdc3ba7d45b5253f5e2df8fe07b03df...9a322999a2e4c0597116a55bc45a90548d8e6237

-- 
View it on GitLab: https://code.videolan.org/videolan/multicat/-/compare/50f8d810fcdc3ba7d45b5253f5e2df8fe07b03df...9a322999a2e4c0597116a55bc45a90548d8e6237
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the multicat-devel mailing list