From owner-freebsd-net@FreeBSD.ORG Wed Apr 28 00:05:59 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5C31816A4CE for ; Wed, 28 Apr 2004 00:05:59 -0700 (PDT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CF4E43D5A for ; Wed, 28 Apr 2004 00:05:58 -0700 (PDT) (envelope-from ru@ip.net.ua) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id i3S7BFKn007757 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 28 Apr 2004 10:11:17 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.12.11/8.12.11) id i3S75twU025217; Wed, 28 Apr 2004 10:05:55 +0300 (EEST) (envelope-from ru) Date: Wed, 28 Apr 2004 10:05:54 +0300 From: Ruslan Ermilov To: Mark Santcroos Message-ID: <20040428070554.GB25064@ip.net.ua> References: <20040427160901.GA2552@laptop.6bone.nl> <20040427190543.GA75827@ip.net.ua> <20040427211639.GA1455@laptop.6bone.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="OwLcNYc0lM97+oe1" Content-Disposition: inline In-Reply-To: <20040427211639.GA1455@laptop.6bone.nl> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: net@freebsd.org Subject: Re: udp checksum on raw sockets X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Apr 2004 07:05:59 -0000 --OwLcNYc0lM97+oe1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 27, 2004 at 11:16:39PM +0200, Mark Santcroos wrote: > Hi, >=20 > On Tue, Apr 27, 2004 at 10:05:43PM +0300, Ruslan Ermilov wrote: > > Have the raw IP code set csum_flags |=3D CSUM_UDP (and set csum_data > > correctly) in m->m_pkthdr, if ip_p =3D=3D IPPROTO_UDP && uh_csum =3D=3D= 0. > > Do the same thing for IPPROTO_TCP. >=20 > Like I said, I'm willing to tackle this in the kernel, but for now I also= =20 > need a userland-only solution. >=20 OK. > I guess I can fetch the IP address from the first ethernet iface and use > that as the src address for the IP packet. >=20 getifaddrs(3). > Then I have enough information to calculate the UDP checksum in userland, > don't I? >=20 Yes, you do. Another possibility would be to emit UDP datagrams unchecksummed, by leaving the checksum field as zero. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --OwLcNYc0lM97+oe1 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAj1fSUkv4P6juNwoRAog+AJoDFRw8mza7E0TbcxiRdVsosWUrywCfZcha hn1LOV/PxiEmQ6jT4Mthe2s= =IfO1 -----END PGP SIGNATURE----- --OwLcNYc0lM97+oe1--