mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-09 10:31:53 +00:00
Flowspec: portability fixes in action formatting
This commit is contained in:
parent
ea8bf6d8fc
commit
580e01b5a3
@ -83,16 +83,14 @@ flow_type_str(enum flow_type type, int ipv6)
|
|||||||
const char *
|
const char *
|
||||||
flow_action_str(uint action)
|
flow_action_str(uint action)
|
||||||
{
|
{
|
||||||
#define C(c, s) case c: return s
|
|
||||||
switch(action) {
|
switch(action) {
|
||||||
C(FLOW_ACTION_TRAFFIC_BYTERATE, "byterate");
|
case FLOW_ACTION_TRAFFIC_BYTERATE: return "byterate";
|
||||||
C(FLOW_ACTION_TRAFFIC_ACTION, "action");
|
case FLOW_ACTION_TRAFFIC_ACTION: return "action";
|
||||||
C(FLOW_ACTION_REDIRECT_AS2, "redirect");
|
case FLOW_ACTION_REDIRECT_AS2: return "redirect";
|
||||||
C(FLOW_ACTION_REDIRECT_AS4, "redirect");
|
case FLOW_ACTION_REDIRECT_AS4: return "redirect";
|
||||||
C(FLOW_ACTION_REDIRECT_IP4, "redirect");
|
case FLOW_ACTION_REDIRECT_IP4: return "redirect";
|
||||||
C(FLOW_ACTION_TRAFFIC_MARKING, "mark");
|
case FLOW_ACTION_TRAFFIC_MARKING: return "mark";
|
||||||
}
|
}
|
||||||
#undef C
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1265,11 +1263,11 @@ flow_action_format_part(char *buf, uint blen, u64 ec)
|
|||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
case FLOW_ACTION_REDIRECT_AS2:
|
case FLOW_ACTION_REDIRECT_AS2:
|
||||||
return bsnprintf(buf, blen, "rt %d,%d;", ((ec >> 32) & 0xffff), (ec & 0xffffffff));
|
return bsnprintf(buf, blen, "rt %lu,%lu;", ((ec >> 32) & 0xffff), (ec & 0xffffffff));
|
||||||
case FLOW_ACTION_REDIRECT_AS4:
|
case FLOW_ACTION_REDIRECT_AS4:
|
||||||
return bsnprintf(buf, blen, "rt %d,%d;", ((ec >> 16) & 0xffffffff), (ec & 0xffff));
|
return bsnprintf(buf, blen, "rt %lu,%lu;", ((ec >> 16) & 0xffffffff), (ec & 0xffff));
|
||||||
case FLOW_ACTION_TRAFFIC_MARKING:
|
case FLOW_ACTION_TRAFFIC_MARKING:
|
||||||
return bsnprintf(buf, blen, "dscp %d;", (ec & 0x3f));
|
return bsnprintf(buf, blen, "dscp %lu;", (ec & 0x3f));
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ int bvsnprintf(char *buf, int size, const char *fmt, va_list args)
|
|||||||
char ipbuf[NET_MAX_TEXT_LENGTH+1];
|
char ipbuf[NET_MAX_TEXT_LENGTH+1];
|
||||||
struct iface *iface;
|
struct iface *iface;
|
||||||
const char *percent;
|
const char *percent;
|
||||||
char fmtbuf[strlen(fmt)];
|
char fmtbuf[13];
|
||||||
|
|
||||||
int flags; /* flags to number() */
|
int flags; /* flags to number() */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user