lib-interface: Change API for interface 'options'
authorVinit Agnihotri <vagnihotri@ddn.com>
Tue, 5 Mar 2024 10:32:23 +0000 (02:32 -0800)
committerMartin Schwenke <martins@samba.org>
Tue, 16 Apr 2024 23:51:45 +0000 (23:51 +0000)
Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com>
Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/lib/interface.c
source3/lib/interface.h

index b8450316b6730db65ddf61bd6edcf09ed8181cbf..032362b4da38f2bfb43caea7981365e8969d3ee5 100644 (file)
@@ -749,15 +749,15 @@ bool interfaces_changed(void)
 }
 
 /****************************************************************************
- Return True if interface exists for given interface index
+ Return True if interface exists for given interface index and options
 **************************************************************************/
 
-bool interface_ifindex_exists(int if_index)
+bool interface_ifindex_exists_with_options(int if_index, uint32_t options)
 {
-       struct interface *i;
+       struct interface *i = NULL;
 
        for (i = local_interfaces; i != NULL; i = i->next) {
-               if (i->if_index == if_index) {
+               if ((i->if_index == if_index) && (i->options & options)) {
                        return true;
                }
        }
index d93e9094a33e3119e6c4df8f89538567539d614f..828a7aa0bd9603598173c99da9b7826c49941ad4 100644 (file)
@@ -45,6 +45,6 @@ bool iface_local(const struct sockaddr *ip);
 void load_interfaces(void);
 void gfree_interfaces(void);
 bool interfaces_changed(void);
-bool interface_ifindex_exists(int if_index);
+bool interface_ifindex_exists_with_options(int if_index, uint32_t options);
 
 #endif /* _INTERFACE_H */