sr: add "set sr encaps hop-limit" command
Default hop-limit for the encapsulating IPv6 header is a compile-time
constant. Add ability to specify custom hop-limit, in order to avoid
packets being dropped with "hop limit exceeded in transit" response in
certain network configurations.
Type: feature
Signed-off-by: Ignas Bačius <ignas@noia.network>
Change-Id: I77f2b35c987cfd31801dc2744d31fb3c1984158f
diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c
index 32eff2e..f3738da 100644
--- a/src/vnet/srv6/sr_api.c
+++ b/src/vnet/srv6/sr_api.c
@@ -50,6 +50,7 @@
_(SR_POLICY_DEL, sr_policy_del) \
_(SR_STEERING_ADD_DEL, sr_steering_add_del) \
_(SR_SET_ENCAP_SOURCE, sr_set_encap_source) \
+_(SR_SET_ENCAP_HOP_LIMIT, sr_set_encap_hop_limit) \
_(SR_LOCALSIDS_DUMP, sr_localsids_dump) \
_(SR_POLICIES_DUMP, sr_policies_dump) \
_(SR_STEERING_POL_DUMP, sr_steering_pol_dump)
@@ -178,6 +179,20 @@
REPLY_MACRO (VL_API_SR_SET_ENCAP_SOURCE_REPLY);
}
+static void
+vl_api_sr_set_encap_hop_limit_t_handler (vl_api_sr_set_encap_hop_limit_t * mp)
+{
+ vl_api_sr_set_encap_hop_limit_reply_t *rmp;
+ int rv = 0;
+
+ if (mp->hop_limit == 0)
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ else
+ sr_set_hop_limit (mp->hop_limit);
+
+ REPLY_MACRO (VL_API_SR_SET_ENCAP_HOP_LIMIT_REPLY);
+}
+
static void vl_api_sr_steering_add_del_t_handler
(vl_api_sr_steering_add_del_t * mp)
{