diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2022-01-31 23:16:31 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-11-13 00:17:57 +0100 |
commit | 88f43944c915be3cb824a8ffa4f2995666b73486 (patch) | |
tree | f38d9c2b7fede5ec46e8df042afa36ce66819110 /src/main/java/com/lumaserv/bgp/BGPServer.java | |
parent | 9f35136d97673b825fb51c2e1c7067881a3d6820 (diff) |
Implent outgoing BGPUpdate and some attributes
Diffstat (limited to 'src/main/java/com/lumaserv/bgp/BGPServer.java')
-rw-r--r-- | src/main/java/com/lumaserv/bgp/BGPServer.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/com/lumaserv/bgp/BGPServer.java b/src/main/java/com/lumaserv/bgp/BGPServer.java index 27019b6..63c0765 100644 --- a/src/main/java/com/lumaserv/bgp/BGPServer.java +++ b/src/main/java/com/lumaserv/bgp/BGPServer.java @@ -45,7 +45,7 @@ public class BGPServer implements Runnable { BGPPacket packet = BGPPacket.read(socket.getInputStream()); if(packet.getType() != BGPPacket.Type.OPEN) continue; - BGPOpen request = new BGPOpen(packet.getMessage()); + BGPOpen request = (BGPOpen)packet.getMessage(); BGPSessionConfiguration config = sessionConfigurations.stream() .filter(c -> c.getRemoteAs() == request.getAsn()) .findFirst() @@ -60,7 +60,7 @@ public class BGPServer implements Runnable { .setVersion(request.getVersion()) .setIdentifier(config.getLocalIdentifier()); try { - socket.getOutputStream().write(new BGPPacket().setType(BGPPacket.Type.OPEN).setMessage(response.build()).build()); + socket.getOutputStream().write(new BGPPacket().setType(BGPPacket.Type.OPEN).setMessage(response).build()); } catch (IOException e) { e.printStackTrace(); } @@ -87,7 +87,7 @@ public class BGPServer implements Runnable { .setHoldTime(holdTime) .setVersion(version) .setIdentifier(config.getLocalIdentifier()); - socket.getOutputStream().write(new BGPPacket().setType(BGPPacket.Type.OPEN).setMessage(request.build()).build()); + socket.getOutputStream().write(new BGPPacket().setType(BGPPacket.Type.OPEN).setMessage(request).build()); System.out.println("Sent open"); @@ -100,10 +100,10 @@ System.out.println("Bad open"); return false; } System.out.println("Received open"); - BGPOpen response = new BGPOpen(packet.getMessage()); + BGPOpen response = (BGPOpen)packet.getMessage(); if(config.getRemoteAs() != response.getAsn()) { // TODO shutdown, close -System.out.println("Bad asn"); +System.out.println("Bad asn:" + config.getRemoteAs() + "!=" + response.getAsn()); return false; } |