tcp: use dctcp if enabled on the route to the initiator
[firefly-linux-kernel-4.4.55.git] / net / ipv4 / fib_semantics.c
index 115a08e70d43243215feb8a8f7759493cfa969dd..992a9597daf80d7d734d8e0245c8410dc334511b 100644 (file)
@@ -879,6 +879,7 @@ static bool fib_valid_prefsrc(struct fib_config *cfg, __be32 fib_prefsrc)
 static int
 fib_convert_metrics(struct fib_info *fi, const struct fib_config *cfg)
 {
+       bool ecn_ca = false;
        struct nlattr *nla;
        int remaining;
 
@@ -898,7 +899,7 @@ fib_convert_metrics(struct fib_info *fi, const struct fib_config *cfg)
                        char tmp[TCP_CA_NAME_MAX];
 
                        nla_strlcpy(tmp, nla, sizeof(tmp));
-                       val = tcp_ca_get_key_by_name(tmp);
+                       val = tcp_ca_get_key_by_name(tmp, &ecn_ca);
                        if (val == TCP_CA_UNSPEC)
                                return -EINVAL;
                } else {
@@ -913,6 +914,9 @@ fib_convert_metrics(struct fib_info *fi, const struct fib_config *cfg)
                fi->fib_metrics[type - 1] = val;
        }
 
+       if (ecn_ca)
+               fi->fib_metrics[RTAX_FEATURES - 1] |= DST_FEATURE_ECN_CA;
+
        return 0;
 }