From 294aaa04156412dd126d50eced515eb8b9cb5697 Mon Sep 17 00:00:00 2001 From: insomniac Date: Tue, 20 Sep 2016 20:39:05 +0100 Subject: [PATCH] Renamed --dsr to --broken-nat to reflect the reality --- documentation/readme/README.md | 12 ++++++++---- include/dublintraceroute/dublin_traceroute.h | 16 ++++++++-------- include/dublintraceroute/traceroute_results.h | 4 ++-- src/dublin_traceroute.cc | 2 +- src/main.cc | 13 ++++++------- src/traceroute_results.cc | 6 +++--- 6 files changed, 28 insertions(+), 25 deletions(-) diff --git a/documentation/readme/README.md b/documentation/readme/README.md index 37317dd..725e2ef 100644 --- a/documentation/readme/README.md +++ b/documentation/readme/README.md @@ -85,8 +85,12 @@ Dublin Traceroute also features a Python extension on top of the C++ core if you prefer. The bindings now live in a separate repository, see [python-dublin-traceroute](https://github.com/insomniacslk/python-dublin-traceroute) . -**The third is that it supports DSR NATs.** -Dublin Traceroute is able to work with Direct Server Response NATs that some hosting providers use. Neither paris-traceroute nor regular traceroute would work with it. When you run a regular traceroute or paris-traceroute through this kind of NAT, you will see no response from all the hops located just after the DSR NAT boxes. +**The third is that it supports broken NATs.** +Dublin Traceroute is able to work with some broken NATs that some hosting providers use +(e.g. I found that Scaleway does that). Neither paris-traceroute nor regular traceroute +would work with it, but it's not their fault as this is a network misconfiguration. When +you run a regular traceroute or paris-traceroute through this kind of NAT, you will see +no response from all the hops located just after these broken NAT boxes. See the [examples](examples.md) to see Dublin Traceroute at work. @@ -223,14 +227,14 @@ Usage: [--dport=dest_base_port] [--npaths=num_paths] [--max-ttl=max_ttl] - [--dsr] + [--broken-nat] Options: -s SRC_PORT --sport=SRC_PORT the source port to send packets from -d DST_PORT --dport=DST_PORT the base destination port to send packets to -n NPATHS --npaths=NPATHS the number of paths to probe -t MAX_TTL --max-ttl=MAX_TTL the maximum TTL to probe - -d --dsr the network has a DSR NAT. May help when you only see a few hops + -b --broken-nat the network has a broken NAT configuration (e.g. no payload fixup). May help when you see only a few hops See documentation at https://dublin-traceroute.net diff --git a/include/dublintraceroute/dublin_traceroute.h b/include/dublintraceroute/dublin_traceroute.h index e39265a..9062551 100644 --- a/include/dublintraceroute/dublin_traceroute.h +++ b/include/dublintraceroute/dublin_traceroute.h @@ -46,7 +46,7 @@ class DublinTraceroute { IPv4Address target_; const uint8_t npaths_, max_ttl_; - const bool dsr_; // direct server response + const bool broken_nat_; std::mutex mutex_tracerouting, mutex_sniffed_packets; IPv4Address my_address; @@ -57,21 +57,21 @@ class DublinTraceroute { static const uint16_t default_dstport = 33434; static const uint8_t default_npaths = 20; static const uint8_t default_max_ttl = 30; - static const bool default_dsr = false; + static const bool default_broken_nat = false; DublinTraceroute( const std::string &dst, const uint16_t srcport = default_srcport, const uint16_t dstport = default_dstport, const uint8_t npaths = default_npaths, const uint8_t max_ttl = default_max_ttl, - const bool dsr = default_dsr + const bool broken_nat = default_broken_nat ): srcport_(srcport), dstport_(dstport), dst_(dst), npaths_(npaths), max_ttl_(max_ttl), - dsr_(dsr) + broken_nat_(broken_nat) { } DublinTraceroute( const char *dst, @@ -79,14 +79,14 @@ class DublinTraceroute { const uint16_t dstport = default_dstport, const uint8_t npaths = default_npaths, const uint8_t max_ttl = default_max_ttl, - const bool dsr = default_dsr + const bool broken_nat = default_broken_nat ): srcport_(srcport), dstport_(dstport), dst_(std::string(dst)), npaths_(npaths), max_ttl_(max_ttl), - dsr_(dsr) + broken_nat_(broken_nat) { } ~DublinTraceroute() { std::lock_guard lock(mutex_tracerouting); }; DublinTraceroute(const DublinTraceroute& source): @@ -95,14 +95,14 @@ class DublinTraceroute { dst_(source.dst_), npaths_(source.npaths_), max_ttl_(source.max_ttl_), - dsr_(source.dsr_) + broken_nat_(source.broken_nat_) { } inline const uint16_t srcport() const { return srcport_; } inline const uint16_t dstport() const { return dstport_; } inline const uint8_t npaths() const { return npaths_; } inline const uint8_t max_ttl() const { return max_ttl_; } - inline const bool dsr() const { return dsr_; } + inline const bool broken_nat() const { return broken_nat_; } inline const std::string &dst() const { return dst_; } inline const IPv4Address &target() const { return target_; } void target(const IPv4Address &addr) { target_ = addr; } diff --git a/include/dublintraceroute/traceroute_results.h b/include/dublintraceroute/traceroute_results.h index e0e272d..6bfe42b 100644 --- a/include/dublintraceroute/traceroute_results.h +++ b/include/dublintraceroute/traceroute_results.h @@ -24,10 +24,10 @@ class TracerouteResults { private: std::shared_ptr flows_; bool compressed_; - bool dsr_; + bool broken_nat_; public: - TracerouteResults(std::shared_ptr flows, const bool dsr /* = false */); + TracerouteResults(std::shared_ptr flows, const bool broken_nat /* = false */); ~TracerouteResults() { }; inline flow_map_t &flows() { return *flows_; } std::shared_ptr match_packet(const Packet &packet); diff --git a/src/dublin_traceroute.cc b/src/dublin_traceroute.cc index 02700b9..65755e9 100644 --- a/src/dublin_traceroute.cc +++ b/src/dublin_traceroute.cc @@ -170,7 +170,7 @@ TracerouteResults &DublinTraceroute::traceroute() { } std::shared_ptr sniffer(_sniffer); - TracerouteResults *results = new TracerouteResults(flows, dsr()); + TracerouteResults *results = new TracerouteResults(flows, broken_nat()); // configure the sniffing handler auto handler = std::bind( diff --git a/src/main.cc b/src/main.cc index d65878a..dfbdb3e 100644 --- a/src/main.cc +++ b/src/main.cc @@ -23,14 +23,14 @@ Written by Andrea Barberio - https://insomniac.slackware.it [--dport=dest_base_port] [--npaths=num_paths] [--max-ttl=max_ttl] - [--dsr] + [--broken-nat] Options: -s SRC_PORT --sport=SRC_PORT the source port to send packets from -d DST_PORT --dport=DST_PORT the base destination port to send packets to -n NPATHS --npaths=NPATHS the number of paths to probe -t MAX_TTL --max-ttl=MAX_TTL the maximum TTL to probe - -d --dsr the network has a DSR NAT. May help when you only see a few hops + -b --broken-nat the network has a broken NAT configuration (e.g. no payload fixup). May help when you see only a few hops See documentation at https://dublin-traceroute.net @@ -45,7 +45,7 @@ main(int argc, char **argv) { long dport = DublinTraceroute::default_dstport; long npaths = DublinTraceroute::default_npaths; long max_ttl = DublinTraceroute::default_max_ttl; - bool dsr = DublinTraceroute::default_dsr; + bool broken_nat = DublinTraceroute::default_broken_nat; std::map args = docopt::docopt( USAGE, @@ -75,12 +75,11 @@ main(int argc, char **argv) { CONVERT_TO_LONG_OR_EXIT(arg.second, npaths); } else if (arg.first == "--max-ttl") { CONVERT_TO_LONG_OR_EXIT(arg.second, max_ttl); - } else if (arg.first == "--dsr") { - dsr = arg.second.asBool(); + } else if (arg.first == "--broken-nat") { + broken_nat = arg.second.asBool(); } } #undef CONVERT_TO_LONG_OR_EXIT - std::cout << "Source port: " << sport << std::endl; if (sport < 1 || sport > 65535) { std::cerr << "Source port must be between 1 and 65535" << std::endl; std::exit(EXIT_FAILURE); @@ -111,7 +110,7 @@ main(int argc, char **argv) { dport, npaths, max_ttl, - dsr + broken_nat ); std::cout << "Traceroute from 0.0.0.0:" << Dublin.srcport() diff --git a/src/traceroute_results.cc b/src/traceroute_results.cc index 269f5c9..bf819f1 100644 --- a/src/traceroute_results.cc +++ b/src/traceroute_results.cc @@ -21,8 +21,8 @@ #include "dublintraceroute/icmp_messages.h" -TracerouteResults::TracerouteResults(std::shared_ptr flows, const bool dsr = true): - flows_(flows), compressed_(false), dsr_(dsr) { +TracerouteResults::TracerouteResults(std::shared_ptr flows, const bool broken_nat = true): + flows_(flows), compressed_(false), broken_nat_(broken_nat) { } @@ -68,7 +68,7 @@ std::shared_ptr TracerouteResults::match_packet(const Packet &packet) { unsigned int index = 0; for (auto &hop: *hops) { auto &sent = hop.sent()->rfind_pdu(); - if (!dsr_) { + if (!broken_nat_) { if (sent.src_addr() != inner_ip.src_addr()) continue; }