X-Git-Url: https://gerrit.fd.io/r/gitweb?p=vpp.git;a=blobdiff_plain;f=src%2Fvnet%2Fudp%2Fudp_api.c;h=566acbcf35c4b2e702f675dce1092e3cd77181ab;hp=d00d74e27d53d2bd3c2c962cfe1634be11ee8dff;hb=7dd63e5cc;hpb=9c0a3c423ee0b9326f600a00c1bd46fef45d4975 diff --git a/src/vnet/udp/udp_api.c b/src/vnet/udp/udp_api.c index d00d74e27d5..566acbcf35c 100644 --- a/src/vnet/udp/udp_api.c +++ b/src/vnet/udp/udp_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Cisco and/or its affiliates. + * Copyright (c) 2018-2019 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -51,7 +51,7 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg, vl_api_udp_encap_details_t *mp; mp = vl_msg_api_alloc (sizeof (*mp)); - memset (mp, 0, sizeof (*mp)); + clib_memset (mp, 0, sizeof (*mp)); mp->_vl_msg_id = ntohs (VL_API_UDP_ENCAP_DETAILS); mp->context = context; @@ -61,8 +61,8 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg, &ue->ue_hdrs.ip4.ue_ip4.src_address, 4); clib_memcpy (&mp->udp_encap.dst_ip.un.ip4, &ue->ue_hdrs.ip4.ue_ip4.dst_address, 4); - mp->udp_encap.dst_ip.af = clib_host_to_net_u32 (ADDRESS_IP4); - mp->udp_encap.src_ip.af = clib_host_to_net_u32 (ADDRESS_IP4); + mp->udp_encap.dst_ip.af = ip_address_family_encode (AF_IP4); + mp->udp_encap.src_ip.af = ip_address_family_encode (AF_IP4); /* ports aren't byte swapped because they are stored in network * byte order */ @@ -75,8 +75,8 @@ send_udp_encap_details (const udp_encap_t * ue, vl_api_registration_t * reg, &ue->ue_hdrs.ip6.ue_ip6.src_address, 16); clib_memcpy (&mp->udp_encap.dst_ip.un.ip6, &ue->ue_hdrs.ip6.ue_ip6.dst_address, 16); - mp->udp_encap.dst_ip.af = clib_host_to_net_u32 (ADDRESS_IP6); - mp->udp_encap.src_ip.af = clib_host_to_net_u32 (ADDRESS_IP6); + mp->udp_encap.dst_ip.af = ip_address_family_encode (AF_IP6); + mp->udp_encap.src_ip.af = ip_address_family_encode (AF_IP6); /* ports aren't byte swapped because they are stored in network * byte order */ @@ -121,6 +121,7 @@ vl_api_udp_encap_add_t_handler (vl_api_udp_encap_add_t * mp, vlib_main_t * vm) index_t uei; int rv = 0; + uei = INDEX_INVALID; table_id = ntohl (mp->udp_encap.table_id); itype = ip_address_decode (&mp->udp_encap.src_ip, &src_ip); @@ -176,7 +177,7 @@ setup_message_id_table (api_main_t * am) static clib_error_t * udp_api_hookup (vlib_main_t * vm) { - api_main_t *am = &api_main; + api_main_t *am = vlibapi_get_main (); #define _(N,n) \ vl_msg_api_set_handlers(VL_API_##N, #n, \