Cleaned up ProxyArpManager code by creating an interface through which it can request information about the L3 configuration (IP addresses, ports, etc)
diff --git a/src/main/java/net/floodlightcontroller/packet/IPv4.java b/src/main/java/net/floodlightcontroller/packet/IPv4.java
index 01f886d..85f21ca 100644
--- a/src/main/java/net/floodlightcontroller/packet/IPv4.java
+++ b/src/main/java/net/floodlightcontroller/packet/IPv4.java
@@ -31,6 +31,7 @@
  *
  */
 public class IPv4 extends BasePacket {
+	public static final int ADDRESS_LENGTH = 4;
     public static final byte PROTOCOL_ICMP = 0x1;
     public static final byte PROTOCOL_TCP = 0x6;
     public static final byte PROTOCOL_UDP = 0x11;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 9e7bf61..4a0aa27 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -76,7 +76,7 @@
 
 public class BgpRoute implements IFloodlightModule, IBgpRouteService, 
 									ITopologyListener, IArpRequester,
-									IOFSwitchListener {
+									IOFSwitchListener, ILayer3InfoService {
 	
 	protected static Logger log = LoggerFactory.getLogger(BgpRoute.class);
 
@@ -158,7 +158,6 @@
 							ldu.getDst(), ldu.getDstPort());
 					
 					if (activeLinks.contains(l)){
-						log.debug("Not found: {}", l);
 						it.remove();
 					}
 				}
@@ -263,7 +262,7 @@
 		
 		//TODO We'll initialise this here for now, but it should really be done as
 		//part of the controller core
-		proxyArp = new ProxyArpManager(floodlightProvider, topology);
+		proxyArp = new ProxyArpManager(floodlightProvider, topology, this);
 		
 		linkUpdates = new ArrayList<LDUpdate>();
 		ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
@@ -309,7 +308,7 @@
 		
 		readGatewaysConfiguration(configFilename);
 		
-		proxyArp.setL3Mode(interfacePtrie, interfaces.values(), bgpdMacAddress);
+		//proxyArp.setL3Mode(interfacePtrie, interfaces.values(), bgpdMacAddress);
 	}
 	
 	@Override
@@ -466,7 +465,8 @@
 				Path path = pushedPaths.get(dstIpAddress);
 				if (path == null) {
 					path = new Path(egressInterface, dstIpAddress);
-					setUpDataPath(path, MACAddress.valueOf(nextHopMacAddress));
+					//setUpDataPath(path, MACAddress.valueOf(nextHopMacAddress));
+					calculateAndPushPath(path, MACAddress.valueOf(nextHopMacAddress));
 					pushedPaths.put(dstIpAddress, path);
 				}
 				
@@ -572,7 +572,12 @@
             try {
 				sw.write(msglist, null);
 				sw.flush();
-				//Thread.sleep(0, 100000);
+				
+				/*
+				 * XXX Rate limit hack!
+				 * This should be solved properly by adding a rate limiting
+				 * layer on top of the switches if we know they need it.
+				 */
 				Thread.sleep(1);
 			} catch (IOException e) {
 				log.error("Failure writing flow mod", e);
@@ -703,13 +708,16 @@
 			}
 			
 			//If we know the MAC, lets go ahead and push the paths to this peer
-			setUpDataPath(path, MACAddress.valueOf(mac));
+			//setUpDataPath(path, MACAddress.valueOf(mac));
+			calculateAndPushPath(path, MACAddress.valueOf(mac));
 		}
 	}
 	
+	/*
 	private void setUpDataPath(Path path, MACAddress dstMacAddress) {
 		calculateAndPushPath(path, dstMacAddress);
 	}
+	*/
 	
 	private void calculateAndPushPath(Path path, MACAddress dstMacAddress) {
 		Interface dstInterface = path.getDstInterface();
@@ -989,7 +997,8 @@
 					}
 				}
 				else {
-					setUpDataPath(path, MACAddress.valueOf(macAddress));
+					//setUpDataPath(path, MACAddress.valueOf(macAddress));
+					calculateAndPushPath(path, MACAddress.valueOf(macAddress));
 					pushedPaths.put(path.getDstIpAddress(), path);
 				}
 			}
@@ -1214,20 +1223,54 @@
 	}
 
 	@Override
-	public void removedSwitch(IOFSwitch sw) {
-		// TODO Auto-generated method stub
-		
-	}
+	public void removedSwitch(IOFSwitch sw) {}
 
 	@Override
-	public void switchPortChanged(Long switchId) {
-		// TODO Auto-generated method stub
-		
-	}
+	public void switchPortChanged(Long switchId) {}
 
 	@Override
 	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
+		return "BgpRoute";
+	}
+	
+	/*
+	 * ILayer3InfoService methods
+	 */
+	
+	@Override
+	public boolean isInterfaceAddress(InetAddress address) {
+		Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
+		return (intf != null && intf.getIpAddress().equals(address));
+	}
+	
+	@Override
+	public boolean inConnectedNetwork(InetAddress address) {
+		Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
+		return (intf != null && !intf.getIpAddress().equals(address));
+	}
+	
+	@Override
+	public boolean fromExternalNetwork(long inDpid, short inPort) {
+		for (Interface intf : interfaces.values()) {
+			if (intf.getDpid() == inDpid && intf.getPort() == inPort) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	@Override
+	public Interface getOutgoingInterface(InetAddress dstIpAddress) {
+		return interfacePtrie.match(new Prefix(dstIpAddress.getAddress(), 32));
+	}
+	
+	@Override
+	public boolean hasLayer3Configuration() {
+		return !interfaces.isEmpty();
+	}
+	
+	@Override
+	public MACAddress getRouterMacAddress() {
+		return bgpdMacAddress;
 	}
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/GatewayRouter.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/GatewayRouter.java
deleted file mode 100644
index e893acf..0000000
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/GatewayRouter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package net.onrc.onos.ofcontroller.bgproute;
-
-import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.util.Dpid;
-import net.onrc.onos.ofcontroller.util.IPv4;
-import net.onrc.onos.ofcontroller.util.Port;
-import net.onrc.onos.ofcontroller.util.SwitchPort;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.openflow.util.HexString;
-
-public class GatewayRouter {
-	private SwitchPort attachmentPoint = null;
-	private long dpid;
-	private short port;
-	private MACAddress routerMac;
-	private IPv4 routerIp;
-	private IPv4 myIpAddress;
-	
-	
-	public SwitchPort getAttachmentPoint() {
-		if (attachmentPoint == null){
-			attachmentPoint = new SwitchPort(new Dpid(dpid), new Port(port));
-		}
-		return attachmentPoint;
-	}
-	
-	public long getDpid() {
-		return dpid;
-	}
-
-	@JsonProperty("attachmentDpid")
-	public void setDpid(String dpid) {
-		this.dpid = HexString.toLong(dpid);
-	}
-
-	public short getPort() {
-		return port;
-	}
-
-	@JsonProperty("attachmentPort")
-	public void setPort(short port) {
-		this.port = port;
-	}
-
-	public MACAddress getRouterMac() {
-		return routerMac;
-	}
-	
-	@JsonProperty("macAddress")
-	public void setRouterMac(String routerMac) {
-		this.routerMac = MACAddress.valueOf(routerMac);;
-	}
-
-	public IPv4 getRouterIp() {
-		return routerIp;
-	}
-	
-	@JsonProperty("ipAddress")
-	public void setRouterIp(String routerIp) {
-		this.routerIp = new IPv4(routerIp);
-	}
-	
-	public IPv4 getMyIpAddress() {
-		return myIpAddress;
-	}
-	
-	@JsonProperty("myIpAddress")
-	public void setMyIpAddress(String myIpAddress) {
-		this.myIpAddress = new IPv4(myIpAddress);
-	}
-}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java
new file mode 100644
index 0000000..0f14dd6
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/ILayer3InfoService.java
@@ -0,0 +1,36 @@
+package net.onrc.onos.ofcontroller.bgproute;
+
+import java.net.InetAddress;
+
+import net.floodlightcontroller.util.MACAddress;
+
+/**
+ * Provides information about the layer 3 properties of the network.
+ * This is based on IP addresses configured on ports in the network.
+ *
+ */
+public interface ILayer3InfoService {
+	//public Collection<Interface> getInterfaces();
+	public boolean isInterfaceAddress(InetAddress address);
+	public boolean inConnectedNetwork(InetAddress address);
+	public boolean fromExternalNetwork(long inDpid, short inPort);
+	
+	/**
+	 * Retrieves the {@link Interface} object for the interface that packets
+	 * to dstIpAddress will be sent out of. Returns null if dstIpAddress is not
+	 * in a directly connected network, or if no interfaces are configured.
+	 * @param dstIpAddress Destination IP address that we want to match to
+	 * an outgoing interface
+	 * @return The {@link Interface} object if found, null if not
+	 */
+	public Interface getOutgoingInterface(InetAddress dstIpAddress);
+	
+	/**
+	 * Returns whether this controller has a layer 3 configuration 
+	 * (i.e. interfaces and IP addresses)
+	 * @return True if IP addresses are configured, false if not
+	 */
+	public boolean hasLayer3Configuration();
+	
+	public MACAddress getRouterMacAddress();
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java
index 56f4c04..fd9ba6f 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/PushedFlowMod.java
@@ -2,6 +2,13 @@
 
 import org.openflow.protocol.OFFlowMod;
 
+/**
+ * Wraps up a DPID and a OFFlowMod so we know how to delete
+ * the flow if we have to.
+ * 
+ * TODO This functionality should be handled by ONOS's flow layer in future.
+ *
+ */
 public class PushedFlowMod {
 	private long dpid;
 	private OFFlowMod flowMod;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java
index 8087471..1520c60 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/RibEntry.java
@@ -5,8 +5,8 @@
 import com.google.common.net.InetAddresses;
 
 public class RibEntry {
-	private InetAddress routerId;
-	private InetAddress nextHop;
+	private final InetAddress routerId;
+	private final InetAddress nextHop;
 	
 	public RibEntry(InetAddress routerId, InetAddress nextHop) {
 		this.routerId = routerId;
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index 493d58e..8eb64a2 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -19,11 +19,11 @@
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.packet.ARP;
 import net.floodlightcontroller.packet.Ethernet;
+import net.floodlightcontroller.packet.IPv4;
 import net.floodlightcontroller.topology.ITopologyService;
 import net.floodlightcontroller.util.MACAddress;
-import net.onrc.onos.ofcontroller.bgproute.IPatriciaTrie;
+import net.onrc.onos.ofcontroller.bgproute.ILayer3InfoService;
 import net.onrc.onos.ofcontroller.bgproute.Interface;
-import net.onrc.onos.ofcontroller.bgproute.Prefix;
 
 import org.openflow.protocol.OFMessage;
 import org.openflow.protocol.OFPacketIn;
@@ -40,7 +40,6 @@
 import com.google.common.collect.Multimaps;
 import com.google.common.collect.SetMultimap;
 
-//TODO have L2 and also L3 mode, where it takes into account interface addresses
 //TODO REST API to inspect ARP table
 public class ProxyArpManager implements IProxyArpService, IOFMessageListener {
 	private static Logger log = LoggerFactory.getLogger(ProxyArpManager.class);
@@ -49,19 +48,20 @@
 	
 	private final long ARP_TIMER_PERIOD = 60000; //ms (== 1 min) 
 			
-	protected IFloodlightProviderService floodlightProvider;
-	protected ITopologyService topology;
+	private IFloodlightProviderService floodlightProvider;
+	private ITopologyService topology;
+	private ILayer3InfoService layer3;
 	
-	protected Map<InetAddress, ArpTableEntry> arpTable;
+	private Map<InetAddress, ArpTableEntry> arpTable;
 
-	protected SetMultimap<InetAddress, ArpRequest> arpRequests;
+	private SetMultimap<InetAddress, ArpRequest> arpRequests;
 	
-	public enum Mode {L2_MODE, L3_MODE}
+	//public enum Mode {L2_MODE, L3_MODE}
 	
-	private Mode mode;
-	private IPatriciaTrie<Interface> interfacePtrie = null;
-	private Collection<Interface> interfaces = null;
-	private MACAddress routerMacAddress = null;
+	//private Mode mode;
+	//private IPatriciaTrie<Interface> interfacePtrie = null;
+	//private Collection<Interface> interfaces = null;
+	//private MACAddress routerMacAddress = null;
 	//private SwitchPort bgpdAttachmentPoint = null;
 	
 	private class ArpRequest {
@@ -98,18 +98,20 @@
 	}
 	
 	public ProxyArpManager(IFloodlightProviderService floodlightProvider,
-				ITopologyService topology){
+				ITopologyService topology, ILayer3InfoService layer3){
 		this.floodlightProvider = floodlightProvider;
 		this.topology = topology;
+		this.layer3 = layer3;
 		
 		arpTable = new HashMap<InetAddress, ArpTableEntry>();
 
 		arpRequests = Multimaps.synchronizedSetMultimap(
 				HashMultimap.<InetAddress, ArpRequest>create());
 		
-		mode = Mode.L2_MODE;
+		//mode = Mode.L2_MODE;
 	}
 	
+	/*
 	public void setL3Mode(IPatriciaTrie<Interface> interfacePtrie, 
 			Collection<Interface> interfaces, MACAddress routerMacAddress) {
 		this.interfacePtrie = interfacePtrie;
@@ -118,6 +120,7 @@
 
 		mode = Mode.L3_MODE;
 	}
+	*/
 	
 	public void startUp() {
 		Timer arpTimer = new Timer();
@@ -225,29 +228,33 @@
 	}
 	
 	protected void handleArpRequest(IOFSwitch sw, OFPacketIn pi, ARP arp) {
-		log.trace("ARP request received for {}", 
-				bytesToStringAddr(arp.getTargetProtocolAddress()));
+		if (log.isTraceEnabled()) {
+			log.trace("ARP request received for {}", 
+					inetAddressToString(arp.getTargetProtocolAddress()));
+		}
 
 		InetAddress target;
-		InetAddress source;
+		//InetAddress source;
 		try {
 			 target = InetAddress.getByAddress(arp.getTargetProtocolAddress());
-			 source = InetAddress.getByAddress(arp.getSenderProtocolAddress());
+			 //source = InetAddress.getByAddress(arp.getSenderProtocolAddress());
 		} catch (UnknownHostException e) {
 			log.debug("Invalid address in ARP request", e);
 			return;
 		}
 		
-		if (mode == Mode.L3_MODE) {
+		//if (mode == Mode.L3_MODE) {
 			
 			//if (originatedOutsideNetwork(source)) {
-			if (originatedOutsideNetwork(sw.getId(), pi.getInPort())) {
+			//if (originatedOutsideNetwork(sw.getId(), pi.getInPort())) {
+			if (layer3.fromExternalNetwork(sw.getId(), pi.getInPort())) {
 				//If the request came from outside our network, we only care if
 				//it was a request for one of our interfaces.
-				if (isInterfaceAddress(target)) {
+				//if (isInterfaceAddress(target)) {
+				if (layer3.isInterfaceAddress(target)) {
 					log.trace("ARP request for our interface. Sending reply {} => {}",
-							target.getHostAddress(), routerMacAddress.toString());
-					sendArpReply(arp, sw.getId(), pi.getInPort(), routerMacAddress.toBytes());
+							target.getHostAddress(), layer3.getRouterMacAddress().toString());
+					sendArpReply(arp, sw.getId(), pi.getInPort(), layer3.getRouterMacAddress().toBytes());
 				}
 				return;
 			}
@@ -268,7 +275,7 @@
 				return;
 			}
 			*/
-		}
+		//}
 		
 		byte[] mac = lookupArpTable(arp.getTargetProtocolAddress());
 		
@@ -285,20 +292,24 @@
 		}
 		else {
 			//We know the address, so send a reply
-			log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
-					bytesToStringAddr(arp.getTargetProtocolAddress()),
-					MACAddress.valueOf(mac).toString(),
-					HexString.toHexString(sw.getId()), pi.getInPort()});
+			if (log.isTraceEnabled()) {
+				log.trace("Sending reply: {} => {} to host at {}/{}", new Object [] {
+						inetAddressToString(arp.getTargetProtocolAddress()),
+						MACAddress.valueOf(mac).toString(),
+						HexString.toHexString(sw.getId()), pi.getInPort()});
+			}
 			
 			sendArpReply(arp, sw.getId(), pi.getInPort(), mac);
 		}
 	}
 	
 	protected void handleArpReply(IOFSwitch sw, OFPacketIn pi, ARP arp){
-		log.trace("ARP reply recieved: {} => {}, on {}/{}", new Object[] { 
-				bytesToStringAddr(arp.getSenderProtocolAddress()),
-				HexString.toHexString(arp.getSenderHardwareAddress()),
-				HexString.toHexString(sw.getId()), pi.getInPort()});
+		if (log.isTraceEnabled()) {
+			log.trace("ARP reply recieved: {} => {}, on {}/{}", new Object[] { 
+					inetAddressToString(arp.getSenderProtocolAddress()),
+					HexString.toHexString(arp.getSenderHardwareAddress()),
+					HexString.toHexString(sw.getId()), pi.getInPort()});
+		}
 		
 		updateArpTable(arp);
 		
@@ -307,6 +318,7 @@
 		try {
 			addr = InetAddress.getByAddress(arp.getSenderProtocolAddress());
 		} catch (UnknownHostException e) {
+			log.debug("Invalid address in ARP request", e);
 			return;
 		}
 		
@@ -349,7 +361,7 @@
 		if (System.currentTimeMillis() - arpEntry.getTimeLastSeen() 
 				> ARP_ENTRY_TIMEOUT){
 			//Entry has timed out so we'll remove it and return null
-			log.debug("Timing out old ARP entry for {}", bytesToStringAddr(ipAddress));
+			log.debug("Timing out old ARP entry for {}", inetAddressToString(ipAddress));
 			arpTable.remove(addr);
 			return null;
 		}
@@ -380,10 +392,14 @@
 	}
 	
 	private void sendArpRequestForAddress(InetAddress ipAddress) {
-		//TODO what should the sender IP address be? Probably not 0.0.0.0
+		//TODO what should the sender IP address and MAC address be if no
+		//IP addresses are configured? Will there ever be a need to send
+		//ARP requests from the controller in that case?
+		//All-zero MAC address doesn't seem to work - hosts don't respond to it
+		
 		byte[] zeroIpv4 = {0x0, 0x0, 0x0, 0x0};
 		byte[] zeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
-		//byte[] bgpdMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x01};
+		byte[] genericNonZeroMac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x01};
 		byte[] broadcastMac = {(byte)0xff, (byte)0xff, (byte)0xff, 
 				(byte)0xff, (byte)0xff, (byte)0xff};
 		
@@ -392,26 +408,39 @@
 		arpRequest.setHardwareType(ARP.HW_TYPE_ETHERNET)
 			.setProtocolType(ARP.PROTO_TYPE_IP)
 			.setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
-			.setProtocolAddressLength((byte)4) //can't find the constant anywhere
+			.setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
 			.setOpCode(ARP.OP_REQUEST)
 			//.setSenderHardwareAddress(bgpdMac)
-			.setSenderHardwareAddress(routerMacAddress.toBytes())
+			//.setSenderHardwareAddress(routerMacAddress.toBytes())
 			//.setSenderProtocolAddress(zeroIpv4)
 			.setTargetHardwareAddress(zeroMac)
 			.setTargetProtocolAddress(ipAddress.getAddress());
 
-		byte[] senderIPAddress = zeroIpv4;
-		if (mode == Mode.L3_MODE) {
-			Interface intf = interfacePtrie.match(new Prefix(ipAddress.getAddress(), 32));
-			if (intf != null) {
-				senderIPAddress = intf.getIpAddress().getAddress();
-			}
+		MACAddress routerMacAddress = layer3.getRouterMacAddress();
+		byte[] senderMacAddress = null;
+		if (routerMacAddress != null) {
+			senderMacAddress = routerMacAddress.toBytes();
 		}
+		else {
+			//TODO hack for now as it's unclear what the MAC address should be
+			senderMacAddress = genericNonZeroMac;
+		}
+		arpRequest.setSenderHardwareAddress(senderMacAddress);
+		
+		byte[] senderIPAddress = zeroIpv4;
+		//if (mode == Mode.L3_MODE) {
+			//Interface intf = interfacePtrie.match(new Prefix(ipAddress.getAddress(), 32));
+		Interface intf = layer3.getOutgoingInterface(ipAddress);
+		if (intf != null) {
+			senderIPAddress = intf.getIpAddress().getAddress();
+		}
+		//}
 		
 		arpRequest.setSenderProtocolAddress(senderIPAddress);
 		
 		Ethernet eth = new Ethernet();
-		eth.setSourceMACAddress(routerMacAddress.toBytes())
+		//eth.setSourceMACAddress(routerMacAddress.toBytes())
+		eth.setSourceMACAddress(senderMacAddress)
 			.setDestinationMACAddress(broadcastMac)
 			.setEtherType(Ethernet.TYPE_ARP)
 			.setPayload(arpRequest);
@@ -425,6 +454,7 @@
 	}
 	private void sendArpRequestToSwitches(InetAddress dstAddress, byte[] arpRequest,
 			long inSwitch, short inPort) {
+		/*
 		if (mode == Mode.L2_MODE) {
 			//log.debug("mode is l2");
 			broadcastArpRequestOutEdge(arpRequest, inSwitch, inPort);
@@ -442,6 +472,25 @@
 						dstAddress.getHostAddress());
 			}
 		}
+		*/
+		if (layer3.hasLayer3Configuration()) {
+			Interface intf = layer3.getOutgoingInterface(dstAddress);
+			if (intf != null) {
+				sendArpRequestOutPort(arpRequest, intf.getDpid(), intf.getPort());
+			}
+			else {
+				//TODO here it should be broadcast out all non-interface edge ports.
+				//I think we can assume that if it's not a request for an external 
+				//network, it's an ARP for a host in our own network. So we want to 
+				//send it out all edge ports that don't have an interface configured
+				//to ensure it reaches all hosts in our network.
+				log.debug("No interface found to send ARP request for {}",
+						dstAddress.getHostAddress());
+			}
+		}
+		else {
+			broadcastArpRequestOutEdge(arpRequest, inSwitch, inPort);
+		}
 	}
 	
 	private void broadcastArpRequestOutEdge(byte[] arpRequest, long inSwitch, short inPort) {
@@ -523,17 +572,30 @@
 		}
 	}
 	
+	private String inetAddressToString(byte[] bytes) {
+		try {
+			return InetAddress.getByAddress(bytes).getHostAddress();
+		} catch (UnknownHostException e) {
+			log.warn("Invalid IP address", e);
+			return "";
+		}
+	}
+	
+	/*
+	 * IProxyArpService methods
+	 */
+	
 	public void sendArpReply(ARP arpRequest, long dpid, short port, byte[] targetMac) {
 		log.trace("Sending reply {} => {} to {}", new Object[] {
-				bytesToStringAddr(arpRequest.getTargetProtocolAddress()),
+				inetAddressToString(arpRequest.getTargetProtocolAddress()),
 				HexString.toHexString(targetMac),
-				bytesToStringAddr(arpRequest.getSenderProtocolAddress())});
+				inetAddressToString(arpRequest.getSenderProtocolAddress())});
 		
 		ARP arpReply = new ARP();
 		arpReply.setHardwareType(ARP.HW_TYPE_ETHERNET)
 			.setProtocolType(ARP.PROTO_TYPE_IP)
 			.setHardwareAddressLength((byte)Ethernet.DATALAYER_ADDRESS_LENGTH)
-			.setProtocolAddressLength((byte)4) //can't find the constant anywhere
+			.setProtocolAddressLength((byte)IPv4.ADDRESS_LENGTH)
 			.setOpCode(ARP.OP_REPLY)
 			.setSenderHardwareAddress(targetMac)
 			.setSenderProtocolAddress(arpRequest.getTargetProtocolAddress())
@@ -578,20 +640,6 @@
 		}
 	}
 
-	//TODO this should be put somewhere more central. I use it in BgpRoute as well.
-	//We need a HexString.toHexString() equivalent.
-	private String bytesToStringAddr(byte[] bytes) {
-		InetAddress addr;
-		try {
-			addr = InetAddress.getByAddress(bytes);
-		} catch (UnknownHostException e) {
-			log.warn(" ", e);
-			return "";
-		}
-		if (addr == null) return "";
-		else return addr.getHostAddress();
-	}
-	
 	@Override
 	public byte[] getMacAddress(InetAddress ipAddress) {
 		return lookupArpTable(ipAddress.getAddress());
@@ -601,10 +649,10 @@
 	public void sendArpRequest(InetAddress ipAddress, IArpRequester requester,
 			boolean retry) {
 		arpRequests.put(ipAddress, new ArpRequest(requester, retry));
-		//storeRequester(ipAddress, requester, retry);
 		
 		//Sanity check to make sure we don't send a request for our own address
-		if (!isInterfaceAddress(ipAddress)) {
+		//if (!isInterfaceAddress(ipAddress)) {
+		if (!layer3.isInterfaceAddress(ipAddress)) {
 			sendArpRequestForAddress(ipAddress);
 		}
 	}
@@ -614,7 +662,7 @@
 	 * that ProxyArpManager could query, rather than having the information 
 	 * embedded in ProxyArpManager. There may be many modules that need L3 information.
 	 */
-	
+	/*
 	private boolean originatedOutsideNetwork(InetAddress source) {
 		Interface intf = interfacePtrie.match(new Prefix(source.getAddress(), 32));
 		if (intf != null) {
@@ -654,4 +702,5 @@
 		Interface intf = interfacePtrie.match(new Prefix(address.getAddress(), 32));
 		return (intf != null && !intf.getIpAddress().equals(address));
 	}
+	*/
 }