Skip to content

Commit

Permalink
mod_sonic: requestPortIfIndexDiscovery for any change to PORT_INDEX_T…
Browse files Browse the repository at this point in the history
…ABLE
  • Loading branch information
sflow committed Jun 10, 2024
1 parent 3e8b551 commit 5d32f79
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Linux/mod_sonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,7 +1890,19 @@ extern "C" {

static void dbEvt_indexOp(EVMod *mod, char *key, char *op) {
EVDebug(mod, 1, "dbEvt_indexOp: %s (%s)", key, op);
// TODO: re-read osIndex details?
// key will take the form "__keyspace@6__:PORT_INDEX_TABLE|Ethernet100"
// so we can extract the portName like this:
char buf[HSP_SONIC_MAX_PORTNAME_LEN];
char *p = key;
char *sep = "|"; // TODO: get from dbTable->separator
parseNextTok(&p, sep, YES, 0, NO, buf, HSP_SONIC_MAX_PORTNAME_LEN); // ignore table token
char *portName = parseNextTok(&p, sep, YES, 0, NO, buf, HSP_SONIC_MAX_PORTNAME_LEN);
if(portName) {
EVDebug(mod, 1, "PORT_INDEX_TABLE changed entry for: %s", portName);
HSPSonicPort *prt = getPort(mod, portName, NO);
if(prt)
requestPortIfIndexDiscovery(mod, prt);
}
}

static void dbEvt_subscribeCB(redisAsyncContext *ctx, void *magic, void *req_magic)
Expand Down

0 comments on commit 5d32f79

Please sign in to comment.