Changing Option82 flag handling as VGC is not supposed to add it in DHCP packet
Change-Id: I5128d90aca7179f5c2b886220abe8c69e83b9a21
diff --git a/internal/pkg/application/dhcprelay.go b/internal/pkg/application/dhcprelay.go
index 346bd3d..580ea85 100644
--- a/internal/pkg/application/dhcprelay.go
+++ b/internal/pkg/application/dhcprelay.go
@@ -827,12 +827,12 @@
}
raiseDHCPv4Indication(msgType, vpv, dhcp4.ClientHWAddr, vpv.Ipv4Addr, priority, device, 0)
- // Check IsOption82Disabled flag in configuration. if true(disabled), do not add option82 into dhcpv4 header.
+ // Check IsOption82Enabled flag in configuration. if true(enabled), add option82 into dhcpv4 header.
// Remote id can be custom or mac address.
// If remote id is custom, then add service will carry the remote id
// If remote id is mac address, and if mac is configured, then add service will carry the remote id
// If remote id is mac address, in mac learning case, then mac has to be taken from dhcp packet
- if !svc.IsOption82Disabled {
+ if svc.IsOption82Enabled {
var remoteID []byte
if svc.RemoteIDType == string(MACAddress) {
remoteID = []byte((dhcp4.ClientHWAddr).String())
@@ -990,12 +990,12 @@
}
// BuildRelayFwd to build forward relay
-func BuildRelayFwd(paddr net.IP, intfID []byte, remoteID []byte, payload []byte, isOption82Disabled bool, dhcpRelay bool) *layers.DHCPv6 {
+func BuildRelayFwd(paddr net.IP, intfID []byte, remoteID []byte, payload []byte, isOption82Enabled bool, dhcpRelay bool) *layers.DHCPv6 {
dhcp6 := &layers.DHCPv6{MsgType: layers.DHCPv6MsgTypeRelayForward, LinkAddr: net.ParseIP("::"), PeerAddr: []byte(paddr)}
dhcp6.Options = append(dhcp6.Options, layers.NewDHCPv6Option(layers.DHCPv6OptRelayMessage, payload))
- // Check IsOption82Disabled flag in configuration. if true(disabled), do not add remoteID and circuitID into dhcpv6 header.
+ // Check IsOption82Enabled flag in configuration. if true(enabled), add remoteID and circuitID into dhcpv6 header.
if dhcpRelay {
- if !isOption82Disabled {
+ if isOption82Enabled {
remote := &layers.DHCPv6RemoteId{RemoteId: remoteID}
if len(remoteID) != 0 {
dhcp6.Options = append(dhcp6.Options, layers.NewDHCPv6Option(layers.DHCPv6OptRemoteID, remote.Encode()))
@@ -1046,7 +1046,7 @@
} else if svc.RemoteID != nil {
remoteID = svc.RemoteID
}
- dhcp6 := BuildRelayFwd(ip.SrcIP, svc.GetCircuitID(), remoteID, udp.Payload, svc.IsOption82Disabled, vpv.DhcpRelay)
+ dhcp6 := BuildRelayFwd(ip.SrcIP, svc.GetCircuitID(), remoteID, udp.Payload, svc.IsOption82Enabled, vpv.DhcpRelay)
var sourceMac = eth.SrcMAC
var sessionKey [MaxLenDhcpv6DUID]byte
diff --git a/internal/pkg/application/service.go b/internal/pkg/application/service.go
index a2e1d54..6da1150 100644
--- a/internal/pkg/application/service.go
+++ b/internal/pkg/application/service.go
@@ -98,7 +98,7 @@
DsPonSTagPriority of.PbitType
DsPonCTagPriority of.PbitType
VlanControl VlanControl
- IsOption82Disabled bool
+ IsOption82Enabled bool
IgmpEnabled bool
McastService bool
AllowTransparent bool
@@ -173,7 +173,7 @@
vs.DsHSIAFlowsApplied = false
vs.DeleteInProgress = false
//vs.MacAddr, _ = net.ParseMAC("00:00:00:00:00:00")
-
+ vs.IsOption82Enabled = cfg.IsOption82Enabled
vs.MacAddr = cfg.MacAddr
vs.Ipv4Addr = net.ParseIP("0.0.0.0")
vs.Ipv6Addr = net.ParseIP("::")
@@ -1855,7 +1855,7 @@
if evs.MacLearning == MacLearningNone && !util.MacAddrsMatch(nvs.MacAddr, evs.MacAddr) {
return false
}
- if nvs.IsOption82Disabled != evs.IsOption82Disabled {
+ if nvs.IsOption82Enabled != evs.IsOption82Enabled {
return false
}
if nvs.IgmpEnabled != evs.IgmpEnabled {
diff --git a/internal/pkg/application/vnets.go b/internal/pkg/application/vnets.go
index 09613c9..1374faa 100644
--- a/internal/pkg/application/vnets.go
+++ b/internal/pkg/application/vnets.go
@@ -455,7 +455,7 @@
IgmpFlowsApplied bool
McastService bool
FlowsApplied bool
- IsOption82Disabled bool //Will not be used
+ IsOption82Enabled bool //Will not be used
}
// VlanControl vlan control type
@@ -3148,7 +3148,7 @@
LearntMacAddr: vpv.LearntMacAddr,
CircuitID: vpv.CircuitID,
RemoteID: vpv.RemoteID,
- IsOption82Disabled: vpv.IsOption82Disabled,
+ IsOption82Enabled: vpv.IsOption82Enabled,
RelayState: vpv.RelayState,
PPPoeState: vpv.PPPoeState,
RelayStatev6: vpv.RelayStatev6,