diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2021-06-29 19:51:06 +0200 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2021-06-30 09:19:52 +0200 |
commit | 55e182b5b323c049ea49c79c2d68c8547940c62b (patch) | |
tree | bb18ae20229d072b0c74d5a404c088846306e0af /src | |
parent | beb54470b9641c50cc5d2f1e70b572f72428d8c9 (diff) | |
download | ouroboros-55e182b5b323c049ea49c79c2d68c8547940c62b.tar.gz ouroboros-55e182b5b323c049ea49c79c2d68c8547940c62b.zip |
ipcpd: Fix layer info RIB
Layer info was not converted to parse the full path with the latest RIB
change.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcpd/ipcp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index 65a28d61..59fbdba6 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -103,10 +103,15 @@ static int ipcp_rib_read(const char * path, char * buf, size_t len) { + char * entry; + if (len < LAYER_NAME_SIZE + 2) /* trailing \n */ return 0; - if (strcmp(path, info[0]) == 0) { /* _state */ + entry = strstr(path, RIB_SEPARATOR) + 1; + assert(entry); + + if (strcmp(entry, info[0]) == 0) { /* _state */ enum ipcp_state state = ipcp_get_state(); if (state == IPCP_NULL) strcpy(buf, "null\n"); @@ -120,7 +125,7 @@ static int ipcp_rib_read(const char * path, strcpy(buf, "bug\n"); } - if (strcmp(path, info[1]) == 0) { /* _type */ + if (strcmp(entry, info[1]) == 0) { /* _type */ if (ipcpi.type == IPCP_LOCAL) strcpy(buf, "local\n"); else if (ipcpi.type == IPCP_UNICAST) @@ -137,7 +142,7 @@ static int ipcp_rib_read(const char * path, strcpy(buf, "bug\n"); } - if (strcmp(path, info[2]) == 0) { /* _layer */ + if (strcmp(entry, info[2]) == 0) { /* _layer */ memset(buf, 0, LAYER_NAME_SIZE + 1); if (ipcp_get_state() < IPCP_OPERATIONAL) strcpy(buf, "(null)"); |