forked from KNEMC/KLALB
修复滑动窗口出现负数的bug
This commit is contained in:
@@ -61,7 +61,7 @@ public class SRv6Router {
|
||||
|
||||
// public static final int MTU = 16384;
|
||||
public static final int MTU = 16384; // 最大传输单元
|
||||
public static final int MAX_REROUTE_COUNT = 2;// 最大重路由次数
|
||||
public static final int MAX_REROUTE_COUNT = 1;// 最大重路由次数
|
||||
|
||||
private static final int IPv6_BITS = 128; // IPv6地址位数
|
||||
|
||||
@@ -575,7 +575,7 @@ public class SRv6Router {
|
||||
if (srhh != null) {
|
||||
processSRv6Packet(linkfrom, iPv6Packet, ri, srhh); // SRv6特殊处理
|
||||
} else {
|
||||
sendPacketToRouteItem(iPv6Packet, ri);
|
||||
sendPacketToRouteItem(linkfrom,iPv6Packet, ri);
|
||||
}
|
||||
} else { // 普通链路处理
|
||||
// 检查重路由计数
|
||||
@@ -590,22 +590,22 @@ public class SRv6Router {
|
||||
|
||||
if (hop > 0) { // TTL有效
|
||||
iPv6Packet.setHopLimit(hop); // 更新TTL
|
||||
sendPacketToRouteItem(iPv6Packet, ri); // 发送数据包
|
||||
sendPacketToRouteItem(linkfrom,iPv6Packet, ri); // 发送数据包
|
||||
} else {
|
||||
sendTTLExceedPacket(iPv6Packet); // TTL超时
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPacketToRouteItem(IPv6Packet iPv6Packet, RouteItem ri) throws IOException {
|
||||
private void sendPacketToRouteItem(IPv6NetworkLink linkfrom,IPv6Packet iPv6Packet, RouteItem ri) throws IOException {
|
||||
if (iPv6Packet.getPayload() instanceof ICMPv6PostcardPacket && ri.getDestlink().isLoopBack()) {
|
||||
onPostcardReceive(iPv6Packet);
|
||||
onPostcardReceive(linkfrom,iPv6Packet);
|
||||
} else {
|
||||
ri.getDestlink().sendPacket(iPv6Packet, ri.getNexthop());
|
||||
}
|
||||
}
|
||||
|
||||
private void onPostcardReceive(IPv6Packet postcards) {
|
||||
private void onPostcardReceive(IPv6NetworkLink linkfrom,IPv6Packet postcards) {
|
||||
ICMPv6PostcardPacket postcardsi = (ICMPv6PostcardPacket) postcards.getPayload();
|
||||
for (PostcardEntry postcard : postcardsi.getPostcards()) {
|
||||
IPv6Address sid = postcard.getSID();
|
||||
@@ -616,7 +616,7 @@ public class SRv6Router {
|
||||
if (ri.getNexthop().equals(sid)) {
|
||||
if (ri.getDestlink() instanceof KLALBRemoteLink) {
|
||||
KLALBRemoteLink rem = (KLALBRemoteLink) ri.getDestlink();
|
||||
rem.onPostcardReceive(postcard);
|
||||
rem.onPostcardReceive(linkfrom,postcard);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -652,7 +652,7 @@ public class SRv6Router {
|
||||
|
||||
|
||||
if (srhh.getSegmentsLeft() <= 0) { // 所有段已处理完毕
|
||||
sendPacketToRouteItem(iPv6Packet, ri);
|
||||
sendPacketToRouteItem(linkfrom,iPv6Packet, ri);
|
||||
} else {
|
||||
if (iPv6Packet.getRouteCounter().get()<=0) {
|
||||
// 重路由不处理
|
||||
@@ -904,7 +904,7 @@ public class SRv6Router {
|
||||
linkTabel.add(inLoopBack); // 添加到链路表
|
||||
this.srhInserter=new SRHInsertNetworkLink(this,networkGroup);
|
||||
linkTabel.add(srhInserter);
|
||||
KLALBScheduler.getScheduler().scheduleAtFixedRate(new Runnable() {
|
||||
KLALBScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user