Q:possibility PFIL+mbuf use for packet spawning
lsimakov at gmail.com
Tue Jan 19 14:28:21 UTC 2010
Error: line And server got message:"Test Message.Qnd message" should read
And server got message:"Test Message.G\0d message".
Sent you last logs, big Apologises :(
2010/1/19 q q <lsimakov at gmail.com>
> I coded all checksum calculations code. All works ok when i just modifying
> data of packets(like all T letters to Q letters)
> But now i get some strange error:
> packet1: TestMessage.
> packet2: 2nd message
> im using on first packet only next code(data is a pointer to char* from
> mbuf containing strings):
> int res=m_append(*m,2,TEST);
> printf("res cames from m_append:%d \n",res);
> printf("new data string is %s \n",data);
> iph->ip_len+=2;//modifying IP header length
> Then recalculatin IP and TCP cheksums(correctly seems because network
> doesnt drop packets)
> And server got message:"Test Message.Qnd message" As well server reply with
> ACK=25. So seems no new chars were added.
> Seems like im overwriting 2nd packet. But why this happening?
> Thank you :)
> Yours, Qspirit.
> PS sorry Max for double mail, forgot to add cc hackers.
> 2010/1/15 Max Laier <max at love2party.net>
>> On Friday 15 January 2010 12:26:06 q q wrote:
>> > I'm using pfil as packet filter for packet modifications.
>> > Is it possible to spawn new packets to network from pfil using mbuf?
>> You can call into ip_output with a new mbuf to send a new packet. See for
>> example pf_send_tcp in contrib/pf/net/pf.c
>> > Another question: im using m_append to change packet length and add
>> > data(its working, at least server got longer message) but when i
>> > clients packets(win machine) i see that i got acknoledge on older
>> > not on new one. Am i missunderstanding something?
>> Assuming you are talking about tcp packets (otherwise there wouldn't be an
>> ack), you have to alter the tcp header, checksums, etc. as well. Just
>> data doesn't work.
More information about the freebsd-hackers