Make use of NetUtils.getBroadcastMacAddr() 82/1782/2
authorAlessandro Boch <aboch@cisco.com>
Thu, 10 Oct 2013 16:00:49 +0000 (09:00 -0700)
committerAlessandro Boch <aboch@cisco.com>
Thu, 10 Oct 2013 16:00:49 +0000 (09:00 -0700)
    ISSUE: I suggested to make NetUtils.broadcastMacAddr public, but that was no
           a good idea as we already have the getter and because that is an arra
           therefore vulnerable to modifications.

Change-Id: I098ca828d79ffe1d478c761d8b749ee100dfba5b
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/arphandler/src/main/java/org/opendaylight/controller/arphandler/internal/ArpHandler.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/utils/NetUtils.java

index 4ff44fdab808ff750efa40437ee956637002d666..e345d65f7e527754981de650e8c75e47a72b47d8 100644 (file)
@@ -345,7 +345,7 @@ public class ArpHandler implements IHostFinder, IListenDataPacket, ICacheUpdateA
             byte[] targetIPByte = targetIP.getAddress();
             ARP arp = createARP(ARP.REQUEST, getControllerMAC(), senderIP, targetHardwareAddress, targetIPByte);
 
-            byte[] destMACAddress = NetUtils.BroadcastMACAddr;
+            byte[] destMACAddress = NetUtils.getBroadcastMACAddr();
             Ethernet ethernet = createEthernet(getControllerMAC(), destMACAddress, arp);
 
             // TODO For now send port-by-port, see how to optimize to
index 1ced9dd9e43b2922d00120ce46648bad0704c50f..6c3424c616c46799908911e56e5323f8103d99cd 100644 (file)
@@ -43,7 +43,7 @@ public abstract class NetUtils {
     /**
      * Constant holding the broadcast MAC address
      */
-    public static final byte[] BroadcastMACAddr = {-1, -1, -1, -1, -1, -1};
+    private static final byte[] BroadcastMACAddr = {-1, -1, -1, -1, -1, -1};
 
     /**
      * Converts a 4 bytes array into an integer number
@@ -515,7 +515,7 @@ public abstract class NetUtils {
     /**
      * Returns Broadcast MAC Address
      *
-     * @return the byte array containing  broadcaset mac address
+     * @return the byte array containing  broadcast mac address
      */
     public static byte[] getBroadcastMACAddr() {
         return Arrays.copyOf(BroadcastMACAddr, BroadcastMACAddr.length);