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 4ff44fd..e345d65 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[] 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
             Ethernet ethernet = createEthernet(getControllerMAC(), destMACAddress, arp);
 
             // TODO For now send port-by-port, see how to optimize to
index 1ced9dd..6c3424c 100644 (file)
@@ -43,7 +43,7 @@ public abstract class NetUtils {
     /**
      * Constant holding the broadcast MAC address
      */
     /**
      * 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
 
     /**
      * Converts a 4 bytes array into an integer number
@@ -515,7 +515,7 @@ public abstract class NetUtils {
     /**
      * Returns Broadcast MAC Address
      *
     /**
      * 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);
      */
     public static byte[] getBroadcastMACAddr() {
         return Arrays.copyOf(BroadcastMACAddr, BroadcastMACAddr.length);