From 16c419350b9184142166a559b845ca468e4e6b0c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sat, 30 Jul 2016 10:41:39 -0400 Subject: [PATCH] rsrv: ignore echo and unexpected UDP Ignore UDP echo. By default, don't log unexpected/invalid UDP messages. --- src/ioc/rsrv/camessage.c | 27 ++++----------------------- src/ioc/rsrv/cast_server.c | 2 +- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/ioc/rsrv/camessage.c b/src/ioc/rsrv/camessage.c index b5c265ca6..98331abba 100644 --- a/src/ioc/rsrv/camessage.c +++ b/src/ioc/rsrv/camessage.c @@ -324,31 +324,12 @@ unsigned lineno static int bad_udp_cmd_action ( caHdrLargeArray *mp, void *pPayload, struct client *pClient ) { - log_header ("invalid (damaged?) request code from UDP", - pClient, mp, pPayload, 0); + if (CASDEBUG > 0) + log_header ("invalid (damaged?) request code from UDP", + pClient, mp, pPayload, 0); return RSRV_ERROR; } -/* - * udp_echo_action() - */ -static int udp_echo_action ( caHdrLargeArray *mp, - void *pPayload, struct client *pClient ) -{ - char *pPayloadOut; - int status; - SEND_LOCK ( pClient ); - status = cas_copy_in_header ( pClient, mp->m_cmmd, mp->m_postsize, - mp->m_dataType, mp->m_count, mp->m_cid, mp->m_available, - ( void * ) &pPayloadOut ); - if ( status == ECA_NORMAL ) { - memcpy ( pPayloadOut, pPayload, mp->m_postsize ); - cas_commit_msg ( pClient, mp->m_postsize ); - } - SEND_UNLOCK ( pClient ); - return RSRV_OK; -} - /* * bad_tcp_cmd_action() */ @@ -2488,7 +2469,7 @@ static const pProtoStubUDP udpJumpTable[] = bad_udp_cmd_action, bad_udp_cmd_action, bad_udp_cmd_action, - udp_echo_action, + bad_udp_cmd_action, bad_udp_cmd_action, bad_udp_cmd_action, bad_udp_cmd_action, diff --git a/src/ioc/rsrv/cast_server.c b/src/ioc/rsrv/cast_server.c index b6bed8484..d87428b49 100644 --- a/src/ioc/rsrv/cast_server.c +++ b/src/ioc/rsrv/cast_server.c @@ -247,7 +247,7 @@ void cast_server(void *pParm) epicsPrintf ("CAS: message received at %s\n", buf); } } - else { + else if (CASDEBUG>0){ char buf[40]; ipAddrToDottedIP (&client->addr, buf, sizeof(buf));