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/a-path.c | |
parent | 0edf0c8cd919a8b3fbf5bc036f27ea0b4ed0b91a (diff) |
BGP: Add option to reject AS_SETs
There is a pending draft to make them obsolete
Diffstat (limited to 'nest/a-path.c')
-rw-r--r-- | nest/a-path.c | 14 |
1 files changed, 11 insertions, 3 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: |