Mailing List Archive

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