Date: Thu, 09 Sep 2004 19:09:09 +0900 From: "George V. Neville-Neil" <gnn@neville-neil.com> To: snap-users@kame.net Cc: Bosko Milekic <bmilekic@technokratis.com> Subject: Patch for NetPIPE to support IPv6 Message-ID: <m2llfj69fe.wl@minion.local.neville-neil.com>
next in thread | raw e-mail | index | archive | help
--Multipart_Thu_Sep__9_19:09:09_2004-1 Content-Type: text/plain; charset=US-ASCII Hi, I have created a patch for NetPIPE version 3.6.2 that makes it work with IPv6. If you're unfamiliar with NetPIPE then jump to here: http://www.scl.ameslab.gov/netpipe/ In short NetPIPE is a cool tool for generating packets and stressing/testing networks. I suggest reading the papers they have on their web site. I've submitted this patch to the nice folks at ameslab as well, and will be using it in my own work on locking down the IPv6 code in FreeBSD. Apply the patch like this: cd NetPIPE-3.2.2 patch -p0 < ~/netpipe.patch make tcp6 This will generate the program NPtcp6 which must be run as a client/server pair. server> ./NPtcp6 client> ./NPtcp6 -h <client IPv6/name> You can specify IPv6 style addresses such as ::1 etc. for the -h argument. I have not tested the gethostbyname2() call yet as I'm trapped behind a NAT at the moment. It ought to work though. Bugs with the IPv6 version of this code should be sent to me, and not to the nice folks at ameslab who wrote the original. Later, George --Multipart_Thu_Sep__9_19:09:09_2004-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="netpipe.patch" Content-Transfer-Encoding: base64 SW5kZXg6IG1ha2VmaWxlCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0KUkNTIGZpbGU6IC9jdnMvZ25uL1BlcnNvbmFsL0Nv ZGUvTmV0d29ya2luZy9OZXRQSVBFL21ha2VmaWxlLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjEu MS4xCnJldHJpZXZpbmcgcmV2aXNpb24gMS4yCmRpZmYgLXUgLXIxLjEuMS4xIC1yMS4yCi0tLSBt YWtlZmlsZQk5IFNlcCAyMDA0IDA4OjI5OjIyIC0wMDAwCTEuMS4xLjEK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qKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKiovCisvKiAiTmV0UElQRSIgLS0gTmV0d29yayBQcm90b2NvbCBJbmRlcGVuZGVudCBQZXJm b3JtYW5jZSBFdmFsdWF0b3IuICAgICAgICAgICovCisvKiBDb3B5cmlnaHQgMTk5NywgMTk5OCBJ b3dhIFN0YXRlIFVuaXZlcnNpdHkgUmVzZWFyY2ggRm91bmRhdGlvbiwgSW5jLiAgICAgICovCisv KiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICovCisvKiBUaGlzIHByb2dyYW0gaXMgZnJlZSBzb2Z0d2FyZTsg eW91IGNhbiByZWRpc3RyaWJ1dGUgaXQgYW5kL29yIG1vZGlmeSAgICAgICovCisvKiBpdCB1bmRl ciB0aGUgdGVybXMgb2YgdGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hl ZCBieSAgICAgICovCisvKiB0aGUgRnJlZSBTb2Z0d2FyZSBGb3VuZGF0aW9uLiAgWW91IHNob3Vs ZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgICAgICovCisvKiBHTlUgR2VuZXJhbCBQdWJs aWMgTGljZW5zZSBhbG9uZyB3aXRoIHRoaXMgcHJvZ3JhbTsgaWYgbm90LCB3cml0ZSB0byB0aGUg ICovCisvKiBGcmVlIFNvZnR3YXJlIEZvdW5kYXRpb24sIEluYy4sIDY3NSBNYXNzIEF2ZSwgQ2Ft YnJpZGdlLCBNQSAwMjEzOSwgVVNBLiAgICovCisvKiAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiBU Q1A2IGV4dGVuc2lvbiBDb3B5cmlnaHQgMjAwNCBHZW9yZ2UgVi4gTmV2aWxsZS1OZWlsIGFuZCBO ZXZpbGxlLU5laWwgICAgICovCisvKiBDb25zdWx0aW5nICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICovCisvKiAgICAgKiB0Y3A2LmMgICAgICAgICAtLS0tIFRDUCBvdmVyIElQdjYgY2Fs bHMgc291cmNlICAgICAgICAgICAgICAgICAgICAgICovCisvKiAgICAgKiB0Y3AuaCAgICAgICAg ICAtLS0tIEluY2x1ZGUgZmlsZSBmb3IgVENQNiBjYWxscyBhbmQgZGF0YSBzdHJ1Y3RzICAgICov CisvKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKiovCisjaW5jbHVkZSAgICAibmV0cGlwZS5oIgorCisjaWYg ZGVmaW5lZCAoTVBMSVRFKQorI2luY2x1ZGUgIm1wbGl0ZS5oIgorI2VuZGlmCisKKworaW50IGRv aW5nX3Jlc2V0ID0gMDsKKwordm9pZCBJbml0KEFyZ1N0cnVjdCAqcCwgaW50KiBwYXJnYywgY2hh cioqKiBwYXJndikKK3sKKyAgICBwLT5yZXNldF9jb25uID0gMDsgLyogRGVmYXVsdCB0byBub3Qg cmVzZXR0aW5nIGNvbm5lY3Rpb24gKi8KKyAgICBwLT5wcm90LnNuZGJ1ZnN6ID0gcC0+cHJvdC5y Y3ZidWZzeiA9IDA7CisgICAgLyogVGhlIHRyYW5zbWl0dGVyIHdpbGwgYmUgc2V0IHVzaW5nIHRo ZSAtaCBob3N0IGZsYWcuICovCisgICAgcC0+dHIgPSAwOworICAgIHAtPnJjdiA9IDE7Cit9CisK K3ZvaWQgU2V0dXAoQXJnU3RydWN0ICpwKQoreworICAgIGludCBvbmUgPSAxOworICAgIGludCBz b2NrZmQgPSAtMTsKKyAgICAvKiBwdHIgdG8gc29ja2FkZHJfaW4gaW4gQXJnU3RydWN0ICovCisg ICAgc3RydWN0IHNvY2thZGRyX2luNiAqbHNpbjEsICpsc2luMjsgICAgICAKKyAgICAKKyAgICBj aGFyICpob3N0OworICAgIHN0cnVjdCBob3N0ZW50ICpocDsKKyAgICBzdHJ1Y3QgcHJvdG9lbnQg KnByb3RvOworICAgIGludCBzZW5kX3NpemUsIHJlY3Zfc2l6ZSwgc2l6ZW9maW50ID0gc2l6ZW9m KGludCk7CisJCisgICAgaG9zdCA9IHAtPmhvc3Q7ICAgICAgICAgICAgICAgICAgICAgICAgICAg LyogY29weSBwdHIgdG8gaG9zdG5hbWUgKi8gCisJCisgICAgbHNpbjEgPSAmKHAtPnByb3Quc2lu MSk7CisgICAgbHNpbjIgPSAmKHAtPnByb3Quc2luMik7CisJCisgICAgYnplcm8oKGNoYXIgKikg bHNpbjEsIHNpemVvZigqbHNpbjEpKTsKKyAgICBiemVybygoY2hhciAqKSBsc2luMiwgc2l6ZW9m KCpsc2luMikpOworCisgICAgaWYgKChzb2NrZmQgPSBzb2NrZXQoQUZfSU5FVDYsIFNPQ0tfU1RS RUFNLCAwKSkgPCAwKXsKKwlwcmludGYoIk5ldFBJUEU6IGNhbid0IG9wZW4gc3RyZWFtIHNvY2tl dCEgZXJybm89JWRcbiIsIGVycm5vKTsKKwlleGl0KC00KTsKKyAgICB9CisKKyAgICBpZighKHBy b3RvID0gZ2V0cHJvdG9ieW5hbWUoInRjcCIpKSl7CisJcHJpbnRmKCJOZXRQSVBFOiBwcm90b2Nv bCAndGNwJyB1bmtub3duIVxuIik7CisJZXhpdCg1NTUpOworICAgIH0KKworICAgIC8qIEF0dGVt cHQgdG8gc2V0IFRDUF9OT0RFTEFZICovCisKKyAgICBpZihzZXRzb2Nrb3B0KHNvY2tmZCwgcHJv dG8tPnBfcHJvdG8sIFRDUF9OT0RFTEFZLCAmb25lLCBzaXplb2Yob25lKSkgPCAwKQorICA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2V0IHNl Y29uZHMgKi8KKworICAgICp0ID0gKGRvdWJsZSlsdGltZSAvIDEuMGU4OworfQorCit2b2lkIFNl bmRSZXBlYXQoQXJnU3RydWN0ICpwLCBpbnQgcnB0KQoreworICAgIHVpbnQzMl90IGxycHQsIG5y cHQ7CisKKyAgICBscnB0ID0gcnB0OworICAgIC8qIFNlbmQgcmVwZWF0IGNvdW50IGFzIGEgbG9u ZyBpbiBuZXR3b3JrIG9yZGVyICovCisgICAgbnJwdCA9IGh0b25sKGxycHQpOworICAgIGlmICh3 cml0ZShwLT5jb21tZmQsICh2b2lkICopICZucnB0LCBzaXplb2YodWludDMyX3QpKSA8IDApCisg ICAgeworCXByaW50ZigiTmV0UElQRTogd3JpdGUgZmFpbGVkIGluIFNlbmRSZXBlYXQ6IGVycm5v PSVkXG4iLCBlcnJubyk7CisJZXhpdCgzMDQpOworICAgIH0KK30KKwordm9pZCBSZWN2UmVwZWF0 KEFyZ1N0cnVjdCAqcCwgaW50ICpycHQpCit7CisgICAgdWludDMyX3QgbHJwdCwgbnJwdDsKKyAg ICBpbnQgYnl0ZXNSZWFkOworCisgICAgYnl0ZXNSZWFkID0gcmVhZEZ1bGx5KHAtPmNvbW1mZCwg KHZvaWQgKikmbnJwdCwgc2l6ZW9mKHVpbnQzMl90KSk7CisgICAgaWYgKGJ5dGVzUmVhZCA8IDAp CisgICAgeworCXByaW50ZigiTmV0UElQRTogcmVhZCBmYWlsZWQgaW4gUmVjdlJlcGVhdDogZXJy bm89JWRcbiIsIGVycm5vKTsKKwlleGl0KDMwNSk7CisgICAgfQorICAgIGVsc2UgaWYgKGJ5dGVz UmVhZCAhPSBzaXplb2YodWludDMyX3QpKQorICAgIHsKKwlmcHJpbnRmKHN0ZGVyciwgIk5ldFBJ UEU6IHBhcnRpYWwgcmVhZCBpbiBSZWN2UmVwZWF0IG9mICVkIGJ5dGVzXG4iLAorCQlieXRlc1Jl YWQpOworCWV4aXQoMzA2KTsKKyAgICB9CisgICAgbHJwdC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Byb3Quc25kYnVmc3opLCAKKwkJCSAgc2l6ZW9mKHAtPnByb3Quc25kYnVmc3opKSA8IDAp CisJICAgIHsKKwkJcHJpbnRmKCJzZXRzb2Nrb3B0OiBTT19TTkRCVUYgZmFpbGVkISBlcnJubz0l ZFxuIiwgZXJybm8pOworCQlleGl0KDU1Nik7CisJICAgIH0KKwkgICAgaWYoc2V0c29ja29wdChw LT5jb21tZmQsIFNPTF9TT0NLRVQsIFNPX1JDVkJVRiwgJihwLT5wcm90LnJjdmJ1ZnN6KSwgCisJ CQkgIHNpemVvZihwLT5wcm90LnJjdmJ1ZnN6KSkgPCAwKQorCSAgICB7CisJCXByaW50Zigic2V0 c29ja29wdDogU09fUkNWQlVGIGZhaWxlZCEgZXJybm89JWRcbiIsIGVycm5vKTsKKwkJZXhpdCg1 NTYpOworCSAgICB9CisJfQorICAgIH0KK30KKwordm9pZCBDbGVhblVwKEFyZ1N0cnVjdCAqcCkK K3sKKyAgICBjaGFyICpxdWl0PSJRVUlUIjsKKworICAgIGlmIChwLT50cikgeworCisJd3JpdGUo cC0+Y29tbWZkLHF1aXQsIDUpOworCXJlYWQocC0+Y29tbWZkLCBxdWl0LCA1KTsKKwljbG9zZShw LT5jb21tZmQpOworCisgICAgfSBlbHNlIGlmKCBwLT5yY3YgKSB7CisKKwlyZWFkKHAtPmNvbW1m ZCxxdWl0LCA1KTsKKwl3cml0ZShwLT5jb21tZmQscXVpdCw1KTsKKwljbG9zZShwLT5jb21tZmQp OworCWNsb3NlKHAtPnNlcnZpY2VmZCk7CisKKyAgICB9Cit9CisKKwordm9pZCBSZXNldChBcmdT dHJ1Y3QgKnApCit7CisgIAorICAgIC8qIFJlc2V0IHNvY2tldHMgKi8KKworICAgIGlmKHAtPnJl c2V0X2Nvbm4pIHsKKworCWRvaW5nX3Jlc2V0ID0gMTsKKworCS8qIENsb3NlIHRoZSBzb2NrZXRz ICovCisKKwlDbGVhblVwKHApOworCisJLyogTm93IG9wZW4gYW5kIGNvbm5lY3QgbmV3IHNvY2tl dHMgKi8KKworCVNldHVwKHApOworCisgICAgfQorCit9CisKK3ZvaWQgQWZ0ZXJBbGlnbm1lbnRJ bml0KEFyZ1N0cnVjdCAqcCkKK3sKKworfQorCg== --Multipart_Thu_Sep__9_19:09:09_2004-1--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m2llfj69fe.wl>