}
private void sendMapNotifyMsg(final ByteBuffer inBuffer, final InetAddress inetAddress, int portNumber,
- List<EidLispAddress> cacheValue) {
+ List<EidLispAddress> eids) {
- final String authKey = provideAuthenticateKey(cacheValue);
+ if (eids == null) {
+ LOG.warn("Map-Register Cache: missing EID list when trying to send Map-Notify!");
+ return;
+ }
+
+ final MappingAuthkey authKey = provideAuthenticateKey(eids);
if (authKey != null) {
ByteBuffer outBuffer = transformMapRegisterToMapNotify(inBuffer);
- outBuffer = calculateAndSetNewMAC(outBuffer, authKey);
+ if (authKey.getKeyType() != 0) {
+ outBuffer = calculateAndSetNewMAC(outBuffer, authKey.getKeyString());
+ }
outBuffer.position(0);
lispSbPlugin.handleSerializedLispBuffer(inetAddress, outBuffer, MessageType.MapNotify, portNumber);
+ } else {
+ LOG.error("Map-Register Cache: authentication succeeded, but can't find auth key for sending Map-Notify");
}
}
/**
* Returns null if not all of eids have the same value of authentication key
*/
- private String provideAuthenticateKey(final List<EidLispAddress> eidLispAddresses) {
+ private MappingAuthkey provideAuthenticateKey(final List<EidLispAddress> eidLispAddresses) {
MappingAuthkey firstAuthKey = null;
for (int i = 0; i < eidLispAddresses.size(); i++) {
final Eid eid = eidLispAddresses.get(i).getEid();
}
}
}
- return firstAuthKey.getKeyString();
+ return firstAuthKey;
}