From owner-freebsd-hackers@FreeBSD.ORG Tue Jan 19 14:28:21 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3745D1065676 for ; Tue, 19 Jan 2010 14:28:21 +0000 (UTC) (envelope-from lsimakov@gmail.com) Received: from mail-ew0-f226.google.com (mail-ew0-f226.google.com [209.85.219.226]) by mx1.freebsd.org (Postfix) with ESMTP id AD5778FC15 for ; Tue, 19 Jan 2010 14:28:20 +0000 (UTC) Received: by ewy26 with SMTP id 26so1038787ewy.3 for ; Tue, 19 Jan 2010 06:28:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=A8fqbOxwurxPyZOyP9o+eoHAaUhq5qS8GbywXdyMB4s=; b=rCbtmYvJH5me1mGFNoH0wWZQ+O80D12ObCALzHyXiQihR1XF8oHUUFrKMpJx5DZsV/ g613/C6QNeFSPRx/FRZT16lVKZsSNDBUEdA3HUFMHmCm2zYeqKZAIJzaJTm2kLQGoQdu H2id+/2g+S3WPp94VwQZfaO3z4KOKoRuz2z04= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=c+sqHF7sh262dR8Kpo9Aob04dVW8CCstOePwb1TycK0X66uJv6m9ekJA5n58jnVANY hy4CY/5gdCC2QcKVUzDQCD9mnnFlJRdts8MJX1f8Qyjs1/ZA3BLc1ks6MBgCEYsrtVBn aPzwyNqLUu6Bl5qOfhHXzZDW+SXUOVr40g7Ms= MIME-Version: 1.0 Received: by 10.216.85.213 with SMTP id u63mr512613wee.15.1263911299468; Tue, 19 Jan 2010 06:28:19 -0800 (PST) In-Reply-To: References: <201001151711.23061.max@love2party.net> Date: Tue, 19 Jan 2010 17:28:19 +0300 Message-ID: From: q q To: Max Laier Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Q:possibility PFIL+mbuf use for packet spawning X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jan 2010 14:28:21 -0000 Error: line And server got message:"Test Message.Qnd message" should read as line And server got message:"Test Message.G\0d message". Sent you last logs, big Apologises :( 2010/1/19 q q > > 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): > > TEST[0]='G'; > TEST[1]='\0'; > int res=m_append(*m,2,TEST); > m_fixhdr(*m); > 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 > >> 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 >> wireshark >> > clients packets(win machine) i see that i got acknoledge on older >> length >> > 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 >> adding >> data doesn't work. >> >> Regards, >> -- >> Max >> > >