summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/dhcpv4.go
diff options
context:
space:
mode:
authorSean Karlage <skarlage@fb.com>2018-08-15 10:34:04 -0700
committerSean Karlage <skarlage@fb.com>2018-08-15 10:34:04 -0700
commit40169a2169f788c41cb806c9d344148e72a3a0bd (patch)
tree6cfee5029c946710e4ed7789151ac02e62fa852b /dhcpv4/dhcpv4.go
parent8ea2525c898436a2a935580de67727bbe7035c85 (diff)
parent926a42d133247d7a4fa388548e4323b77421f798 (diff)
Merge branch 'master' into dhcpv4-moar-tests
Diffstat (limited to 'dhcpv4/dhcpv4.go')
-rw-r--r--dhcpv4/dhcpv4.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/dhcpv4/dhcpv4.go b/dhcpv4/dhcpv4.go
index d452f6e..972d103 100644
--- a/dhcpv4/dhcpv4.go
+++ b/dhcpv4/dhcpv4.go
@@ -656,6 +656,19 @@ func (d *DHCPv4) ValidateOptions() {
}
}
+// IsOptionRequested returns true if that option is within the requested
+// options of the DHCPv4 message.
+func (d *DHCPv4) IsOptionRequested(requested OptionCode) bool {
+ for _, optprl := range d.GetOption(OptionParameterRequestList) {
+ for _, o := range optprl.(*OptParameterRequestList).RequestedOpts {
+ if o == requested {
+ return true
+ }
+ }
+ }
+ return false
+}
+
// ToBytes encodes a DHCPv4 structure into a sequence of bytes in its wire
// format.
func (d *DHCPv4) ToBytes() []byte {