summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2017-03-29 13:35:43 -0400
committerDave Barach <openvpp@barachs.net>2017-03-30 18:53:49 +0000
commit20e1f2acd5d05a0a238ab8b8a870273799423e83 (patch)
tree3b2bc3fe21e232afb79e80e7530744e7eb99938c
parentf15866146adcf3273da6f29f05d42193c7af4b07 (diff)
Fix pid field endian in ARP/ND/DHCP event related API messages
Make sure pid field in these API messages is stored in network order (it is also kept and used by VPP in network order). Change-Id: Id5d08e7a45b7e49d4b840a337458d99414d0b949 Signed-off-by: John Lo <loj@cisco.com>
-rw-r--r--src/vat/api_format.c18
-rw-r--r--src/vpp/api/api.c4
-rw-r--r--src/vpp/api/custom_dump.c6
3 files changed, 14 insertions, 14 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 3b57ac61717..fca2b37ae17 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -1295,9 +1295,9 @@ static void
vl_api_ip4_arp_event_t_handler (vl_api_ip4_arp_event_t * mp)
{
u32 sw_if_index = ntohl (mp->sw_if_index);
- errmsg ("arp %s event: address %U new mac %U sw_if_index %d",
+ errmsg ("arp %s event: pid %d address %U new mac %U sw_if_index %d\n",
mp->mac_ip ? "mac/ip binding" : "address resolution",
- format_ip4_address, &mp->address,
+ ntohl (mp->pid), format_ip4_address, &mp->address,
format_ethernet_address, mp->new_mac, sw_if_index);
}
@@ -1311,9 +1311,9 @@ static void
vl_api_ip6_nd_event_t_handler (vl_api_ip6_nd_event_t * mp)
{
u32 sw_if_index = ntohl (mp->sw_if_index);
- errmsg ("ip6 nd %s event: address %U new mac %U sw_if_index %d",
+ errmsg ("ip6 nd %s event: pid %d address %U new mac %U sw_if_index %d\n",
mp->mac_ip ? "mac/ip binding" : "address resolution",
- format_ip6_address, mp->address,
+ ntohl (mp->pid), format_ip6_address, mp->address,
format_ethernet_address, mp->new_mac, sw_if_index);
}
@@ -2025,7 +2025,7 @@ vl_api_dhcp_compl_event_t_handler (vl_api_dhcp_compl_event_t * mp)
{
errmsg ("DHCP compl event: pid %d %s hostname %s host_addr %U "
"router_addr %U host_mac %U",
- mp->pid, mp->is_ipv6 ? "ipv6" : "ipv4", mp->hostname,
+ ntohl (mp->pid), mp->is_ipv6 ? "ipv6" : "ipv4", mp->hostname,
format_ip4_address, &mp->host_address,
format_ip4_address, &mp->router_address,
format_ethernet_address, mp->host_mac);
@@ -8035,12 +8035,12 @@ api_dhcp_client_config (vat_main_t * vam)
/* Construct the API message */
M (DHCP_CLIENT_CONFIG, mp);
- mp->sw_if_index = ntohl (sw_if_index);
+ mp->sw_if_index = htonl (sw_if_index);
clib_memcpy (mp->hostname, hostname, vec_len (hostname));
vec_free (hostname);
mp->is_add = is_add;
mp->want_dhcp_event = disable_event ? 0 : 1;
- mp->pid = getpid ();
+ mp->pid = htonl (getpid ());
/* send it... */
S (mp);
@@ -11833,7 +11833,7 @@ api_want_ip4_arp_events (vat_main_t * vam)
M (WANT_IP4_ARP_EVENTS, mp);
mp->enable_disable = enable_disable;
- mp->pid = getpid ();
+ mp->pid = htonl (getpid ());
mp->address = address.as_u32;
S (mp);
@@ -11869,7 +11869,7 @@ api_want_ip6_nd_events (vat_main_t * vam)
M (WANT_IP6_ND_EVENTS, mp);
mp->enable_disable = enable_disable;
- mp->pid = getpid ();
+ mp->pid = htonl (getpid ());
clib_memcpy (mp->address, &address, sizeof (ip6_address_t));
S (mp);
diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c
index 7f6a125e478..f169d7fcfda 100644
--- a/src/vpp/api/api.c
+++ b/src/vpp/api/api.c
@@ -2268,7 +2268,7 @@ format_arp_event (u8 * s, va_list * args)
{
vl_api_ip4_arp_event_t *event = va_arg (*args, vl_api_ip4_arp_event_t *);
- s = format (s, "pid %d: ", event->pid);
+ s = format (s, "pid %d: ", ntohl (event->pid));
if (event->mac_ip)
s = format (s, "bd mac/ip4 binding events");
else
@@ -2281,7 +2281,7 @@ format_nd_event (u8 * s, va_list * args)
{
vl_api_ip6_nd_event_t *event = va_arg (*args, vl_api_ip6_nd_event_t *);
- s = format (s, "pid %d: ", event->pid);
+ s = format (s, "pid %d: ", ntohl (event->pid));
if (event->mac_ip)
s = format (s, "bd mac/ip6 binding events");
else
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index a76840a240c..1e841effae9 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -792,7 +792,7 @@ static void *vl_api_dhcp_client_config_t_print
s = format (s, "want_dhcp_event %d ", mp->want_dhcp_event);
- s = format (s, "pid %d ", mp->pid);
+ s = format (s, "pid %d ", ntohl (mp->pid));
if (mp->is_add == 0)
s = format (s, "del ");
@@ -1710,7 +1710,7 @@ static void *vl_api_want_ip4_arp_events_t_print
u8 *s;
s = format (0, "SCRIPT: want_ip4_arp_events ");
- s = format (s, "pid %d address %U ", mp->pid,
+ s = format (s, "pid %d address %U ", ntohl (mp->pid),
format_ip4_address, &mp->address);
if (mp->enable_disable == 0)
s = format (s, "del ");
@@ -1724,7 +1724,7 @@ static void *vl_api_want_ip6_nd_events_t_print
u8 *s;
s = format (0, "SCRIPT: want_ip6_nd_events ");
- s = format (s, "pid %d address %U ", mp->pid,
+ s = format (s, "pid %d address %U ", ntohl (mp->pid),
format_ip6_address, mp->address);
if (mp->enable_disable == 0)
s = format (s, "del ");