.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 26, 2009
+.Dd September 1, 2009
.Dt DHCPCD 8 SMM
.Os
.Sh NAME
Add an enscapulated vendor option.
.Ar code
should be between 1 and 254 inclusive.
+To add a raw vendor string, omit
+.Ar code
+but keep the comma.
Examples.
.Pp
Set the vendor option 01 with an IP address.
.D1 dhcpcd \-v 01,192.168.0.2 eth0
Set the vendor option 02 with a hex code.
.D1 dhcpcd \-v 02,01:02:03:04:05 eth0
-Do the above and set a third option with a string and not an IP address.
-.D1 dhcpcd \-v 01,192.168.0.2 \-v 02,01:02:03:04:05 \-v 03,\e"192.168.0.2\e" eth0
+Set the vendor option 03 with an IP address as a string.
+.D1 dhcpcd \-v 03,\e"192.168.0.2\e" eth0
+Set un-encapulated vendor option to hello world.
+.D1 dhcpcd \-v ,\e"hello world\e" eth0
.It Fl x , -exit
This will signal an existing
.Nm
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd July 26, 2009
+.Dd September 1, 2009
.Dt DHCPCD.CONF 5 SMM
.Os
.Sh NAME
Add an enscapulated vendor option.
.Ar code
should be between 1 and 254 inclusive.
+To add a raw vendor string, omit
+.Ar code
+but keep the comma.
Examples.
.Pp
Set the vendor option 01 with an IP address.
.D1 vendor 02,01:02:03:04:05
Set the vendor option 03 with an IP address as a string.
.D1 vendor 03,\e"192.168.0.2\e"
+Set un-encapulated vendor option to hello world.
+.D1 vendor ,\e"hello world\e"
.It Ic vendorclassid Ar string
Change the default vendorclassid sent from dhcpcd-version.
If not set then none is sent.
syslog(LOG_ERR, "invalid vendor format");
return -1;
}
+
+ /* If vendor starts with , then it is not encapsulated */
+ if (p == arg) {
+ arg++;
+ s = parse_string((char *)ifo->vendor + 1,
+ VENDOR_MAX_LEN, arg);
+ if (s == -1) {
+ syslog(LOG_ERR, "vendor: %m");
+ return -1;
+ }
+ ifo->vendor[0] = (uint8_t)s;
+ ifo->options |= DHCPCD_VENDORRAW;
+ break;
+ }
+
+ /* Encapsulated vendor options */
+ if (ifo->options & DHCPCD_VENDORRAW) {
+ ifo->options &= ~DHCPCD_VENDORRAW;
+ ifo->vendor[0] = 0;
+ }
+
*p = '\0';
i = atoint(arg);
arg = p + 1;
}
/* Terminate the encapsulated options */
- if (ifo && ifo->vendor[0]) {
+ if (ifo && ifo->vendor[0] && !(ifo->options & DHCPCD_VENDORRAW)) {
ifo->vendor[0]++;
ifo->vendor[ifo->vendor[0]] = DHO_END;
}
break;
}
/* Terminate the encapsulated options */
- if (r == 1 && ifo->vendor[0]) {
+ if (r == 1 && ifo->vendor[0] && !(ifo->options & DHCPCD_VENDORRAW)) {
ifo->vendor[0]++;
ifo->vendor[ifo->vendor[0]] = DHO_END;
}
#define DHCPCD_LINK (1 << 20)
#define DHCPCD_QUIET (1 << 21)
#define DHCPCD_BACKGROUND (1 << 22)
+#define DHCPCD_VENDORRAW (1 << 23)
extern const struct option cf_options[];