restore compatibility with EPICS 3.13 clients

This commit is contained in:
2022-05-19 09:07:31 +02:00
parent 77fb5cf425
commit d5756faef4

View File

@@ -280,6 +280,37 @@ static void log_header (
struct channel_in_use *pciu;
char hostName[256];
const char * cmd_str [] = {
"CA_PROTO_VERSION",
"CA_PROTO_EVENT_ADD",
"CA_PROTO_EVENT_CANCEL",
"CA_PROTO_READ",
"CA_PROTO_WRITE",
"CA_PROTO_SNAPSHOT",
"CA_PROTO_SEARCH",
"CA_PROTO_BUILD",
"CA_PROTO_EVENTS_OFF",
"CA_PROTO_EVENTS_ON",
"CA_PROTO_READ_SYNC",
"CA_PROTO_ERROR",
"CA_PROTO_CLEAR_CHANNEL",
"CA_PROTO_RSRV_IS_UP",
"CA_PROTO_NOT_FOUND",
"CA_PROTO_READ_NOTIFY",
"CA_PROTO_READ_BUILD",
"REPEATER_CONFIRM",
"CA_PROTO_CREATE_CHAN",
"CA_PROTO_WRITE_NOTIFY",
"CA_PROTO_CLIENT_NAME",
"CA_PROTO_HOST_NAME",
"CA_PROTO_ACCESS_RIGHTS",
"CA_PROTO_ECHO",
"REPEATER_REGISTER",
"CA_PROTO_SIGNAL",
"CA_PROTO_CREATE_CH_FAIL",
"CA_PROTO_SERVER_DISCONN"
};
ipAddrToDottedIP (&client->addr, hostName, sizeof(hostName));
pciu = MPTOPCIU(mp);
@@ -289,8 +320,10 @@ static void log_header (
hostName, pContext);
}
epicsPrintf ( "CAS: Request from %s => cmmd=%d cid=0x%x type=%d count=%d postsize=%u\n",
hostName, mp->m_cmmd, mp->m_cid, mp->m_dataType, mp->m_count, mp->m_postsize);
epicsPrintf ( "CAS: %s Request from %s => cmmd=%d (%s) cid=0x%x type=%d count=%d postsize=%u version=%u\n",
client->proto==IPPROTO_TCP ? "TCP" : "UDP",
hostName, mp->m_cmmd, mp->m_cmmd <= CA_PROTO_LAST_CMMD ? cmd_str[mp->m_cmmd] : "invalid",
mp->m_cid, mp->m_dataType, mp->m_count, mp->m_postsize, client->minor_version_number);
epicsPrintf ( "CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n",
hostName, mp->m_available, mnum, (pciu ? (void *)&pciu->dbch : NULL));
@@ -319,6 +352,18 @@ unsigned lineno
SEND_UNLOCK ( client );
}
/*
* bad_udp_cmd_beacon()
*/
static int bad_udp_cmd_beacon ( caHdrLargeArray *mp,
void *pPayload, struct client *pClient )
{
if (CASDEBUG > 0)
log_header ("got a beacon on the wrong UDP port",
pClient, mp, pPayload, 0);
return RSRV_ERROR;
}
/*
* bad_udp_cmd_action()
*/
@@ -363,6 +408,8 @@ static int tcp_version_action ( caHdrLargeArray *mp, void *pPayload,
client->minor_version_number = mp->m_count;
DLOG(3, ("TCP set version %u\n", client->minor_version_number));
if (!CA_VSUPPORTED(mp->m_count)) {
DLOG ( 2, ( "CAS: Ignore version from unsupported client %u\n", mp->m_count ) );
return RSRV_ERROR;
@@ -1213,6 +1260,7 @@ static int claim_ciu_action ( caHdrLargeArray *mp,
struct dbChannel *dbch;
char *pName = (char *) pPayload;
DLOG (3, ("claim_ciu_action: version = %u\n", mp->m_available));
/*
* The available field is used (abused)
* here to communicate the miner version number
@@ -2121,6 +2169,8 @@ static int udp_version_action ( caHdrLargeArray *mp, void *pPayload, struct clie
{
client->minor_version_number = mp->m_count;
DLOG (3, ("UDP set version %u\n", client->minor_version_number));
if (!CA_VSUPPORTED(mp->m_count)) {
DLOG ( 2, ( "CAS: Ignore version from unsupported client %u\n", mp->m_count ) );
return RSRV_ERROR;
@@ -2174,6 +2224,9 @@ static int search_reply_udp ( caHdrLargeArray *mp, void *pPayload, struct client
size_t spaceNeeded;
size_t reasonableMonitorSpace = 10;
DLOG (3, epicsPrintf("UDP search for \"%.*s\" by %s@%s client version %u, m_count = %u\n",
mp->m_postsize, pName, client->pUserName, client->pHostName, client->minor_version_number, mp->m_count));
if (!CA_VSUPPORTED(mp->m_count)) {
DLOG ( 2, ( "CAS: Ignore search from unsupported client %u\n", mp->m_count ) );
return RSRV_ERROR;
@@ -2261,6 +2314,9 @@ static int search_reply_tcp (
size_t spaceNeeded;
size_t reasonableMonitorSpace = 10;
DLOG (3, ("TCP search for \"%.*s\" by %s@%s client version %u, m_count = %u\n",
mp->m_postsize, pName, client->pUserName, client->pHostName, client->minor_version_number, mp->m_count));
if (!CA_VSUPPORTED(mp->m_count)) {
DLOG ( 2, ( "CAS: Ignore search from unsupported client %u\n", mp->m_count ) );
return RSRV_ERROR;
@@ -2368,7 +2424,7 @@ static const pProtoStubUDP udpJumpTable[] =
bad_udp_cmd_action,
bad_udp_cmd_action,
bad_udp_cmd_action,
bad_udp_cmd_action,
bad_udp_cmd_beacon,
bad_udp_cmd_action,
bad_udp_cmd_action,
bad_udp_cmd_action,
@@ -2449,6 +2505,7 @@ int camessage ( struct client *client )
pBody = ( void * ) ( mp + 1 );
}
#if 0
/* ignore deprecated clients, but let newer clients identify themselves. */
if (msg.m_cmmd!=CA_PROTO_VERSION && !CA_VSUPPORTED(client->minor_version_number)) {
if (client->proto==IPPROTO_TCP) {
@@ -2470,6 +2527,7 @@ int camessage ( struct client *client )
}
break;
}
#endif
/*
* disconnect clients that dont send 8 byte