Check that ALPN is present when NO-DEFAULT-ALPN is present in fromwire
This commit is contained in:
@@ -755,7 +755,7 @@ static inline isc_result_t
|
||||
generic_fromwire_in_svcb(ARGS_FROMWIRE) {
|
||||
dns_name_t name;
|
||||
isc_region_t region, man = { .base = NULL, .length = 0 };
|
||||
bool alias, first = true;
|
||||
bool alias, first = true, have_alpn = false;
|
||||
uint16_t lastkey = 0, mankey = 0;
|
||||
|
||||
UNUSED(type);
|
||||
@@ -829,6 +829,15 @@ generic_fromwire_in_svcb(ARGS_FROMWIRE) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check alpn present when no-default-alpn is set.
|
||||
*/
|
||||
if (key == SVCB_ALPN_KEY) {
|
||||
have_alpn = true;
|
||||
} else if (key == SVCB_NO_DEFAULT_ALPN_KEY && !have_alpn) {
|
||||
return (DNS_R_FORMERR);
|
||||
}
|
||||
|
||||
first = false;
|
||||
lastkey = key;
|
||||
|
||||
|
||||
@@ -2719,6 +2719,10 @@ https_svcb(void **state) {
|
||||
*/
|
||||
WIRE_VALID_LOOP(0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09,
|
||||
5, 'h', '1', '\\', 'h', '2', 2, 'h', '3'),
|
||||
/*
|
||||
* no-default-alpn (0x00 0x02) without alpn, alpn is required.
|
||||
*/
|
||||
WIRE_INVALID(0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00),
|
||||
WIRE_SENTINEL()
|
||||
};
|
||||
/* Test vectors from RFCXXXX */
|
||||
|
||||
Reference in New Issue
Block a user