if (eo == -1) {
if (env == NULL)
logger(ctx, LOG_ERR,
- "%s: %s: malformed embedded option %d:%d",
+ "%s: %s: malformed embedded option"
+ " %d:%d/%zu",
ifname, __func__, opt->option,
- eopt->option);
+ eopt->option, i);
goto out;
}
if (eo == 0) {
* data for it.
* This may not be an error as some options like
* DHCP FQDN in RFC4702 have a string as the last
- * option which is optional.
- * FIXME: Add an flag to the options to indicate
- * wether this is allowable or not. */
+ * option which is optional. */
if (env == NULL &&
- (ol != 0 || i + 1 < opt->embopts_len))
+ (ol != 0 || !(eopt->type & OPTIONAL)))
logger(ctx, LOG_ERR,
- "%s: %s: malformed embedded option %d:%d",
+ "%s: %s: missing embedded option %d:%d/%zu",
ifname, __func__, opt->option,
- eopt->option);
+ eopt->option, i);
goto out;
}
/* Use the option prefix if the embedded option
#define RFC3361 (1 << 9)
#define RFC1035 (1 << 10)
#define RFC3442 (1 << 11)
-/* unassigned (1 << 12) */
+#define OPTIONAL (1 << 12)
#define ADDRIPV6 (1 << 13)
#define BINHEX (1 << 14)
#define FLAG (1 << 15)
# RFC1035 encoded.
# The server MUST use the encoding as specified by the client as noted
# in RFC4702 Section 2.1.
-embed domain fqdn
+embed optional domain fqdn
# Option 82 is for Relay Agents and DHCP servers
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 15, 2015
+.Dd October 19, 2015
.Dt DHCPCD.CONF 5
.Os
.Sh NAME
configuration
.It Ic norequest
This option cannot be requested, regardless of user configuration
+.It Ic optional
+This option is optional.
+Only makes sense for embedded options where like the client FQDN option where
+the FQDN string itself is optional.
.It Ic index
The option can appear more than once and will be indexed.
.It Ic array
}
*fp++ = '\0';
}
+ if (strcasecmp(arg, "optional") == 0) {
+ t |= OPTIONAL;
+ arg = strskipwhite(fp);
+ fp = strwhite(arg);
+ if (fp == NULL) {
+ logger(ctx, LOG_ERR,
+ "incomplete optional type");
+ return -1;
+ }
+ *fp++ = '\0';
+ }
if (strcasecmp(arg, "index") == 0) {
t |= INDEX;
arg = strskipwhite(fp);