From owner-freebsd-net@FreeBSD.ORG Tue Apr 27 12:05:50 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 5915F16A4CE for ; Tue, 27 Apr 2004 12:05:50 -0700 (PDT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF21643D1F for ; Tue, 27 Apr 2004 12:05:48 -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 i3RJB1o7064773 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 27 Apr 2004 22:11:02 +0300 (EEST) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.12.11/8.12.11) id i3RJ5hJS076084; Tue, 27 Apr 2004 22:05:43 +0300 (EEST) (envelope-from ru) Date: Tue, 27 Apr 2004 22:05:43 +0300 From: Ruslan Ermilov To: Mark Santcroos Message-ID: <20040427190543.GA75827@ip.net.ua> References: <20040427160901.GA2552@laptop.6bone.nl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FCuugMFkClbJLl1L" Content-Disposition: inline In-Reply-To: <20040427160901.GA2552@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: Tue, 27 Apr 2004 19:05:50 -0000 --FCuugMFkClbJLl1L Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Apr 27, 2004 at 06:09:01PM +0200, Mark Santcroos wrote: > * I'm sending UDP packets on a raw socket. >=20 > * iphdr->ip_src.s_addr =3D INADDR_ANY; > So I don't know the IP address that will be used as src address. > So as far as I can see, I have a problem generating the checksum in > userspace. >=20 Yes, that problem is real. > Suggestion: >=20 > Would it make sense that if: > sysctl net.udp.checksum=3D1 > and > udphdr->uh_sum =3D 0; > in a UDP packet created on a raw socket, to do the checksum in the kernel > instead of leaving it zero? If it does, I can create a patch. >=20 > Any other hints as how to do the checksum in userland are welcome too. As > that is the "ultimate" problem I try to fix. >=20 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. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --FCuugMFkClbJLl1L Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAjq8GUkv4P6juNwoRAvxJAJ4tHLdBZ1hzYCUBGQut4HBgVwHmXwCfT0rR ebFdz10AGKUUZpT4CXK4tn8= =mvLQ -----END PGP SIGNATURE----- --FCuugMFkClbJLl1L--