ng_netflow patch for AS filling

devel at stasyan.com devel at stasyan.com
Tue Mar 26 13:07:41 UTC 2013


>> Patch for injecting information network->as_number from extrernal
>> sources (RIPE database, for example) into kernel and filling src and dst
>> AS-number in Netflow v5 datagrams.
> +	o1=(htonl(rec->src_addr)>>24)&0xFF;
> +	o2=(htonl(rec->src_addr)>>16)&0xFF;
> +	o3=(htonl(rec->src_addr)>>8)&0xFF;
> +	o4=(htonl(rec->src_addr))&0xFF;
> +	a1=GetAsnumber(aaa,o1,o2,o3,o4);
> Why do you need o* here?
Per-byte presentation of IPV4-address required because scheme of  
storing based on it.

> Why not using in_addr in GetAsnumber()?
> Why you are using 255 as multiplier ?
255 - width of array. It's access to two-dimensonal array.

> MALLOC(asn[255*i1+i2].ptr_low,struct ascelllow*, sizeof(struct
> ascelllow),M_NETFLOW_HASH,M_NOWAIT);
> ^^ malloc() with M_WAITOK can be used here.
Ok, will be done.

> You should support at least loading 32-bit ASNs (and convert them to
> 23456 for v5 export).
Ok, will be done.

> +                case NGM_NETFLOW_DELETENETFROMAS:
> +                {
> +                        break;
> +                }
> You should probably support deleting prefixes :)
"Global" delete (when destroing node) support now. But "partial"  
deleting support need too, you're right.


> +struct ascellhigh {
> +	struct ascelllow*	ptr_low;
> +};
>
> Do we need another layer here?
Current scheme was optimized for fast_search/small_memory_utilization  
for IPV4-table. I suppose that for IPV6 we need something another.

> While v5 export supports IPv4 and 2-byte ASNs only it is probably much
> better to include IPv6 support at least in NGM_ messages ( like
> ng_ksocket do ).




More information about the freebsd-net mailing list