Re: question when using options in headers..

Mike Schiffman <[email protected]>
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
q1: Yes that is correct ordering. See sample/tcp1.c for a sample 
application using TCP options. To answer the second part: Not using the 
options builder function. Since the options string will actually have 
its own pblock, if you save existing ptags, then call builder functions 
inside of a loop using those ptags, the next call to a builder function 
WITHOUT a saved ptag will generate a new pblock at the end of the list. 
Two things you can try: 1) place your TCP or IP options inside the 
payload and adjust the appropriate header values. 2) try calling an 
options builder with a 0 sized payload and save its ptag. I kinda doubt 
this second one will work though; there is a ton of pointer math and 
indirection going on inside the options builders.

q2: It all depends on your needs. If you're only sending packets one at 
a time with a fire and forget mentality, use only one context. If you 
need to send multiple packets over and over again, use the cq 
interface.

q3: I just tested the advanced mode and it worked fine as of 
1.1.2-rc-05. Can you be more specific with your error? Are you sure you 
initialized the library properly?

On Jan 25, 2004, at 5:14 AM, Mustafa Abu Sedera wrote:

>
> I have a question when sending packets which have header options, as i 
> didn't find any examples on it.
>
> q1:
> Is this order of packet building correct?
> e.g. TCP:
> 1- build_options()
> 2- build_tcp_header-with payload specified, length = paylod_s+20 (or 
> should i add: + option_length)
> 3-build_build_ipv4(LIBNET_RAW4)
> 4-write()
>
> can I send a packet with no options and store the tags of the 
> functions and then later use those tags to send another one WITH 
> options, or would it be considered like a packet with a different 
> protocol? (so I would have to clear() the context first it first)
>
> q2:
> Whats best in sending packets with different protocols:
> a) defining only one libnet context and using it to send pkts of all 
> protocols by calling libnet_clear_packet() after each libnte_write() 
> operation.
> b)defining a libnet context for each type of protocol I use and 
> modifying the parameters later when needed with the tag.
>
> q3:
> even if i use the _ADV suffix the cull pkt returns an error that it 
> was not advanced mode initialized.
>
> Thanks in advance and i REALLY hope this time someone answers me.
>
> Regards
>
> _________________________________________________________________
> Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
> http://join.msn.com/?page=features/junkmail
>
>
>
> <!DSPAM:4014a860253386321963354>
>
>
>
--
Mike Schiffman, CISSP
http://www.packetfactory.net/schiffman
Doveryay No Proveryay
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.