diff --git a/src/types/packet.ts b/src/types/packet.ts index caa4060e..45043308 100644 --- a/src/types/packet.ts +++ b/src/types/packet.ts @@ -365,7 +365,7 @@ export function sendViewPacket( viewgraph: ViewGraph, srcId: DeviceId, rawPacket: EthernetFrame, - sendingIface?: number, + sendingIface: number, ) { const srcMac = rawPacket.source; const dstMac = rawPacket.destination; diff --git a/src/types/view-devices/vNetworkDevice.ts b/src/types/view-devices/vNetworkDevice.ts index cdca924e..90031493 100644 --- a/src/types/view-devices/vNetworkDevice.ts +++ b/src/types/view-devices/vNetworkDevice.ts @@ -168,6 +168,7 @@ export abstract class ViewNetworkDevice extends ViewDevice { : undefined; } + // eslint-disable-next-line @typescript-eslint/no-unused-vars handleDatagram(datagram: IPv4Packet, iface: number) { console.debug("Packet has reach its destination!"); const dstDevice = this.viewgraph.getDeviceByIP(datagram.sourceAddress); @@ -181,16 +182,17 @@ export abstract class ViewNetworkDevice extends ViewDevice { case ICMP_PROTOCOL_NUMBER: { const request: EchoRequest = datagram.payload as EchoRequest; if (dstDevice && request.type === ICMP_REQUEST_TYPE_NUMBER) { - const { src, nextHop, dst } = ViewNetworkDevice.getForwardingData( - this.id, - dstDevice.id, - this.viewgraph, - ); + const { src, nextHop, dst, sendingIface } = + ViewNetworkDevice.getForwardingData( + this.id, + dstDevice.id, + this.viewgraph, + ); const echoReply = new EchoReply(0); const ipPacket = new IPv4Packet(src.ip, dst.ip, echoReply); const frame = new EthernetFrame(src.mac, nextHop.mac, ipPacket); console.debug(`Sending EchoReply to ${dstDevice}`); - sendViewPacket(this.viewgraph, this.id, frame, iface); + sendViewPacket(this.viewgraph, this.id, frame, sendingIface); } break; }