<p>Hi<br></p><p>i just tracked down a strange bug, but still don`t understand why it is a bug (-;</p><p>i have and had the http-plugin configured like this,</p><p>    PlParam     "Net"   "<a href="http://0.0.0.0">0.0.0.0</a> <a href="http://0.0.0.0">0.0.0.0</a>"<br>
<br>so everybody could access the http-plugin, and it worked as expected,..<br></p><p>as i upgraded the olsrd from 0.5.6r2 to head (54b2ca51a0b1)</p><p>only localhost oculd connect to http plugin</p><p>i checked around findiun that other netmasks worked e.g. /24 or /1, but not /0</p>
<p>so i startet to debug the code,..</p><p>i ended in ipcalc.c </p><p>121 if(olsr_cnf->ip_version == AF_INET) {<br>122      uint32_t netmask = ntohl(~0 << (32 - net->prefix_len));<br>123      rv = (ipaddr->v4.s_addr & netmask) == (net->prefix.v4.s_addr & netmask);<br>
124   }</p><p>~0 in my understanding is 11111111111111111111111111111111</p><p>the prefix_len was correctly 0 for <a href="http://0.0.0.0/0">0.0.0.0/0</a></p><p>so netmask should get 32 zeros shifted in from the right, ending in having only zeros and a value of 0</p>
<p>but it was still 2^32 at line 123, and ip_in_net returned false, and hhhtpinfo rejected the connection,..</p><p>i changed the code like this to make it working, but i still don`t understand why above code doesnt work, and why the simlar code in 0.5.6r2 did work,..</p>
<p>if(olsr_cnf->ip_version == AF_INET) {<br>    uint32_t netmask = ~0;<br>    if (net->prefix_len==0) netmask=!netmask; else netmask=ntohl(netmask << (32 - net->prefix_len));<br>    rv = (ipaddr->v4.s_addr & netmask) == (net->prefix.v4.s_addr & netmask);<br>
}<br></p><p>in 0.5.6r2 it was infact the same code, just custom olsr types have been used, so wtf?</p><p>it was compiled 1 week ago with same compiler on same machine, so wtf?</p><p>if(olsr_cnf->ip_version == AF_INET) {<br>
 olsr_u32_t netmask = ~0 << (32 - net->prefix_len);<br> rv = (ipaddr->v4.s_addr & netmask) == (net->prefix.v4.s_addr & netmask);<br>}</p><p>so i will now step back to 0.5.6r2 to find out why and how this code workes,..</p>
<p>Or has anybody an explanation for this??</p><p>Markus<br><br><br></p>