-/* $OpenBSD: flowspec.c,v 1.3 2023/04/19 07:07:58 claudio Exp $ */
+/* $OpenBSD: flowspec.c,v 1.4 2023/04/19 09:31:58 claudio Exp $ */
/*
* Copyright (c) 2023 Claudio Jeker <claudio@openbsd.org>
clen = MINIMUM(alen, blen);
/* only extract the common prefix */
- if (extract_prefix(abuf + 2, ablen - 2, &a, clen, sizeof(a)) == -1)
- fatalx("bad flowspec prefix encoding");
- if (extract_prefix(bbuf + 2, bblen - 2, &b, clen, sizeof(b)) == -1)
- fatalx("bad flowspec prefix encoding");
+ extract_prefix(abuf + 2, ablen - 2, &a, clen, sizeof(a));
+ extract_prefix(bbuf + 2, bblen - 2, &b, clen, sizeof(b));
/* lowest IP value has precedence */
cmp = memcmp(a, b, sizeof(a));
clen = MINIMUM(alen, blen);
/* only extract the common prefix */
- if (extract_prefix(abuf + 3, ablen - 3, &a, clen, sizeof(a)) == -1)
- fatalx("bad flowspec prefix encoding");
- if (extract_prefix(bbuf + 3, bblen - 3, &b, clen, sizeof(b)) == -1)
- fatalx("bad flowspec prefix encoding");
+ extract_prefix(abuf + 3, ablen - 3, &a, clen, sizeof(a));
+ extract_prefix(bbuf + 3, bblen - 3, &b, clen, sizeof(b));
/* lowest IP value has precedence */
cmp = memcmp(a, b, sizeof(a));
len -= l;
}
if (len < 0)
- fatalx("flowspec overflow");
+ return -1;
return 0;
}
while (alen > 0 && blen > 0) {
acomplen = flowspec_next_component(a, alen, is_v6, &atype);
- if (acomplen == -1)
- fatalx("bad flowspec component");
bcomplen = flowspec_next_component(b, blen, is_v6, &btype);
+ /* should not happen */
if (acomplen == -1)
- fatalx("bad flowspec component");
+ return 1;
+ if (bcomplen == -1)
+ return -1;
/* If types differ, lowest type wins. */
if (atype < btype)