fix ARP (single onos instance & multiple onos instances)
1. make sure that ARP requests coming from host in a LAN
are not broadcasted to all other edge ports (other ASes)
2. make sure the ARP requests from BGPd host can be singlecast
to other ASes
3. add a 'get external network switch ports' function
4. make the arp work for both single onos instance & multiple
onos instances
5. add a switch ports blacklist. Arp requests are not to be sent
to those switch ports on this list.
Change-Id: I4ffdd73e2ad202517c54690a86109cfa1fbe400f
diff --git a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
index cfdd9c1..197b40d 100644
--- a/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/apps/proxyarp/ProxyArpManager.java
@@ -404,13 +404,17 @@
}
InetAddress target;
+ InetAddress sender;
try {
target = InetAddress.getByAddress(arp.getTargetProtocolAddress());
+ sender = InetAddress.getByAddress(arp.getSenderProtocolAddress());
+
} catch (UnknownHostException e) {
log.debug("Invalid address in ARP request", e);
return;
}
+ // Handle ARP from external network
if (configService.fromExternalNetwork(dpid, inPort)) {
// If the request came from outside our network, we only care if
// it was a request for one of our interfaces.
@@ -420,6 +424,7 @@
target.getHostAddress(),
configService.getRouterMacAddress());
+ //TODO: learn MAC address dynamically rather than from configuration
sendArpReply(arp, dpid, inPort,
configService.getRouterMacAddress());
}
@@ -427,6 +432,17 @@
return;
}
+ // Handle ARP to external network
+ if (configService.inConnectedNetwork(target)
+ && configService.isInterfaceAddress(sender)) {
+ SwitchPort switchPort =
+ configService.getOutgoingInterface(target).getSwitchPort();
+ arpRequests.put(target, new ArpRequest(
+ new HostArpRequester(arp, dpid, inPort), false));
+ packetService.sendPacket(eth, switchPort);
+ return;
+ }
+
//MACAddress mac = arpCache.lookup(target);
arpRequests.put(target, new ArpRequest(
@@ -444,7 +460,7 @@
}
// We don't know the device so broadcast the request out
- packetService.broadcastPacketOutEdge(eth,
+ packetService.broadcastPacketOutInternalEdge(eth,
new SwitchPort(dpid, inPort));
} else {
// Even if the device exists in our database, we do not reply to
@@ -468,7 +484,7 @@
" - broadcasting", macAddress);
}
- packetService.broadcastPacketOutEdge(eth,
+ packetService.broadcastPacketOutInternalEdge(eth,
new SwitchPort(dpid, inPort));
} else {
for (Port portObject : outPorts) {