Date: Mon, 8 Jan 2007 20:32:11 +0000 From: Lee Brotherston <lee@nerds.org.uk> To: freebsd-hackers@freebsd.org Subject: TCP Checksums in mbufs Message-ID: <20070108203211.GF41066@nerds.org.uk>
next in thread | raw e-mail | index | archive | help
--BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I have a bit of code I have written that uses pfil to access network traffic as it passes between interfaces on a FreeBSD router. One of the functions it performs is some incredibly basic rewrites of certain packets (keeping the same length, so no issues about sequence numbers), but it does alter the payload. I just wanted to check what is the "proper" way to be going about recalculating the checksums on the packet? I can write a function to do this and write this into the packet stored in the mbuf directly, however I wasn't sure if there was a more acceptable method such as flagging it to be re-checksum'd as it's routed, or to offload the computation to the NIC or something? Any thoughts, suggestions, etc very welcome! By the way, I'm not subscribed to the list right now, so I'd appreciate it if people could CC me on replies. Many thanks Lee --=20 Lee Brotherston - <lee@nerds.org.uk> --BOKacYhQ+x31HxR3 Content-Type: application/x-pkcs7-signature Content-Disposition: attachment; filename="smime.p7s" Content-Transfer-Encoding: base64 MIIIvQYJKoZIhvcNAQcCoIIIrjCCCKoCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3DQEHAaCC BjQwggLtMIICVqADAgECAhBuQYdNaKuFQWQVFA/nyFETMA0GCSqGSIb3DQEBBAUAMGIxCzAJ BgNVBAYTAlpBMSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYD VQQDEyNUaGF3dGUgUGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTAeFw0wNjA1MDUxNTU4 NTJaFw0wNzA1MDUxNTU4NTJaMEIxHzAdBgNVBAMTFlRoYXd0ZSBGcmVlbWFpbCBNZW1iZXIx HzAdBgkqhkiG9w0BCQEWEGxlZUBuZXJkcy5vcmcudWswggEiMA0GCSqGSIb3DQEBAQUAA4IB DwAwggEKAoIBAQDZHAa7GJzL38gNE59SYrjnN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