summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/utils.go
blob: d95f58687b6d9832b946eeedbe3862b22d31af9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package dhcpv4

// IsRequested function takes a DHCPv4 message and an OptionCode, and returns
// true if that option is within the requested options of the DHCPv6 message.
func IsRequested(pkt *DHCPv4, requested OptionCode) bool {
	for _, optprl := range pkt.GetOption(OptionParameterRequestList) {
		for _, o := range optprl.(*OptParameterRequestList).RequestedOpts {
			if o == requested {
				return true
			}
		}
	}
	return false
}