How to get the IP and TCP fields in mbuf

Julian Kirsch kirschju at sec.in.tum.de
Thu Jan 8 14:15:45 UTC 2015


Hi Wei,

Are you looking for something like this?

+	struct ip *ip = mtod(m, struct ip *);

m is a struct mbuf *. You cann look into my knock-patch for FreeBSD [0]
for further examples.

Best,
Julian

[0] https://gnunet.org/knock

On 08.01.2015 14:18, Wei Hu wrote:
> Hi,
> 
> I am wondering if there is existing macros in the FreeBSD kernel to extract to get to the point of the IP and TCP head in a given mbuf.
> 
> Thanks,
> Wei
> 
> 
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
> 


-- 
Julian Kirsch
Chair for IT-Security (I20)
Department of Computer Science, Technische Universität München
Boltzmannstrasse 3, D-85748 Garching bei München
Phone: +49-89-289-18587
Room: 01.08.53


More information about the freebsd-net mailing list