macvlan: Improve parsing

This commit is contained in:
Markus Gothe 2023-08-02 12:23:04 +00:00 committed by Vivek Kumar Dutta
parent 25a5df6b98
commit 309c2c1b2d
2 changed files with 3 additions and 2 deletions

View file

@ -59,6 +59,7 @@ do { \
#define DM_STRLEN(SRC) ((SRC != NULL) ? strlen(SRC) : 0)
#define DM_STRSTR(STR, MATCH) ((STR != NULL && MATCH != NULL) ? strstr(STR, MATCH) : NULL)
#define DM_STRCHR(STR, CHR) ((STR != NULL) ? strchr(STR, CHR) : NULL)
#define DM_STRRCHR(STR, CHR) ((STR != NULL) ? strrchr(STR, CHR) : NULL)
#define DM_STRTOL(SRC) ((SRC != NULL) ? strtol(SRC, NULL, 10) : 0)
#define DM_STRTOUL(SRC) ((SRC != NULL) ? strtoul(SRC, NULL, 10) : 0)
#define DM_STRCMP(S1, S2) ((S1 != NULL && S2 != NULL) ? strcmp(S1, S2) : -1)

View file

@ -161,12 +161,12 @@ static void dmmap_synchronizeEthernetLink(struct dmctx *dmctx, DMNODE *parent_no
DM_STRNCPY(dev_name, device, sizeof(dev_name));
char *has_vid = DM_STRCHR(dev_name, '.');
char *has_vid = DM_STRRCHR(dev_name, '.');
if (has_vid)
*has_vid = '\0';
if (is_mac_vlan_interface(dev_name)) {
char *p = DM_STRCHR(dev_name, '_');
char *p = DM_STRRCHR(dev_name, '_');
if (p)
*p = '\0';
}