[Bro-Dev] IPv4 and IPv6 addresses in Broccoli

Siwek, Jonathan Luke jsiwek at illinois.edu
Tue Mar 20 14:29:33 PDT 2012

> Broccoli uses the following structure to represent addresses:
>    typedef struct bro_addr {
>      uint32      addr[4];   /**< IP address in network byte order */
>      int         size;      /**< Number of 4-byte words occupied in addr */
>    } BroAddr;
> Why do we need the second field? That is, why don't we use a single 16 byte
> array, where the version distinction occurs implicitly through the IPv4
> mapped prefix (as in Bro)?

I think I had done that just to be more like how the serialization process in Bro represents addresses as the length of the address in bytes followed by the address, but it could also construct the IPv4 mapped addresses like you said instead and it would be fine, too.  Think it's worth changing?

Should we also change the serialization to always represent addresses as 16 bytes?  Seems inefficient right now, but I guess it would eventually become better once IPv6 addresses are the more frequent type.


More information about the bro-dev mailing list