From 3ea171c085b92fb6cf260dd3d33e8ef83ea0ba56 Mon Sep 17 00:00:00 2001 From: Ralph Ronnquist Date: Mon, 1 Nov 2021 17:04:03 +1100 Subject: [PATCH] trial of avoiding 1470 packets --- debian/changelog | 5 +++++ rrqnet-ifupdown.sh | 22 ++++++++++++++++++---- rrqnet.c | 16 +++++++++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index a3c8609..51a07fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +rrqnet (1.5.2) unstable; urgency=medium + + * tpg_patch: avoid UDP payload of 1470 bytes. + + -- Ralph Ronnquist Mon, 01 Nov 2021 01:01:34 +1100 rrqnet (1.5.1) unstable; urgency=medium * Bug fix: flip-over limits are microseconds. diff --git a/rrqnet-ifupdown.sh b/rrqnet-ifupdown.sh index 4c6ce4d..157007a 100755 --- a/rrqnet-ifupdown.sh +++ b/rrqnet-ifupdown.sh @@ -68,6 +68,19 @@ stop_dhclient() { ############################################################ ## The action functions +QUIRK= +LOGFLAG= +LOGFILE= +#function +process_logoption() { + if [ -n "${1##-v*}" ] ; then + QUIRK="$1" + shift + fi + LOGFLAG="$1" + LOGFILE="$2" +} + #function start_cable_pre_up() { local TAP @@ -81,13 +94,14 @@ start_cable_pre_up() { fi [ -z "$IF_RRQNET_NICE" ] || \ RRQDAEMON="/usr/bin/nice -n $IF_RRQNET_NICE $RRQDAEMON" - if [ -z "$IF_RRQNET_LOG" ] ; then + process_logoption ${IF_RRQNET_LOG} + if [ -z "$LOGFILE" ] ; then daemon -U -r -a 10 -n $NAME -- \ - $RRQDAEMON $IF_RRQNET_OPTIONS \ + $RRQDAEMON $QUIRK $IF_RRQNET_OPTIONS \ $TAP $IF_RRQNET_PORT $IF_RRQNET_REMOTE else - daemon -U -r -a 10 -n $NAME -E "${IF_RRQNET_LOG#* }" -- \ - $RRQDAEMON ${IF_RRQNET_LOG%% *} $IF_RRQNET_OPTIONS \ + daemon -U -r -a 10 -n $NAME -E "$LOGFILE" -- \ + $RRQDAEMON $QUIRK $LOGFLAG $IF_RRQNET_OPTIONS \ $TAP $IF_RRQNET_PORT $IF_RRQNET_REMOTE fi } diff --git a/rrqnet.c b/rrqnet.c index 6b57d08..27769c8 100644 --- a/rrqnet.c +++ b/rrqnet.c @@ -188,6 +188,10 @@ static struct { // Flag to signal the UDP socket as being ipv6 or not (forced ipv4) static int udp6 = 1; +// Flag to indicate tpg transport patch = avoid UDP payload of 1470 +// bytes by adding 2 tag-along bytes +static int tpg_quirk = 0; + // Flag whether to make some stderr outputs or not. // 1 = normal verbosity, 2 = more output, 3 = source debug level stuff static int verbose; @@ -877,11 +881,16 @@ static void write_remote(unsigned char *buf, int n,struct Remote *r) { if ( n < 12 ) { VERBOSE2OUT( "SEND %d bytes to %s\n", n, inet_stoa( &r->uaddr ) ); } else { - VERBOSE2OUT( "SEND %s -> %s to %s\n", + VERBOSE2OUT( "SEND %d bytes %s -> %s to %s\n", n, inet_mtoa( buf+6 ), inet_mtoa( buf ), inet_stoa( &r->uaddr ) ); } memcpy( output, buf, n ); // Use the private buffer for delivery + // Apply the TPG quirk + if ( tpg_quirk && ( n == 1470 ) ) { + VERBOSE2OUT( "tpg quirk applied\n" ); + n += 8; // Add 8 "random" tag-along bytes + } if ( r->spec == 0 ) { if ( r->uaddr.in.sa_family == 0 ) { // Output to tap/stdio @@ -1402,6 +1411,11 @@ int main(int argc, char *argv[]) { ///// Parse command line arguments i = 1; #define ENSUREARGS(n) if ( argc < i + n ) usage() + ENSUREARGS( 1 ); + if ( strncmp( "-tpg", argv[i], 4 ) == 0 ) { + tpg_quirk = 1; + i++; + } ENSUREARGS( 1 ); // First: optional -v, -vv or -vvv if ( strncmp( "-v", argv[i], 2 ) == 0 ) { -- 2.39.2