diff options
author | Hongjun Ni <hongjun.ni@intel.com> | 2017-01-25 21:58:10 +0800 |
---|---|---|
committer | Hongjun Ni <hongjun.ni@intel.com> | 2017-01-25 21:58:10 +0800 |
commit | 6363b43a2b3d569bb683fdee95b63c681e24cec9 (patch) | |
tree | 14e08409ec4b342cbb5b1fa6c70ef916b75eccea /nsh-plugin | |
parent | 8ce5ee6eaf800ae88c0b47311197f0cff89dec63 (diff) |
Need to change from host order to net order when encaping nsh header NSHSFC-22v17.01stable/1701
Change-Id: I689c55d0689c4cbc1493432d2e0761a277fe8ec3
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
Diffstat (limited to 'nsh-plugin')
-rw-r--r-- | nsh-plugin/java/jvpp/pom.xml | 2 | ||||
-rw-r--r-- | nsh-plugin/java/pom.xml | 2 | ||||
-rw-r--r-- | nsh-plugin/nsh/nsh.c | 26 |
3 files changed, 22 insertions, 8 deletions
diff --git a/nsh-plugin/java/jvpp/pom.xml b/nsh-plugin/java/jvpp/pom.xml index 823f22b..e49ab74 100644 --- a/nsh-plugin/java/jvpp/pom.xml +++ b/nsh-plugin/java/jvpp/pom.xml @@ -4,7 +4,7 @@ <groupId>io.fd.nsh_sfc</groupId> <artifactId>nsh-sfc</artifactId> - <version>17.01</version> + <version>17.01-SNAPSHOT</version> <packaging>jar</packaging> <name>nsh-sfc</name> diff --git a/nsh-plugin/java/pom.xml b/nsh-plugin/java/pom.xml index 4e06cae..efcdc06 100644 --- a/nsh-plugin/java/pom.xml +++ b/nsh-plugin/java/pom.xml @@ -4,7 +4,7 @@ <groupId>io.fd.nsh_sfc</groupId> <artifactId>nsh-sfc</artifactId> - <version>17.01</version> + <version>17.01-SNAPSHOT</version> <packaging>jar</packaging> <name>nsh-sfc</name> diff --git a/nsh-plugin/nsh/nsh.c b/nsh-plugin/nsh/nsh.c index c5b9453..b3a3007 100644 --- a/nsh-plugin/nsh/nsh.c +++ b/nsh-plugin/nsh/nsh.c @@ -935,6 +935,20 @@ nsh_plugin_api_hookup (vlib_main_t *vm) } +static void +nsh_header_host_to_net(nsh_header_t *hdr, nsh_header_t *encap_hdr) +{ + hdr->ver_o_c = encap_hdr->ver_o_c; + hdr->length = encap_hdr->length; + hdr->md_type = encap_hdr->md_type; + hdr->next_protocol = encap_hdr->next_protocol; + hdr->nsp_nsi = clib_host_to_net_u32(encap_hdr->nsp_nsi); + hdr->c1 = clib_host_to_net_u32(encap_hdr->c1); + hdr->c2 = clib_host_to_net_u32(encap_hdr->c2); + hdr->c3 = clib_host_to_net_u32(encap_hdr->c3); + hdr->c4 = clib_host_to_net_u32(encap_hdr->c4); + +} static uword @@ -1115,7 +1129,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b0, -(word)encap_hdr_len0); hdr0 = vlib_buffer_get_current(b0); - clib_memcpy(hdr0, encap_hdr0, (word)encap_hdr_len0); + nsh_header_host_to_net(hdr0, encap_hdr0); goto trace0; } @@ -1125,7 +1139,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b0, -(word)encap_hdr_len0); hdr0 = vlib_buffer_get_current(b0); - clib_memcpy(hdr0, encap_hdr0, (word)encap_hdr_len0); + nsh_header_host_to_net(hdr0, encap_hdr0); } trace0: b0->error = error0 ? node->errors[error0] : 0; @@ -1181,7 +1195,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b1, -(word)encap_hdr_len1); hdr1 = vlib_buffer_get_current(b1); - clib_memcpy(hdr1, encap_hdr1, (word)encap_hdr_len1); + nsh_header_host_to_net(hdr1, encap_hdr1); goto trace1; } @@ -1191,7 +1205,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b1, -(word)encap_hdr_len1); hdr1 = vlib_buffer_get_current(b1); - clib_memcpy(hdr1, encap_hdr1, (word)encap_hdr_len1); + nsh_header_host_to_net(hdr1, encap_hdr1); } trace1: b1->error = error1 ? node->errors[error1] : 0; @@ -1312,7 +1326,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b0, -(word)encap_hdr_len0); hdr0 = vlib_buffer_get_current(b0); - clib_memcpy(hdr0, encap_hdr0, (word)encap_hdr_len0); + nsh_header_host_to_net(hdr0, encap_hdr0); goto trace00; } @@ -1322,7 +1336,7 @@ nsh_input_map (vlib_main_t * vm, /* Push new NSH header */ vlib_buffer_advance(b0, -(word)encap_hdr_len0); hdr0 = vlib_buffer_get_current(b0); - clib_memcpy(hdr0, encap_hdr0, (word)encap_hdr_len0); + nsh_header_host_to_net(hdr0, encap_hdr0); } trace00: b0->error = error0 ? node->errors[error0] : 0; |