diff options
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); |