Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: mod_backhand: Wackamole

wackatrol

 

 

mod_backhand wackamole RSS feed   Index | Next | Previous | View Threaded


mjl at emsi

Feb 20, 2003, 9:16 AM

Post #1 of 1 (802 views)
Permalink
wackatrol

In wackatrl.c, here are the following lines (around line 105):


for(j=0;j<MAX_DEP_IF+2;j++) {
memcpy(Table[i][j].ifname, buffer+toread, IFNAMSIZ);
toread+=IFNAMSIZ;
memcpy(&Table[i][j].ipaddr.s_addr,buffer+toread,sizeof(int));
--> Table[i][j].ipaddr.s_addr = ntohl(Table[i][j].ipaddr.s_addr);
toread+=sizeof(int);
memcpy(&Table[i][j].bcast.s_addr,buffer+toread,sizeof(int));
Table[i][j].bcast.s_addr = ntohl(Table[i][j].bcast.s_addr);
toread+=sizeof(int);
memcpy(&Table[i][j].netmask.s_addr,buffer+toread,sizeof(int));
Table[i][j].netmask.s_addr = ntohl(Table[i][j].netmask.s_addr);
toread+=sizeof(int);

}
printf("Owner: %s\n", Table[i][0].ipaddr.s_addr?
inet_ntoa(Table[i][0].ipaddr):"not acquired");
printf("\t* %5s:%s/%d\n", Table[i][1].ifname,
inet_ntoa(Table[i][1].ipaddr), mask2bits(Table[i][1].netmask.s_addr));
for(j=2; j<MAX_DEP_IF+2 && Table[i][j].ipaddr.s_addr; j++)
printf("\t -> %5s:%s/%d\n", Table[i][j].ifname,
inet_ntoa(Table[i][j].ipaddr), mask2bits(Table[i][j].netmask.s_addr));

Those marked with "-->" look a bit suspicious to me, since
ntohl()'ing IP adresses and then using inet_ntoa() on them sounds
not right.

Not sure whether the swaps for the broadcast addr or the netmask
are right either, I haven't followed through to the source of the data
yet.

mjl

mod_backhand wackamole RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.