printf(" binhex");
else if (opt->type & OT_STRING)
printf(" string");
+ else if (opt->type & OT_URI)
+ printf(" uri");
if (opt->type & OT_RFC3361)
printf(" rfc3361");
if (opt->type & OT_RFC3442)
errno = EINVAL;
break;
}
+ if (type & OT_URI && isspace(c)) {
+ errno = EINVAL;
+ break;
+ }
if ((type & (OT_ESCSTRING | OT_ESCFILE) &&
(c == '\\' || !isascii(c) || !isprint(c))) ||
(type & OT_ESCFILE && (c == '/' || c == ' ')))
return print_rfc3442(fp, data, dl);
#endif
- if (opt->type & OT_STRING) {
+ /* Produces a space separated list of URIs.
+ * This is valid as a URI cannot contain a space. */
+ if ((opt->type & (OT_ARRAY | OT_URI)) == (OT_ARRAY | OT_URI)) {
+#ifdef SMALL
+ errno = ENOTSUP;
+ return -1;
+#else
+ char buf[UINT16_MAX + 1];
+ uint16_t sz;
+ bool first = true;
+
+ while (dl) {
+ if (dl < 2) {
+ errno = EINVAL;
+ goto err;
+ }
+
+ memcpy(&u16, data, sizeof(u16));
+ sz = ntohs(u16);
+ data += sizeof(u16);
+ dl -= sizeof(u16);
+
+ if (sz == 0)
+ continue;
+ if (sz > dl) {
+ errno = EINVAL;
+ goto err;
+ }
+
+ if (print_string(buf, sizeof(buf),
+ opt->type, data, sz) == -1)
+ goto err;
+
+ if (first)
+ first = false;
+ else if (fputc(' ', fp) == EOF)
+ goto err;
+
+ if (fprintf(fp, "%s", buf) == -1)
+ goto err;
+
+ data += sz;
+ dl -= sz;
+ }
+
+ if (fputc('\0', fp) == EOF)
+ goto err;
+ return 0;
+#endif
+ }
+
+ if (opt->type & (OT_STRING | OT_URI)) {
char buf[1024];
if (print_string(buf, sizeof(buf), opt->type, data, dl) == -1)
#define OT_ESCFILE (1 << 26)
#define OT_BITFLAG (1 << 27)
#define OT_RESERVED (1 << 28)
+#define OT_URI (1 << 29)
#define DHC_REQ(r, n, o) \
(has_option_mask((r), (o)) && !has_option_mask((n), (o)))
# DHCP ANDSF, RFC6153
define 142 array ipaddress andsf
+# DHCP SZTP Redirect, RFC8572
+define 143 array uri sztp_redirect
+
# DHCP Coordinate LCI, RFC6225
# We have no means of expressing 6 bit lengths
define 144 binhex geoloc
# An expired RFC for Web Proxy Auto Discovery Protocol does define
# Option 252 which is commonly used by major browsers.
# Apparently the code was assigned by agreement of the DHC working group chair.
-define 252 string wpad_url
+define 252 uri wpad_url
# Option 255 End
define6 58 array domain sip_ua_cs_list
# DHCPv6 Network Boot, RFC5970
-define6 59 string bootfile_url
+define6 59 uri bootfile_url
# We presently cannot decode bootfile_param
define6 60 binhex bootfile_param
define6 61 array uint16 architecture_types
define6 112 string mudurl
# DHCP Captive Portal, RFC8910
-define6 103 string captive_portal_uri
+define6 103 uri captive_portal_uri
+
+# DHCP SZTP Redirect, RFC8572
+define6 136 array uri sztp_redirect
# DHCP DDoS Open Threat Signaling (DOTS) Agent Discovery, RFC8973
define6 141 domain dots_ri
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd August 31, 2022
+.Dd October 4, 2023
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
An RFC 3397 encoded string.
.It Ic dname
An RFC 1035 validated string.
+.It Ic uri
+If an array then the first two bytes are the URI length inside the option data.
+Otherwise, the whole option data is the URI.
+As a space is not allowed in the URI encoding, the URIs are space separated.
.It Ic binhex Op : Ic length
Binary data expressed as hexadecimal.
.It Ic embed
t |= OT_ADDRIPV6;
else if (strcasecmp(arg, "string") == 0)
t |= OT_STRING;
+ else if (strcasecmp(arg, "uri") == 0)
+ t |= OT_URI;
else if (strcasecmp(arg, "byte") == 0)
t |= OT_UINT8;
else if (strcasecmp(arg, "bitflags") == 0)