private SimpleMapCache smc;
private AuthenticationKeyDataListener authenticationKeyDataListener;
private DataStoreBackEnd dsbe;
- private boolean isReadFromChannelEnabled = true;
public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
this.lispSbPlugin = lispSbPlugin;
handleEncapsulatedControlMessage(inBuffer, msg.sender().getAddress());
} else if (lispType == MessageType.MapRequest) {
LOG.trace("Received packet of type Map-Request");
- handleMapRequest(inBuffer, msg.sender().getPort());
+ handleMapRequest(inBuffer, msg.sender().getAddress(), msg.sender().getPort());
} else if (lispType == MessageType.MapRegister) {
LOG.trace("Received packet of type Map-Register");
handleMapRegister(inBuffer, msg.sender().getAddress(), msg.sender().getPort());
private void handleEncapsulatedControlMessage(ByteBuffer inBuffer, InetAddress sourceAddress) {
try {
- handleMapRequest(inBuffer, extractEncapsulatedSourcePort(inBuffer));
+ handleMapRequest(inBuffer, sourceAddress, extractEncapsulatedSourcePort(inBuffer));
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len="
+ inBuffer.capacity() + ")", re);
}
}
- private void handleMapRequest(ByteBuffer inBuffer, int port) {
+ private void handleMapRequest(ByteBuffer inBuffer, InetAddress sourceAddress, int port) {
try {
- MapRequest request = MapRequestSerializer.getInstance().deserialize(inBuffer);
+ MapRequest request = MapRequestSerializer.getInstance().deserialize(inBuffer, sourceAddress);
InetAddress finalSourceAddress = MapRequestUtil.selectItrRloc(request);
if (finalSourceAddress == null) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request, no ITR Rloc found!");
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
- if (isReadFromChannelEnabled) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
- msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
- }
- handlePacket(msg);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+ msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
}
+ handlePacket(msg);
}
@Override
dsbe = new DataStoreBackEnd(dataBroker);
}
- public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
- this.isReadFromChannelEnabled = isReadFromChannelEnabled;
- }
-
public void setMapRegisterCacheTimeout(long mapRegisterCacheTimeout) {
this.mapRegisterCacheTimeout = mapRegisterCacheTimeout;
}
Object lispType = MessageType.forValue((int) (ByteUtil.getUnsignedByte(inBuffer, LispMessage.Pos.TYPE) >> 4));
if (lispType == MessageType.MapRequest) {
LOG.trace("Received packet of type MapRequest for xTR");
- handleMapRequest(inBuffer);
+ handleMapRequest(inBuffer, packet.sender().getAddress());
} else if (lispType == MessageType.MapReply){
LOG.trace("Received packet of type MapReply for xTR");
handleMapReply(inBuffer);
}
}
- private void handleMapRequest(ByteBuffer inBuffer) {
+ private void handleMapRequest(ByteBuffer inBuffer, InetAddress sourceAddress) {
try {
- MapRequest request = MapRequestSerializer.getInstance().deserialize(inBuffer);
+ MapRequest request = MapRequestSerializer.getInstance().deserialize(inBuffer, sourceAddress);
InetAddress finalSourceAddress = MapRequestUtil.selectItrRloc(request);
if (finalSourceAddress == null) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request, no ITR Rloc found!");
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
if (LOG.isTraceEnabled()) {
- LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+ LOG.trace("Received xTR UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
}
handlePacket(msg);