@@ -117,6 +117,10 @@ void rebuildIfVc () {
117117
118118 memcpy ( IfReq .ifr_name , Dp -> Name , sizeof ( IfReq .ifr_name ) );
119119
120+ if (ioctl (Sock , SIOCGIFINDEX , & IfReq ) < 0 )
121+ my_log (LOG_ERR , errno , "ioctl SIOCGIFINDEX for %s" , IfReq .ifr_name );
122+ Dp -> ifIndex = IfReq .ifr_ifindex ;
123+
120124 // Get the subnet mask...
121125 if (ioctl (Sock , SIOCGIFNETMASK , & IfReq ) < 0 )
122126 my_log (LOG_ERR , errno , "ioctl SIOCGIFNETMASK for %s" , IfReq .ifr_name );
@@ -175,8 +179,9 @@ void rebuildIfVc () {
175179 }
176180
177181 // Debug log the result...
178- my_log ( LOG_DEBUG , 0 , "rebuildIfVc: Interface %s Addr: %s, Flags: 0x%04x, Network: %s" ,
182+ my_log ( LOG_DEBUG , 0 , "rebuildIfVc: Interface %s Index: %d Addr: %s, Flags: 0x%04x, Network: %s" ,
179183 Dp -> Name ,
184+ Dp -> ifIndex ,
180185 fmtInAdr ( FmtBu , Dp -> InAdr ),
181186 Dp -> Flags ,
182187 inetFmts (subnet , mask , s1 ));
@@ -268,6 +273,10 @@ void buildIfVc(void) {
268273
269274 memcpy ( IfReq .ifr_name , IfDescEp -> Name , sizeof ( IfReq .ifr_name ) );
270275
276+ if (ioctl (Sock , SIOCGIFINDEX , & IfReq ) < 0 )
277+ my_log (LOG_ERR , errno , "ioctl SIOCGIFINDEX for %s" , IfReq .ifr_name );
278+ IfDescEp -> ifIndex = IfReq .ifr_ifindex ;
279+
271280 // Get the subnet mask...
272281 if (ioctl (Sock , SIOCGIFNETMASK , & IfReq ) < 0 )
273282 my_log (LOG_ERR , errno , "ioctl SIOCGIFNETMASK for %s" , IfReq .ifr_name );
@@ -313,8 +322,9 @@ void buildIfVc(void) {
313322 IfDescEp -> ratelimit = DEFAULT_RATELIMIT ;
314323
315324 // Debug log the result...
316- my_log ( LOG_DEBUG , 0 , "buildIfVc: Interface %s Addr: %s, Flags: 0x%04x, Network: %s" ,
325+ my_log ( LOG_DEBUG , 0 , "buildIfVc: Interface %s Index: %d Addr: %s, Flags: 0x%04x, Network: %s" ,
317326 IfDescEp -> Name ,
327+ IfDescEp -> ifIndex ,
318328 fmtInAdr ( FmtBu , IfDescEp -> InAdr ),
319329 IfDescEp -> Flags ,
320330 inetFmts (subnet ,mask , s1 ));
0 commit comments