diff options
author | Ignas Bačius <ignas@noia.network> | 2019-10-03 17:15:38 +0300 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-10-23 07:52:22 +0000 |
commit | eeb5fb3a50079e1af6e655694c6ff99ec2f9d070 (patch) | |
tree | da14b1e36c66e6977e175cbe040892df57f828cf /src/vnet/srv6/sr_api.c | |
parent | bd0a00a45637c1dde533ef6c3798418c2ab15009 (diff) |
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
Diffstat (limited to 'src/vnet/srv6/sr_api.c')
-rw-r--r-- | src/vnet/srv6/sr_api.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vnet/srv6/sr_api.c b/src/vnet/srv6/sr_api.c index 32eff2ef5e5..f3738da668d 100644 --- a/src/vnet/srv6/sr_api.c +++ b/src/vnet/srv6/sr_api.c @@ -50,6 +50,7 @@ _(SR_POLICY_MOD, sr_policy_mod) \ _(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 @@ vl_api_sr_set_encap_source_t_handler (vl_api_sr_set_encap_source_t * mp) 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) { |