]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
Merge branch 'iproute2-master' into iproute2-next
authorDavid Ahern <dsahern@gmail.com>
Wed, 15 Aug 2018 21:32:10 +0000 (14:32 -0700)
committerDavid Ahern <dsahern@gmail.com>
Wed, 15 Aug 2018 21:32:10 +0000 (14:32 -0700)
Signed-off-by: David Ahern <dsahern@gmail.com>
man/man8/ip-route.8.in
misc/ssfilter.y
testsuite/Makefile
testsuite/lib/generic.sh
testsuite/tests/ss/ss1.dump [new file with mode: 0644]
testsuite/tests/ss/ssfilter.t [new file with mode: 0755]

index b21a8472414273f1f6b84bcdb378009645538794..a33ce1f0f40066415a9636acfcd6f921323ba1be 100644 (file)
@@ -483,43 +483,43 @@ seconds and ms, msec or msecs to specify milliseconds.
 
 
 .TP
-.BI rttvar " TIME " "(2.3.15+ only)"
+.BI rttvar " TIME " "(Linux 2.3.15+ only)"
 the initial RTT variance estimate. Values are specified as with
 .BI rtt
 above.
 
 .TP
-.BI rto_min " TIME " "(2.6.23+ only)"
+.BI rto_min " TIME " "(Linux 2.6.23+ only)"
 the minimum TCP Retransmission TimeOut to use when communicating with this
 destination. Values are specified as with
 .BI rtt
 above.
 
 .TP
-.BI ssthresh " NUMBER " "(2.3.15+ only)"
+.BI ssthresh " NUMBER " "(Linux 2.3.15+ only)"
 an estimate for the initial slow start threshold.
 
 .TP
-.BI cwnd " NUMBER " "(2.3.15+ only)"
+.BI cwnd " NUMBER " "(Linux 2.3.15+ only)"
 the clamp for congestion window. It is ignored if the
 .B lock
 flag is not used.
 
 .TP
-.BI initcwnd " NUMBER " "(2.5.70+ only)"
+.BI initcwnd " NUMBER " "(Linux 2.5.70+ only)"
 the initial congestion window size for connections to this destination.
 Actual window size is this value multiplied by the MSS
 (``Maximal Segment Size'') for same connection. The default is
 zero, meaning to use the values specified in RFC2414.
 
 .TP
-.BI initrwnd " NUMBER " "(2.6.33+ only)"
+.BI initrwnd " NUMBER " "(Linux 2.6.33+ only)"
 the initial receive window size for connections to this destination.
 Actual window size is this value multiplied by the MSS of the connection.
 The default value is zero, meaning to use Slow Start value.
 
 .TP
-.BI features " FEATURES " (3.18+ only)
+.BI features " FEATURES " (Linux 3.18+ only)
 Enable or disable per-route features. Only available feature at this
 time is
 .B ecn
@@ -531,17 +531,17 @@ also be used even if the
 sysctl is set to 0.
 
 .TP
-.BI quickack " BOOL " "(3.11+ only)"
+.BI quickack " BOOL " "(Linux 3.11+ only)"
 Enable or disable quick ack for connections to this destination.
 
 .TP
-.BI fastopen_no_cookie " BOOL " "(4.15+ only)"
+.BI fastopen_no_cookie " BOOL " "(Linux 4.15+ only)"
 Enable TCP Fastopen without a cookie for connections to this destination.
 
 .TP
-.BI congctl " NAME " "(3.20+ only)"
+.BI congctl " NAME " "(Linux 3.20+ only)"
 .TP
-.BI "congctl lock" " NAME " "(3.20+ only)"
+.BI "congctl lock" " NAME " "(Linux 3.20+ only)"
 Sets a specific TCP congestion control algorithm only for a given destination.
 If not specified, Linux keeps the current global default TCP congestion control
 algorithm, or the one set from the application. If the modifier
@@ -554,14 +554,14 @@ control algorithm for that destination, thus it will be enforced/guaranteed to
 use the proposed algorithm.
 
 .TP
-.BI advmss " NUMBER " "(2.3.15+ only)"
+.BI advmss " NUMBER " "(Linux 2.3.15+ only)"
 the MSS ('Maximal Segment Size') to advertise to these
 destinations when establishing TCP connections. If it is not given,
 Linux uses a default value calculated from the first hop device MTU.
 (If the path to these destination is asymmetric, this guess may be wrong.)
 
 .TP
-.BI reordering " NUMBER " "(2.3.15+ only)"
+.BI reordering " NUMBER " "(Linux 2.3.15+ only)"
 Maximal reordering on the path to this destination.
 If it is not given, Linux uses the value selected with
 .B sysctl
@@ -782,7 +782,7 @@ is a set of encapsulation attributes specific to the
 .IR SEG6_ACTION " [ "
 .IR SEG6_ACTION_PARAM " ] "
 - Operation to perform on matching packets.
-The following actions are currently supported (\fB4.14+ only\fR).
+The following actions are currently supported (\fBLinux 4.14+ only\fR).
 .in +2
 
 .B End
@@ -830,7 +830,7 @@ address is set as described in \fBip-sr\fR(8).
 .in -8
 
 .TP
-.BI expires " TIME " "(4.4+ only)"
+.BI expires " TIME " "(Linux 4.4+ only)"
 the route will be deleted after the expires time.
 .B Only
 support IPv6 at present.
index 88d4229a9b2414eb3cf32b2b3ab9732ee5c56f32..0413dddaa7584c5add220e899cbd544869dd3aa8 100644 (file)
@@ -42,24 +42,22 @@ static void yyerror(char *s)
 %nonassoc '!'
 
 %%
-applet: null exprlist
+applet: exprlist
         {
-                *yy_ret = $2;
-                $$ = $2;
+                *yy_ret = $1;
+                $$ = $1;
         }
         | null
         ;
+
 null:   /* NOTHING */ { $$ = NULL; }
         ;
+
 exprlist: expr
         | '!' expr
         {
                 $$ = alloc_node(SSF_NOT, $2);
         }
-        | '(' exprlist ')'
-        {
-                $$ = $2;
-        }
         | exprlist '|' expr
         {
                 $$ = alloc_node(SSF_OR, $1);
@@ -77,13 +75,21 @@ exprlist: expr
         }
         ;
 
-expr:  DCOND HOSTCOND
+eq:    '='
+       | /* nothing */
+       ;
+
+expr:  '(' exprlist ')'
+       {
+               $$ = $2;
+       }
+       | DCOND eq HOSTCOND
         {
-               $$ = alloc_node(SSF_DCOND, $2);
+               $$ = alloc_node(SSF_DCOND, $3);
         }
-        | SCOND HOSTCOND
+        | SCOND eq HOSTCOND
         {
-               $$ = alloc_node(SSF_SCOND, $2);
+               $$ = alloc_node(SSF_SCOND, $3);
         }
         | DPORT GEQ HOSTCOND
         {
@@ -101,7 +107,7 @@ expr:       DCOND HOSTCOND
         {
                 $$ = alloc_node(SSF_NOT, alloc_node(SSF_D_GE, $3));
         }
-        | DPORT '=' HOSTCOND
+        | DPORT eq HOSTCOND
         {
                $$ = alloc_node(SSF_DCOND, $3);
         }
@@ -126,7 +132,7 @@ expr:       DCOND HOSTCOND
         {
                 $$ = alloc_node(SSF_NOT, alloc_node(SSF_S_GE, $3));
         }
-        | SPORT '=' HOSTCOND
+        | SPORT eq HOSTCOND
         {
                $$ = alloc_node(SSF_SCOND, $3);
         }
@@ -134,7 +140,7 @@ expr:       DCOND HOSTCOND
         {
                $$ = alloc_node(SSF_NOT, alloc_node(SSF_SCOND, $3));
         }
-        | DEVNAME '=' DEVCOND
+        | DEVNAME eq DEVCOND
         {
                $$ = alloc_node(SSF_DEVCOND, $3);
         }
@@ -142,7 +148,7 @@ expr:       DCOND HOSTCOND
         {
                $$ = alloc_node(SSF_NOT, alloc_node(SSF_DEVCOND, $3));
         }
-        | FWMARK '=' MARKMASK
+        | FWMARK eq MARKMASK
         {
                 $$ = alloc_node(SSF_MARKMASK, $3);
         }
index 2a54e5c845e65da6cc61678ebe082301b60d8336..8fcbc557ff9a74c26603530ce5c088e7b4ebf0af 100644 (file)
@@ -65,7 +65,7 @@ endif
                TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX`; \
                TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \
                STD_ERR="$$TMP_ERR" STD_OUT="$$TMP_OUT" \
-               TC="$$i/tc/tc" IP="$$i/ip/ip" DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
+               TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
                ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
                if [ "$$?" = "127" ]; then \
                        echo "SKIPPED"; \
index 8cef20fa1b2801582ab9197668b5d8e8371f1688..f92260fc40cf32b5b3639dcf49445937285f64d5 100644 (file)
@@ -26,16 +26,17 @@ ts_skip()
     exit 127
 }
 
-ts_tc()
+__ts_cmd()
 {
+       CMD=$1; shift
        SCRIPT=$1; shift
        DESC=$1; shift
 
-       $TC $@ 2> $STD_ERR > $STD_OUT
+       $CMD $@ 2> $STD_ERR > $STD_OUT
 
        if [ -s $STD_ERR ]; then
                ts_err "${SCRIPT}: ${DESC} failed:"
-               ts_err "command: $TC $@"
+               ts_err "command: $CMD $@"
                ts_err "stderr output:"
                ts_err_cat $STD_ERR
                if [ -s $STD_OUT ]; then
@@ -50,29 +51,19 @@ ts_tc()
        fi
 }
 
-ts_ip()
+ts_tc()
 {
-       SCRIPT=$1; shift
-       DESC=$1; shift
+       __ts_cmd "$TC" "$@"
+}
 
-       $IP $@ 2> $STD_ERR > $STD_OUT
-        RET=$?
+ts_ip()
+{
+       __ts_cmd "$IP" "$@"
+}
 
-       if [ -s $STD_ERR ] || [ "$RET" != "0" ]; then
-               ts_err "${SCRIPT}: ${DESC} failed:"
-               ts_err "command: $IP $@"
-               ts_err "stderr output:"
-               ts_err_cat $STD_ERR
-               if [ -s $STD_OUT ]; then
-                       ts_err "stdout output:"
-                       ts_err_cat $STD_OUT
-               fi
-       elif [ -s $STD_OUT ]; then
-               echo "${SCRIPT}: ${DESC} succeeded with output:"
-               cat $STD_OUT
-       else
-               echo "${SCRIPT}: ${DESC} succeeded"
-       fi
+ts_ss()
+{
+       __ts_cmd "$SS" "$@"
 }
 
 ts_qdisc_available()
diff --git a/testsuite/tests/ss/ss1.dump b/testsuite/tests/ss/ss1.dump
new file mode 100644 (file)
index 0000000..9c27323
Binary files /dev/null and b/testsuite/tests/ss/ss1.dump differ
diff --git a/testsuite/tests/ss/ssfilter.t b/testsuite/tests/ss/ssfilter.t
new file mode 100755 (executable)
index 0000000..e74f176
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. lib/generic.sh
+
+# % ./misc/ss -Htna
+# LISTEN  0    128    0.0.0.0:22       0.0.0.0:*
+# ESTAB   0    0     10.0.0.1:22      10.0.0.1:36266
+# ESTAB   0    0     10.0.0.1:36266   10.0.0.1:22
+# ESTAB   0    0     10.0.0.1:22      10.0.0.2:50312
+export TCPDIAG_FILE="$(dirname $0)/ss1.dump"
+
+ts_log "[Testing ssfilter]"
+
+ts_ss "$0" "Match dport = 22" -Htna dport = 22
+test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+
+ts_ss "$0" "Match dport 22" -Htna dport 22
+test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+
+ts_ss "$0" "Match (dport)" -Htna '( dport = 22 )'
+test_on "ESTAB    0           0                 10.0.0.1:36266           10.0.0.1:22"
+
+ts_ss "$0" "Match src = 0.0.0.0" -Htna src = 0.0.0.0
+test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+
+ts_ss "$0" "Match src 0.0.0.0" -Htna src 0.0.0.0
+test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+
+ts_ss "$0" "Match src sport" -Htna src 0.0.0.0 sport = 22
+test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+
+ts_ss "$0" "Match src and sport" -Htna src 0.0.0.0 and sport = 22
+test_on "LISTEN     0           128                0.0.0.0:22             0.0.0.0:*"
+
+ts_ss "$0" "Match src and sport and dport" -Htna src 10.0.0.1 and sport = 22 and dport = 50312
+test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+
+ts_ss "$0" "Match src and sport and (dport)" -Htna 'src 10.0.0.1 and sport = 22 and ( dport = 50312 )'
+test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+
+ts_ss "$0" "Match src and (sport and dport)" -Htna 'src 10.0.0.1 and ( sport = 22 and dport = 50312 )'
+test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+
+ts_ss "$0" "Match (src and sport) and dport" -Htna '( src 10.0.0.1 and sport = 22 ) and dport = 50312'
+test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"
+
+ts_ss "$0" "Match (src or src) and dst" -Htna '( src 0.0.0.0 or src 10.0.0.1 ) and dst 10.0.0.2'
+test_on "ESTAB    0           0                 10.0.0.1:22           10.0.0.2:50312"