File 1232-epmd-add-EPMD_-prefix-to-request-response-constants-.patch of Package erlang
From 128aa2226af807ca11efdfff4ead3e026ae6f7f6 Mon Sep 17 00:00:00 2001
From: Fernando Areias <nando.calheirosx@gmail.com>
Date: Tue, 5 Aug 2025 19:48:00 -0300
Subject: [PATCH 2/2] epmd: add EPMD_ prefix to request/response constants for
consistency
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- ALIVE2_REQ → EPMD_ALIVE2_REQ
- ALIVE2_RESP → EPMD_ALIVE2_RESP
- ALIVE2_X_RESP → EPMD_ALIVE2_X_RESP
- PORT2_RESP → EPMD_PORT2_RESP
- NAMES_REQ → EPMD_NAMES_REQ
- DUMP_REQ → EPMD_DUMP_REQ
- KILL_REQ → EPMD_KILL_REQ
- STOP_REQ → EPMD_STOP_REQ
---
erts/doc/guides/erl_dist_protocol.md | 74 +++++++++++------------
erts/epmd/src/epmd_int.h | 4 +-
erts/epmd/src/epmd_srv.c | 38 ++++++------
lib/erl_interface/src/epmd/epmd_publish.c | 4 +-
4 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/erts/doc/guides/erl_dist_protocol.md b/erts/doc/guides/erl_dist_protocol.md
index 30004f6e5f..105c4e9eb9 100644
--- a/erts/doc/guides/erl_dist_protocol.md
+++ b/erts/doc/guides/erl_dist_protocol.md
@@ -65,7 +65,7 @@ The EPMD Protocol supports various tasks:
- Getting all Registered Names
- Dumping all Data from EPMD
- Killing EPMD
-- `STOP_REQ` (Not Used)
+- `EPMD_STOP_REQ` (Not Used)
The requests served by the EPMD for these tasks are summarized in the following figure.
@@ -79,11 +79,11 @@ sequenceDiagram
participant EPMD
Note over EPMD: Register a Node in EPMD
- client ->> EPMD: ALIVE2_REQ
+ client ->> EPMD: EPMD_ALIVE2_REQ
alt
- EPMD -->> client: ALIVE2_X_RESP
+ EPMD -->> client: EPMD_ALIVE2_X_RESP
else
- EPMD -->> client: ALIVE2_RESP
+ EPMD -->> client: EPMD_ALIVE2_RESP
end
Note over EPMD: Unregister a Node in EPMD
@@ -91,22 +91,22 @@ sequenceDiagram
Note over client: Get the Distribution Port of Another Node
client ->> EPMD: EPMD_PORT2_REQ
- EPMD -->> client: PORT2_RESP
+ EPMD -->> client: EPMD_PORT2_RESP
Note over client: Get All Registered Names from EPMD
- client ->> EPMD: NAMES_REQ
+ client ->> EPMD: EPMD_NAMES_REQ
EPMD -->> client: NAMES_RESP
Note over EPMD: Dump all Data from EPMD
- client ->> EPMD: DUMP_REQ
+ client ->> EPMD: EPMD_DUMP_REQ
EPMD -->> client: DUMP_RESP
Note over EPMD: Kill EPMD
- client ->> EPMD: KILL_REQ
+ client ->> EPMD: EPMD_KILL_REQ
EPMD -->> client: KILL_RESP
- Note over EPMD: STOP_REQ (Not Used)
- client ->> EPMD: STOP_REQ
+ Note over EPMD: EPMD_STOP_REQ (Not Used)
+ client ->> EPMD: EPMD_STOP_REQ
EPMD -->> client: STOP_OK_RESP
EPMD -->> client: STOP_NOTOK_RESP
```
@@ -123,8 +123,8 @@ _Table: Request Format_
### Register a Node in EPMD
When a distributed node is started it registers itself in the EPMD. The message
-`ALIVE2_REQ` described below is sent from the node to the EPMD. The response
-from the EPMD is `ALIVE2_X_RESP` (or `ALIVE2_RESP`):
+`EPMD_ALIVE2_REQ` described below is sent from the node to the EPMD. The response
+from the EPMD is `EPMD_ALIVE2_X_RESP` (or `EPMD_ALIVE2_RESP`):
```mermaid
---
@@ -134,11 +134,11 @@ sequenceDiagram
participant client as Client (or Node)
participant EPMD
- client ->> EPMD: ALIVE2_REQ
+ client ->> EPMD: EPMD_ALIVE2_REQ
alt
- EPMD -->> client: ALIVE2_X_RESP
+ EPMD -->> client: EPMD_ALIVE2_X_RESP
else
- EPMD -->> client: ALIVE2_RESP
+ EPMD -->> client: EPMD_ALIVE2_RESP
end
```
@@ -146,7 +146,7 @@ sequenceDiagram
| ----- | -------- | ---------- | ---------- | ---------------- | --------------- | ------ | ---------- | ------ | ------- |
| `120` | `PortNo` | `NodeType` | `Protocol` | `HighestVersion` | `LowestVersion` | `Nlen` | `NodeName` | `Elen` | `Extra` |
-_Table: ALIVE2_REQ (120)_
+_Table: EPMD_ALIVE2_REQ (120)_
- **`PortNo`** - The port number on which the node accept connection requests.
@@ -174,21 +174,21 @@ The connection created to the EPMD must be kept as long as the node is a
distributed node. When the connection is closed, the node is automatically
unregistered from the EPMD.
-The response message is either `ALIVE2_X_RESP` or `ALIVE2_RESP` depending on
+The response message is either `EPMD_ALIVE2_X_RESP` or `EPMD_ALIVE2_RESP` depending on
distribution version. If both the node and EPMD support distribution version 6
-then the response is `ALIVE2_X_RESP` otherwise it is the older `ALIVE2_RESP`:
+then the response is `EPMD_ALIVE2_X_RESP` otherwise it is the older `EPMD_ALIVE2_RESP`:
| 1 | 1 | 4 |
| ----- | -------- | ---------- |
| `118` | `Result` | `Creation` |
-_Table: ALIVE2_X_RESP (118) with 32 bit creation_
+_Table: EPMD_ALIVE2_X_RESP (118) with 32 bit creation_
| 1 | 1 | 2 |
| ----- | -------- | ---------- |
| `121` | `Result` | `Creation` |
-_Table: ALIVE2_RESP (121) with 16-bit creation_
+_Table: EPMD_ALIVE2_RESP (121) with 16-bit creation_
Result = 0 -> ok, result > 0 -> error.
@@ -224,7 +224,7 @@ sequenceDiagram
participant EPMD
client ->> EPMD: EPMD_PORT2_REQ
- EPMD -->> client: PORT2_RESP
+ EPMD -->> client: EPMD_PORT2_RESP
```
@@ -240,7 +240,7 @@ where N = `Length` \- 1.
| ----- | -------- |
| `119` | `Result` |
-_Table: PORT2_RESP (119) Response Indicating Error, Result > 0_
+_Table: EPMD_PORT2_RESP (119) Response Indicating Error, Result > 0_
or
@@ -248,7 +248,7 @@ or
| ----- | -------- | -------- | ---------- | ---------- | ---------------- | --------------- | ------ | ---------- | ------ | -------- |
| `119` | `Result` | `PortNo` | `NodeType` | `Protocol` | `HighestVersion` | `LowestVersion` | `Nlen` | `NodeName` | `Elen` | >`Extra` |
-_Table: PORT2_RESP, Result = 0_
+_Table: EPMD_PORT2_RESP, Result = 0_
If `Result` > 0, the packet only consists of `[119, Result]`.
@@ -268,7 +268,7 @@ sequenceDiagram
participant client as Client (or Node)
participant EPMD
- client ->> EPMD: NAMES_REQ
+ client ->> EPMD: EPMD_NAMES_REQ
EPMD -->> client: NAMES_RESP
```
@@ -276,9 +276,9 @@ sequenceDiagram
| ----- |
| `110` |
-_Table: NAMES_REQ (110)_
+_Table: EPMD_NAMES_REQ (110)_
-The response for a `NAMES_REQ` is as follows:
+The response for a `EPMD_NAMES_REQ` is as follows:
| 4 | |
| ------------ | ----------- |
@@ -307,7 +307,7 @@ sequenceDiagram
participant client as Client (or Node)
participant EPMD
- client ->> EPMD: DUMP_REQ
+ client ->> EPMD: EPMD_DUMP_REQ
EPMD -->> client: DUMP_RESP
```
@@ -316,9 +316,9 @@ sequenceDiagram
| ----- |
| `100` |
-_Table: DUMP_REQ_
+_Table: EPMD_DUMP_REQ_
-The response for a `DUMP_REQ` is as follows:
+The response for a `EPMD_DUMP_REQ` is as follows:
| 4 | |
| ------------ | ----------- |
@@ -355,7 +355,7 @@ sequenceDiagram
participant client as Client (or Node)
participant EPMD
- client ->> EPMD: KILL_REQ
+ client ->> EPMD: EPMD_KILL_REQ
EPMD -->> client: KILL_RESP
```
@@ -363,9 +363,9 @@ sequenceDiagram
| ----- |
| `107` |
-_Table: KILL_REQ_
+_Table: EPMD_KILL_REQ_
-The response for a `KILL_REQ` is as follows:
+The response for a `EPMD_KILL_REQ` is as follows:
| 2 |
| ---------- |
@@ -375,17 +375,17 @@ _Table: KILL_RESP_
where `OKString` is "OK".
-### STOP_REQ (Not Used)
+### EPMD_STOP_REQ (Not Used)
```mermaid
---
-title: STOP_REQ (Not Used)
+title: EPMD_STOP_REQ (Not Used)
---
sequenceDiagram
participant client as Client (or Node)
participant EPMD
- client ->> EPMD: STOP_REQ
+ client ->> EPMD: EPMD_STOP_REQ
EPMD -->> client: STOP_OK_RESP
EPMD -->> client: STOP_NOTOK_RESP
```
@@ -394,11 +394,11 @@ sequenceDiagram
| ----- | ---------- |
| `115` | `NodeName` |
-_Table: STOP_REQ_
+_Table: EPMD_STOP_REQ_
where n = `Length` \- 1.
-The response for a `STOP_REQ` is as follows:
+The response for a `EPMD_STOP_REQ` is as follows:
| 7 |
| ---------- |
diff --git a/erts/epmd/src/epmd_int.h b/erts/epmd/src/epmd_int.h
index e83b5b8297..85976ea245 100644
--- a/erts/epmd/src/epmd_int.h
+++ b/erts/epmd/src/epmd_int.h
@@ -264,9 +264,9 @@ static const struct in6_addr in6addr_loopback =
#define MAX_LISTEN_SOCKETS 16
/*
- * Largest request: ALIVE2_REQ
+ * Largest request: EPMD_ALIVE2_REQ
* 2 + 13 + 2*MAXSYMLEN
- * Largest response: PORT2_RESP
+ * Largest response: EPMD_PORT2_RESP
* 2 + 14 + 2*MAXSYMLEN
*
* That is, 3*MAXSYMLEN should be large enough
diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c
index 89d32864df..59c3a75bcb 100644
--- a/erts/epmd/src/epmd_srv.c
+++ b/erts/epmd/src/epmd_srv.c
@@ -832,12 +832,12 @@ static void do_request(EpmdVars *g, int fd, Connection *s, char *buf, int bsize)
if (!reply(g, fd, wbuf, replylen))
{
node_unreg(g, name);
- dbg_tty_printf(g,1,"** failed to send ALIVE2_RESP for \"%s\"",
+ dbg_tty_printf(g,1,"** failed to send EPMD_ALIVE2_RESP for \"%s\"",
name);
return;
}
- dbg_tty_printf(g,1,"** sent ALIVE2_RESP for \"%s\"",name);
+ dbg_tty_printf(g,1,"** sent EPMD_ALIVE2_RESP for \"%s\"",name);
s->keep = EPMD_TRUE; /* Don't close on inactivity */
}
break;
@@ -891,26 +891,26 @@ static void do_request(EpmdVars *g, int fd, Connection *s, char *buf, int bsize)
offset += node->extralen;
if (!reply(g, fd, wbuf, offset))
{
- dbg_tty_printf(g,1,"** failed to send PORT2_RESP (ok) for \"%s\"",name);
+ dbg_tty_printf(g,1,"** failed to send EPMD_PORT2_RESP (ok) for \"%s\"",name);
return;
}
- dbg_tty_printf(g,1,"** sent PORT2_RESP (ok) for \"%s\"",name);
+ dbg_tty_printf(g,1,"** sent EPMD_PORT2_RESP (ok) for \"%s\"",name);
return;
}
}
wbuf[1] = 1; /* error */
if (!reply(g, fd, wbuf, 2))
{
- dbg_tty_printf(g,1,"** failed to send PORT2_RESP (error) for \"%s\"",name);
+ dbg_tty_printf(g,1,"** failed to send EPMD_PORT2_RESP (error) for \"%s\"",name);
return;
}
- dbg_tty_printf(g,1,"** sent PORT2_RESP (error) for \"%s\"",name);
+ dbg_tty_printf(g,1,"** sent EPMD_PORT2_RESP (error) for \"%s\"",name);
return;
}
break;
case EPMD_NAMES_REQ:
- dbg_printf(g,1,"** got NAMES_REQ");
+ dbg_printf(g,1,"** got EPMD_NAMES_REQ");
{
Node *node;
@@ -950,9 +950,9 @@ static void do_request(EpmdVars *g, int fd, Connection *s, char *buf, int bsize)
break;
case EPMD_DUMP_REQ:
- dbg_printf(g,1,"** got DUMP_REQ");
+ dbg_printf(g,1,"** got EPMD_DUMP_REQ");
if (!s->local_peer) {
- dbg_printf(g,0,"DUMP_REQ from non local address");
+ dbg_printf(g,0,"EPMD_DUMP_REQ from non local address");
return;
}
{
@@ -1017,39 +1017,39 @@ static void do_request(EpmdVars *g, int fd, Connection *s, char *buf, int bsize)
case EPMD_KILL_REQ:
if (!s->local_peer) {
- dbg_printf(g,0,"KILL_REQ from non local address");
+ dbg_printf(g,0,"EPMD_KILL_REQ from non local address");
return;
}
- dbg_printf(g,1,"** got KILL_REQ");
+ dbg_printf(g,1,"** got EPMD_KILL_REQ");
if (!g->brutal_kill && (g->nodes.reg != NULL)) {
- dbg_printf(g,0,"Disallowed KILL_REQ, live nodes");
+ dbg_printf(g,0,"Disallowed EPMD_KILL_REQ, live nodes");
if (!reply(g, fd,"NO",2))
- dbg_printf(g,0,"failed to send reply to KILL_REQ");
+ dbg_printf(g,0,"failed to send reply to EPMD_KILL_REQ");
return;
}
if (!reply(g, fd,"OK",2))
- dbg_printf(g,0,"failed to send reply to KILL_REQ");
+ dbg_printf(g,0,"failed to send reply to EPMD_KILL_REQ");
dbg_tty_printf(g,1,"epmd killed");
conn_close_fd(g,fd); /* We never return to caller so close here */
- dbg_printf(g,0,"got KILL_REQ - terminates normal");
+ dbg_printf(g,0,"got EPMD_KILL_REQ - terminates normal");
epmd_cleanup_exit(g,0); /* Normal exit */
case EPMD_STOP_REQ:
- dbg_printf(g,1,"** got STOP_REQ");
+ dbg_printf(g,1,"** got EPMD_STOP_REQ");
if (!s->local_peer) {
- dbg_printf(g,0,"STOP_REQ from non local address");
+ dbg_printf(g,0,"EPMD_STOP_REQ from non local address");
return;
}
if (!g->brutal_kill) {
- dbg_printf(g,0,"Disallowed STOP_REQ, no relaxed_command_check");
+ dbg_printf(g,0,"Disallowed EPMD_STOP_REQ, no relaxed_command_check");
return;
}
if (bsize <= 1 )
{
- dbg_printf(g,0,"packet too small for request STOP_REQ (%d)",bsize);
+ dbg_printf(g,0,"packet too small for request EPMD_STOP_REQ (%d)",bsize);
return;
}
diff --git a/lib/erl_interface/src/epmd/epmd_publish.c b/lib/erl_interface/src/epmd/epmd_publish.c
index 5b06f52f16..7d22140061 100644
--- a/lib/erl_interface/src/epmd/epmd_publish.c
+++ b/lib/erl_interface/src/epmd/epmd_publish.c
@@ -99,7 +99,7 @@ static int ei_epmd_r4_publish (int port, const char *alive, unsigned ms)
}
EI_TRACE_CONN6("ei_epmd_r4_publish",
- "-> ALIVE2_REQ alive=%s port=%d ntype=%d "
+ "-> EPMD_ALIVE2_REQ alive=%s port=%d ntype=%d "
"proto=%d dist-high=%d dist-low=%d",
alive,port,'H',EI_MYPROTO,EI_DIST_HIGH,EI_DIST_LOW);
@@ -127,7 +127,7 @@ static int ei_epmd_r4_publish (int port, const char *alive, unsigned ms)
return -1;
}
- EI_TRACE_CONN0("ei_epmd_r4_publish","<- ALIVE2_RESP");
+ EI_TRACE_CONN0("ei_epmd_r4_publish","<- EPMD_ALIVE2_RESP");
if (((res=get8(s)) != 0)) { /* 0 == success */
EI_TRACE_ERR1("ei_epmd_r4_publish"," result=%d (fail)",res);
--
2.43.0