NET ROAx: add max_pxlen, fix format

This commit is contained in:
Pavel Tvrdík 2016-01-14 10:03:50 +01:00
parent 9a883adf95
commit f9d729ab68
3 changed files with 7 additions and 5 deletions

View file

@ -48,9 +48,9 @@ net_format(const net_addr *N, char *buf, int buflen)
case NET_VPN6: case NET_VPN6:
return bsnprintf(buf, buflen, "%u:%u %I6/%d", (u32) (n->vpn6.rd >> 32), (u32) n->vpn6.rd, n->vpn6.prefix, n->vpn6.pxlen); return bsnprintf(buf, buflen, "%u:%u %I6/%d", (u32) (n->vpn6.rd >> 32), (u32) n->vpn6.rd, n->vpn6.prefix, n->vpn6.pxlen);
case NET_ROA4: case NET_ROA4:
return bsnprintf(buf, buflen, "%I4/%d AS%u", n->roa4.prefix, n->roa4.pxlen, n->roa4.asn); return bsnprintf(buf, buflen, "%I4/%u-%u AS%u", n->roa4.prefix, n->roa4.pxlen, n->roa4.max_pxlen, n->roa4.asn);
case NET_ROA6: case NET_ROA6:
return bsnprintf(buf, buflen, "%I6/%d AS%u", n->roa6.prefix, n->roa6.pxlen, n->roa6.asn); return bsnprintf(buf, buflen, "%I6/%u-%u AS%u", n->roa6.prefix, n->roa6.pxlen, n->roa6.max_pxlen, n->roa6.asn);
} }
return 0; return 0;

View file

@ -64,7 +64,7 @@ typedef struct net_addr_roa4 {
u8 pxlen; u8 pxlen;
u16 length; u16 length;
ip4_addr prefix; ip4_addr prefix;
u8 max_pxlen; u32 max_pxlen;
u32 asn; u32 asn;
} net_addr_roa4; } net_addr_roa4;
@ -73,7 +73,7 @@ typedef struct net_addr_roa6 {
u8 pxlen; u8 pxlen;
u16 length; u16 length;
ip6_addr prefix; ip6_addr prefix;
u8 max_pxlen; u32 max_pxlen;
u32 asn; u32 asn;
} net_addr_roa6; } net_addr_roa6;

View file

@ -55,7 +55,7 @@ CF_DECLS
CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT) CF_KEYWORDS(ROUTER, ID, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS) CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6) CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6)
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED) CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED)
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES) CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE) /* ,ROA */ CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, NOEXPORT, GENERATE) /* ,ROA */
@ -137,6 +137,8 @@ table_type:
| IPV6 { $$ = NET_IP6; } | IPV6 { $$ = NET_IP6; }
| VPN4 { $$ = NET_VPN4; } | VPN4 { $$ = NET_VPN4; }
| VPN6 { $$ = NET_VPN6; } | VPN6 { $$ = NET_VPN6; }
| ROA4 { $$ = NET_ROA4; }
| ROA6 { $$ = NET_ROA6; }
; ;
table_sorted: table_sorted: