"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ec_utils.c" between
ettercap-0.8.3.tar.gz and ettercap-0.8.3.1.tar.gz

About: ettercap is a multipurpose sniffer/interceptor/logger for switched LAN.

ec_utils.c  (ettercap-0.8.3):ec_utils.c  (ettercap-0.8.3.1)
skipping to change at line 350 skipping to change at line 350
else else
#if defined OS_DARWIN #if defined OS_DARWIN
snprintf(result, sizeof(result), "%lu.%06d", (unsigned long)tv->tv_sec, tv ->tv_usec); snprintf(result, sizeof(result), "%lu.%06d", (unsigned long)tv->tv_sec, tv ->tv_usec);
#else #else
snprintf(result, sizeof(result), "%lu.%06lu", (unsigned long)tv->tv_sec, t v->tv_usec); snprintf(result, sizeof(result), "%lu.%06lu", (unsigned long)tv->tv_sec, t v->tv_usec);
#endif #endif
return (result); return (result);
} }
/*
* convert a prefix length to a bit pattern buffer that can be freed
* - expects the length of memory to allocate
* - expects the prefix mask bit length
* - returns a byte string pointer to the allocated memory containing
* the bit mask corresponding to the prefix bit length
*/
u_char *ec_plen_to_binary(size_t buflen, u_int16 plen)
{
size_t len;
u_char *buf, *p;
u_int32 i;
/* determine the network-host boundary byte */
len = plen % 8 ? plen / 8 + 1 : plen / 8;
BUG_IF(len > buflen);
/* allocate enough buffer */
SAFE_CALLOC(buf, buflen, sizeof(u_char));
p = buf;
for (i = 0; i < len; i++)
if (i == len-1)
*p++ = 0xff << (8-(plen-8*i));
else
*p++ = 0xff;
return buf;
}
/* EOF */ /* EOF */
// vim:ts=3:expandtab // vim:ts=3:expandtab
 End of changes. 1 change blocks. 
0 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)