mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Merge remote-tracking branch 'origin/topic/vladg/dhcp'
* origin/topic/vladg/dhcp: DHCP: Adding unit tests. DHCP: Rework the DHCP analyzer to make it compatible again.
This commit is contained in:
commit
308db797c3
23 changed files with 510 additions and 274 deletions
|
@ -148,6 +148,26 @@ const char* fmt_conn_id(const uint32* src_addr, uint32 src_port,
|
|||
return fmt_conn_id(src, src_port, dst, dst_port);
|
||||
}
|
||||
|
||||
char* fmt_mac(const unsigned char* m, int len)
|
||||
{
|
||||
char* buf = new char[25];
|
||||
|
||||
if ( len < 8 )
|
||||
{
|
||||
*buf = '\0';
|
||||
return buf;
|
||||
}
|
||||
|
||||
if ( m[6] == 0 && m[7] == 0 ) // EUI-48
|
||||
snprintf(buf, 19, "%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5]);
|
||||
else
|
||||
snprintf(buf, 25, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
m[0], m[1], m[2], m[3], m[4], m[5], m[6], m[7]);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
uint32 extract_uint32(const u_char* data)
|
||||
{
|
||||
uint32 val;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue