[Bro] Patch for 1.3? Was: Type conversion and table initialization
Mike Dopheide
dopheide at ncsa.uiuc.edu
Thu Jul 12 11:33:32 PDT 2007
Vern,
That works great. The only issue is that the packets I'm dealing with
have it in host order rather than network order.
-Mike
Vern Paxson wrote:
>> Would it be possible to get this added in before the 1.3 release?
>
> Please try the appended and let me know if it works as you need.
>
> Vern
>
>
> Index: src/bro.bif
> ===================================================================
> --- src/bro.bif (revision 4618)
> +++ src/bro.bif (working copy)
> @@ -496,6 +496,23 @@
> return ret;
> %}
>
> +# Interprets the first 4 bytes of 'b' as an IPv4 address in network order.
> +function raw_bytes_to_v4_addr%(b: string%): addr
> + %{
> + uint32 a = 0;
> +
> + if ( b->Len() < 4 )
> + builtin_run_time("too short a string as input to raw_bytes_to_v4_addr()");
> +
> + else
> + {
> + const u_char* bp = b->Bytes();
> + a = (bp[0] << 24) | (bp[1] << 16) | (bp[2] << 8) | bp[3];
> + }
> +
> + return new AddrVal(a);
> + %}
> +
> function to_net%(a: addr%): net
> %{
> #ifdef BROv6
>
>
More information about the Bro
mailing list