diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-11-04 22:07:03 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-11-04 22:09:35 +0100 |
commit | a52476c9be41e8d33e4a22e3dc733240ce791b42 (patch) | |
tree | f702de3fa0fe9d48732c891bbe3da2147c02ef53 /nest | |
parent | 0edf0c8cd919a8b3fbf5bc036f27ea0b4ed0b91a (diff) |
BGP: Add option to reject AS_SETs
There is a pending draft to make them obsolete
Diffstat (limited to 'nest')
-rw-r--r-- | nest/a-path.c | 14 | ||||
-rw-r--r-- | nest/attrs.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/nest/a-path.c b/nest/a-path.c index b6a30f54..cffd46ab 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -25,7 +25,7 @@ #define BAD(DSC, VAL) ({ err_dsc = DSC; err_val = VAL; goto bad; }) int -as_path_valid(byte *data, uint len, int bs, int confed, char *err, uint elen) +as_path_valid(byte *data, uint len, int bs, int sets, int confed, char *err, uint elen) { byte *pos = data; char *err_dsc = NULL; @@ -46,13 +46,21 @@ as_path_valid(byte *data, uint len, int bs, int confed, char *err, uint elen) switch (type) { case AS_PATH_SET: + if (!sets) + BAD("AS_SET segment", type); + break; + case AS_PATH_SEQUENCE: break; case AS_PATH_CONFED_SEQUENCE: - case AS_PATH_CONFED_SET: if (!confed) - BAD("AS_CONFED* segment", type); + BAD("AS_CONFED_SEQUENCE segment", type); + break; + + case AS_PATH_CONFED_SET: + if (!sets || !confed) + BAD("AS_CONFED_SET segment", type); break; default: diff --git a/nest/attrs.h b/nest/attrs.h index 6fb0a8fa..3a4b0acd 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -30,7 +30,7 @@ struct f_tree; -int as_path_valid(byte *data, uint len, int bs, int confed, char *err, uint elen); +int as_path_valid(byte *data, uint len, int bs, int sets, int confed, char *err, uint elen); int as_path_16to32(byte *dst, const byte *src, uint len); int as_path_32to16(byte *dst, const byte *src, uint len); int as_path_contains_as4(const struct adata *path); |