VOL-434: Introduced configuration parameter to enable changing of src/dst MAC address
Change-Id: I2dbd584290347b85aa54f500041190afc172c632
diff --git a/src/main/java/org/opencord/dhcpl2relay/DhcpL2Relay.java b/src/main/java/org/opencord/dhcpl2relay/DhcpL2Relay.java
index ec4a726..8911a8f 100755
--- a/src/main/java/org/opencord/dhcpl2relay/DhcpL2Relay.java
+++ b/src/main/java/org/opencord/dhcpl2relay/DhcpL2Relay.java
@@ -155,6 +155,7 @@
private ApplicationId appId;
static Map<String, DhcpAllocationInfo> allocationMap = Maps.newConcurrentMap();
+ private boolean modifyClientPktsSrcDstMac = false;
@Activate
protected void activate(ComponentContext context) {
@@ -251,6 +252,7 @@
}
dhcpConnectPoints = Sets.newConcurrentHashSet(cfg.getDhcpServerConnectPoint());
+ modifyClientPktsSrcDstMac = cfg.getModifySrcDstMacAddresses();
selectServerConnectPoint();
@@ -540,8 +542,10 @@
ipv4Packet.setPayload(udpPacket);
etherReply.setPayload(ipv4Packet);
- etherReply.setSourceMacAddress(relayAgentMac);
- etherReply.setDestinationMacAddress(dhcpConnectMac);
+ if (modifyClientPktsSrcDstMac) {
+ etherReply.setSourceMacAddress(relayAgentMac);
+ etherReply.setDestinationMacAddress(dhcpConnectMac);
+ }
etherReply.setPriorityCode(ethernetPacket.getPriorityCode());
etherReply.setVlanID(cTag(context).toShort());