From 0f826cf358148cc3d038203647d7c655058de384 Mon Sep 17 00:00:00 2001 From: mc36 Date: Sun, 22 Dec 2024 17:33:35 +0100 Subject: [PATCH] automatic commit at releng box --- cfg/p4lang2.ini | 2 +- cfg/p4lang5.ini | 2 +- cfg/p4lang6.ini | 2 +- cfg/p4lang7.ini | 2 +- misc/native/p4emu_fwd.h | 20 +++ misc/native/p4emu_msg.h | 63 +++++++++- misc/native/p4emu_tab.h | 5 +- misc/native/p4emu_udp-new.c | 150 ----------------------- src/org/freertr/serv/servP4lang.java | 2 +- src/org/freertr/serv/servP4langConn.java | 66 +++++++++- src/org/freertr/serv/servP4langIfc.java | 2 +- src/rtr.csv | 2 +- src/rtr.html | 2 +- src/rtr8.csv | 2 +- src/rtr8.html | 2 +- 15 files changed, 160 insertions(+), 164 deletions(-) delete mode 100644 misc/native/p4emu_udp-new.c diff --git a/cfg/p4lang2.ini b/cfg/p4lang2.ini index 65a4f13264..d2826ac865 100644 --- a/cfg/p4lang2.ini +++ b/cfg/p4lang2.ini @@ -1,4 +1,4 @@ -dpdk pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp l3tp tmux route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud etherip polka mpolka +dpdk pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp l3tp tmux route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud etherip polka mpolka pwhe qemu-img create -f qcow2 -o backing_file=../img/p4emu.img,backing_fmt=raw $fn$ qemu-system-x86_64 -monitor none -serial stdio -nographic -no-reboot -enable-kvm -cpu host -smp cores=2,threads=1,sockets=1 -drive file=$fn$,format=qcow2,cache=unsafe -m 1024 $nc$ diff --git a/cfg/p4lang5.ini b/cfg/p4lang5.ini index 25c1d8c13d..14d7b15ba5 100644 --- a/cfg/p4lang5.ini +++ b/cfg/p4lang5.ini @@ -1,4 +1,4 @@ -udp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka +udp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka pwhe ../binTmp/p4udp.bin 127.0.0.1 $cp$ 0 127.0.0.1 127.0.0.1 $nc$ diff --git a/cfg/p4lang6.ini b/cfg/p4lang6.ini index a10d4df241..aed0e7c313 100644 --- a/cfg/p4lang6.ini +++ b/cfg/p4lang6.ini @@ -1,4 +1,4 @@ -emudp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka +emudp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka pwhe ../binDsk/qemu-static -L ../binDsk/ ../binDsk/rtr/p4udp.bin 127.0.0.1 $cp$ 0 127.0.0.1 127.0.0.1 $nc$ diff --git a/cfg/p4lang7.ini b/cfg/p4lang7.ini index 4f368b68b5..a5877c503d 100644 --- a/cfg/p4lang7.ini +++ b/cfg/p4lang7.ini @@ -1,4 +1,4 @@ -vgudp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka +vgudp pckout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan ipip macsec ipsec pckoudp openvpn wireguard srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud l3tp tmux etherip polka mpolka pwhe valgrind.bin --suppressions=../misc/valgrind.cfg --exit-on-first-error=yes ../binTmp/p4udp.bin 127.0.0.1 $cp$ 0 127.0.0.1 127.0.0.1 $nc$ diff --git a/misc/native/p4emu_fwd.h b/misc/native/p4emu_fwd.h index 9630910592..35e084cc3c 100644 --- a/misc/native/p4emu_fwd.h +++ b/misc/native/p4emu_fwd.h @@ -830,6 +830,20 @@ void send2neigh(struct packetContext *ctx, struct neigh_entry *neigh_res, int bu putTmuxHeader; putIpv6header(IP_PROTOCOL_TMUX, neigh_res->sip1, neigh_res->sip2, neigh_res->sip3, neigh_res->sip4, neigh_res->dip1, neigh_res->dip2, neigh_res->dip3, neigh_res->dip4); break; + case 23: // pwhe + bufP -= 12; + memcpy(&bufD[bufP], &bufH[0], 12); + bufP -= 4; + tmp = 0x1ff | (neigh_res->dprt << 12); + put32msb(bufD, bufP, tmp); + bufP -= 4; + tmp = 0xff | (neigh_res->sprt << 12); + put32msb(bufD, bufP, tmp); + ethtyp = ETHERTYPE_MPLS_UCAST; + bufP -= 2; + put16msb(bufD, bufP, ethtyp); + memcpy(&bufH[0], &neigh_res->mac2, 12); + break; default: doDropper; } @@ -1621,6 +1635,12 @@ void processDataPacket(struct packetContext *ctx, int bufS, int prt) { put32msb(bufD, bufP, label); neigh_ntry.id = mpls_res->nexthop; goto ethtyp_tx; + case 10: // pwhe + memcpy(&bufH[0], &bufD[bufP], 12); + memcpy(&bufD[preBuff], &bufH[0], 12); + bufP += 12; + prt = mpls_res->port; + goto ethtyp_rx; } doDropper; case ETHERTYPE_VLAN: // dot1q diff --git a/misc/native/p4emu_msg.h b/misc/native/p4emu_msg.h index 320135821b..cdaaeff040 100644 --- a/misc/native/p4emu_msg.h +++ b/misc/native/p4emu_msg.h @@ -150,7 +150,7 @@ void readAcl6(struct acl6_entry *acl6_ntry, char**arg) { char* getCapas() { - return "packout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp l3tp tmux route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan etherip ipip pckoudp srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud mpolka polka" + return "packout punting copp acl nat vlan bundle bridge pppoe hairpin gre l2tp l3tp tmux route mpls vpls evpn eompls gretap pppoetap l2tptap l3tptap tmuxtap vxlan etherip ipip pckoudp srv6 pbr qos flwspc mroute duplab bier amt nsh racl inspect sgt vrfysrc gtp loconn tcpmss pmtud mpolka polka pwhe" #ifndef HAVE_NOCRYPTO " macsec ipsec openvpn wireguard" @@ -369,6 +369,14 @@ int doOneCommand(struct packetContext *ctx, unsigned char* buf) { else table_add(&mpls_table, &mpls_ntry); return 0; } + if (strcmp(arg[0], "pwhelab") == 0) { + mpls_ntry.label = atoi(arg[2]); + mpls_ntry.port = atoi(arg[3]); + mpls_ntry.command = 10; + if (del == 0) table_del(&mpls_table, &mpls_ntry); + else table_add(&mpls_table, &mpls_ntry); + return 0; + } if (strcmp(arg[0], "cpulabel") == 0) { mpls_ntry.label = atoi(arg[2]); mpls_ntry.command = 6; @@ -969,6 +977,31 @@ int doOneCommand(struct packetContext *ctx, unsigned char* buf) { else table_add(&neigh_table, &neigh_ntry); return 0; } + if (strcmp(arg[0], "pwhenei4") == 0) { + route4_ntry.nexthop = atoi(arg[2]); + inet_pton(AF_INET, arg[3], buf2); + vrf2rib_ntry.vrf = atoi(arg[5]); + vrf2rib_res = vrf2rib_init4; + route4_ntry.addr[0] = get32msb(buf2, 0); + route4_ntry.mask = 32; + route4_ntry.command = 1; + neigh_ntry.id = route4_ntry.nexthop; + neigh_ntry.vrf = vrf2rib_ntry.vrf; + neigh_ntry.port = atoi(arg[7]); + neigh_ntry.aclport = atoi(arg[8]); + neigh_ntry.command = 23; + str2mac(&neigh_ntry.macs[0], arg[4]); + str2mac(&neigh_ntry.macs[6], arg[6]); + str2mac(&neigh_ntry.mac2[0], arg[9]); + str2mac(&neigh_ntry.mac2[6], arg[10]); + neigh_ntry.sprt = atoi(arg[11]); + neigh_ntry.dprt = atoi(arg[12]); + if (del == 0) tree_del(&vrf2rib_res->rou, &route4_ntry); + else tree_add(&vrf2rib_res->rou, &route4_ntry); + if (del == 0) table_del(&neigh_table, &neigh_ntry); + else table_add(&neigh_table, &neigh_ntry); + return 0; + } if (strcmp(arg[0], "myaddr6") == 0) { inet_pton(AF_INET6, arg[2], buf2); vrf2rib_ntry.vrf = atoi(arg[5]); @@ -1120,6 +1153,34 @@ int doOneCommand(struct packetContext *ctx, unsigned char* buf) { else table_add(&neigh_table, &neigh_ntry); return 0; } + if (strcmp(arg[0], "pwhenei6") == 0) { + route6_ntry.nexthop = atoi(arg[2]); + inet_pton(AF_INET6, arg[3], buf2); + vrf2rib_ntry.vrf = atoi(arg[5]); + vrf2rib_res = vrf2rib_init6; + route6_ntry.addr[0] = get32msb(buf2, 0); + route6_ntry.addr[1] = get32msb(buf2, 4); + route6_ntry.addr[2] = get32msb(buf2, 8); + route6_ntry.addr[3] = get32msb(buf2, 12); + route6_ntry.mask = 128; + route6_ntry.command = 1; + neigh_ntry.id = route6_ntry.nexthop; + neigh_ntry.vrf = vrf2rib_ntry.vrf; + neigh_ntry.port = atoi(arg[7]); + neigh_ntry.aclport = atoi(arg[8]); + neigh_ntry.command = 23; + str2mac(&neigh_ntry.macs[0], arg[4]); + str2mac(&neigh_ntry.macs[6], arg[6]); + str2mac(&neigh_ntry.mac2[0], arg[9]); + str2mac(&neigh_ntry.mac2[6], arg[10]); + neigh_ntry.sprt = atoi(arg[11]); + neigh_ntry.dprt = atoi(arg[12]); + if (del == 0) tree_del(&vrf2rib_res->rou, &route6_ntry); + else tree_add(&vrf2rib_res->rou, &route6_ntry); + if (del == 0) table_del(&neigh_table, &neigh_ntry); + else table_add(&neigh_table, &neigh_ntry); + return 0; + } if (strcmp(arg[0], "mysrv4") == 0) { inet_pton(AF_INET6, arg[3], buf2); vrf2rib_ntry.vrf = atoi(arg[2]); diff --git a/misc/native/p4emu_tab.h b/misc/native/p4emu_tab.h index 1db4001f0b..da70c9bdde 100644 --- a/misc/native/p4emu_tab.h +++ b/misc/native/p4emu_tab.h @@ -87,7 +87,7 @@ struct table_head nsh_table; struct mpls_entry { int label; - int command; // 1=vrf, 2=pop, 3=swap, 4=xconn, 5=vpls, 6=punt, 7=dup, 8=bier, 9=push + int command; // 1=vrf, 2=pop, 3=swap, 4=xconn, 5=vpls, 6=punt, 7=dup, 8=bier, 9=push, 10=pwhe long pack; long byte; int nexthop; @@ -263,13 +263,14 @@ struct route6_entry { struct neigh_entry { int id; int vrf; - int command; // 1=rawip, 2=pppoe, 3=gre4, 4=gre6, 5=l2tp4, 6=l2tp6, 7=ipip4, 8=ipip6, 9=esp4, 10=esp6, 11=ovpn4, 12=ovpn6, 13=wg4. 14=wg6, 15=amt4, 16=amt6, 17=gtp4, 18=gtp6, 19=l3tp4, 20=l3tp6, 21=tmux4, 22=tmux6 + int command; // 1=rawip, 2=pppoe, 3=gre4, 4=gre6, 5=l2tp4, 6=l2tp6, 7=ipip4, 8=ipip6, 9=esp4, 10=esp6, 11=ovpn4, 12=ovpn6, 13=wg4. 14=wg6, 15=amt4, 16=amt6, 17=gtp4, 18=gtp6, 19=l3tp4, 20=l3tp6, 21=tmux4, 22=tmux6, 23=pwhe long pack; long byte; int port; int aclport; int tid; unsigned char macs[12]; + unsigned char mac2[12]; int sip1; int sip2; int sip3; diff --git a/misc/native/p4emu_udp-new.c b/misc/native/p4emu_udp-new.c deleted file mode 100644 index 1999dc65aa..0000000000 --- a/misc/native/p4emu_udp-new.c +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "p4emu_hdr.h" - - -struct sockaddr_in peers[maxPorts]; -int sockets[maxPorts]; -int commandSock; -int ifaceId[maxPorts]; - - -void sendPack(unsigned char *bufD, int bufS, int port) { - sendto(sockets[port], bufD, bufS, 0, (struct sockaddr *) &peers[port], sizeof(peers[port])); -} - - -void setMtu(int port, int mtu) { -} - -void setState(int port, int sta) { -} - -int getState(int port) { - return 1; -} - - -void getStats(int port, unsigned char*buf, unsigned char*pre, int*len) { -} - -void err(char*buf) { - printf("%s\n", buf); - _exit(1); -} - - - -int main(int argc, char **argv) { - dataPorts = (argc - 6) / 2; - if (dataPorts < 2) err("using: dp [lportN] [rportN]"); - if (dataPorts > maxPorts) dataPorts = maxPorts; - struct sockaddr_in addrLoc; - memset(&addrLoc, 0, sizeof(addrLoc)); - if (inet_aton(argv[4], &addrLoc.sin_addr) == 0) err("bad laddr address"); - addrLoc.sin_family = AF_INET; - for (int i = 0; i < dataPorts; i++) { - unsigned char buf[1024]; - sprintf((char*)&buf[0], "udport-%i", i); - initIface(i, (char*)&buf[0]); - memset(&peers[i], 0, sizeof(peers[i])); - if (inet_aton(argv[5], &peers[i].sin_addr) == 0) err("bad raddr address"); - addrLoc.sin_port = htons(atoi(argv[(i*2)+6])); - peers[i].sin_family = AF_INET; - peers[i].sin_port = htons(atoi(argv[(i*2)+7])); - if ((sockets[i] = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) err("unable to open socket"); - if (bind(sockets[i], (struct sockaddr *) &addrLoc, sizeof(addrLoc)) < 0) err("failed to bind socket"); - ifaceId[i] = i; - } - if (initTables() != 0) err("error initializing tables"); - int port = atoi(argv[2]); - memset(&addrLoc, 0, sizeof(addrLoc)); - if (inet_aton(argv[1], &addrLoc.sin_addr) == 0) err("bad addr address"); - addrLoc.sin_family = AF_INET; - addrLoc.sin_port = htons(port); - printf("connecting %s %i.\n", inet_ntoa(addrLoc.sin_addr), port); - commandSock = socket(AF_INET, SOCK_STREAM, 0); - if (commandSock < 0) err("unable to open socket"); - if (connect(commandSock, (struct sockaddr*)&addrLoc, sizeof(addrLoc)) < 0) err("failed to connect socket"); - cpuPort = atoi(argv[3]); - printf("cpu port is #%i of %i...\n", cpuPort, dataPorts); - - struct packetContext ctx; - if (initContext(&ctx) != 0) err("error initializing context"); - struct sockaddr_in addrTmp; - unsigned int addrLen; - int bufS; - struct pollfd fds[maxPorts+2]; - FILE *commandr = fdopen(commandSock, "r"); - if (commandr == NULL) err("failed to open file"); - FILE *commands = fdopen(commandSock, "w"); - if (commands == NULL) err("failed to open file"); - fprintf(commands, "platform %sudp\r\n", platformBase); - fprintf(commands, "capabilities %s\r\n", getCapas()); - for (int i = 0; i < dataPorts; i++) fprintf(commands, "portname %i %s\r\n", i, ifaceName[i]); - fprintf(commands, "cpuport %i\r\n", cpuPort); - fprintf(commands, "dynrange %i 1073741823\r\n", maxPorts); - fprintf(commands, "vrfrange 1 1073741823\r\n"); - fprintf(commands, "neirange 4096 1073741823\r\n"); - fprintf(commands, "nomore\r\n"); - fflush(commands); - - int rnd = 0; - for (;;) { - for (int i = 0; i < dataPorts; i++) { - fds[i].fd = sockets[i]; - fds[i].events = POLLIN; - fds[i].revents = 0; - } - fds[dataPorts].fd = commandSock; - fds[dataPorts].events = POLLIN; - fds[dataPorts].revents = 0; - fds[dataPorts+1].fd = STDIN_FILENO; - fds[dataPorts+1].events = POLLIN; - fds[dataPorts+1].revents = 0; - if (poll(fds, dataPorts+2, 100) < 0) err("error in poll"); - int don = 0; - for (int i = 0; i < dataPorts; i++) { - if ((fds[i].revents&POLLERR) != 0) err("error on socket"); - if ((fds[i].revents&POLLHUP) != 0) err("hangup on socket"); - if ((fds[i].revents&POLLIN) == 0) continue; - don++; - addrLen = sizeof(addrTmp); - bufS = totBuff - preBuff; - bufS = recvfrom(sockets[i], &ctx.bufD[preBuff], bufS, 0, (struct sockaddr *) &addrTmp, &addrLen); - if (bufS < 0) err("error reading socket"); - ctx.port = i; - if (i == cpuPort) { - processCpuPack(&ctx, bufS); - } else { - processDataPacket(&ctx, bufS, i); - } - } - if (don == 0) { - doStatRound(commands, rnd); - rnd++; - } - if ((fds[dataPorts].revents&POLLERR) != 0) err("error on socket"); - if ((fds[dataPorts].revents&POLLHUP) != 0) err("hangup on socket"); - if ((fds[dataPorts].revents&POLLIN) != 0) { - memset(ctx.bufD, 0, totBuff); - if (fgets((char*)&ctx.bufD[0], totBuff, commandr) == NULL) err("error reading socket"); - if (doOneCommand(&ctx, &ctx.bufD[0]) != 0) err("command exited"); - } - if ((fds[dataPorts+1].revents&POLLERR) != 0) err("error on socket"); - if ((fds[dataPorts+1].revents&POLLHUP) != 0) err("hangup on socket"); - if ((fds[dataPorts+1].revents&POLLIN) != 0) { - memset(ctx.bufD, 0, totBuff); - scanf("%1023s", &ctx.bufD[0]); - if (doConsoleCommand(&ctx.bufD[0]) != 0) err("console exited"); - } - } -} diff --git a/src/org/freertr/serv/servP4lang.java b/src/org/freertr/serv/servP4lang.java index 1c89314e20..1c320e3ef9 100644 --- a/src/org/freertr/serv/servP4lang.java +++ b/src/org/freertr/serv/servP4lang.java @@ -686,7 +686,7 @@ public boolean srvCfgStr(cmds cmd) { cmd.error("no need to export subinterface"); return false; } - if ((ifc.type != tabRouteIface.ifaceType.sdn) && (ifc.type != tabRouteIface.ifaceType.bundle) && (ifc.type != tabRouteIface.ifaceType.bridge) && (ifc.type != tabRouteIface.ifaceType.dialer) && (ifc.type != tabRouteIface.ifaceType.hairpin) && (ifc.type != tabRouteIface.ifaceType.tunnel) && (ifc.type != tabRouteIface.ifaceType.virtppp) && (ifc.type != tabRouteIface.ifaceType.template)) { + if ((ifc.type != tabRouteIface.ifaceType.sdn) && (ifc.type != tabRouteIface.ifaceType.bundle) && (ifc.type != tabRouteIface.ifaceType.bridge) && (ifc.type != tabRouteIface.ifaceType.dialer) && (ifc.type != tabRouteIface.ifaceType.hairpin) && (ifc.type != tabRouteIface.ifaceType.tunnel) && (ifc.type != tabRouteIface.ifaceType.virtppp) && (ifc.type != tabRouteIface.ifaceType.pweth) && (ifc.type != tabRouteIface.ifaceType.template)) { cmd.error("not p4lang interface"); return false; } diff --git a/src/org/freertr/serv/servP4langConn.java b/src/org/freertr/serv/servP4langConn.java index 61f4b21e01..8a136fc5de 100644 --- a/src/org/freertr/serv/servP4langConn.java +++ b/src/org/freertr/serv/servP4langConn.java @@ -3502,6 +3502,62 @@ private void doNeighs(boolean ipv4, servP4langIfc ifc, ipIfc ipi) { ifc.sentPppoe = ses; return; } + int ll = 0; + int lr = 0; + servP4langNei hop = null; + if (ifc.ifc.type == tabRouteIface.ifaceType.pweth) { + if (ifc.ifc.pwhe == null) { + return; + } + if (ifc.ifc.pwhe.pwom == null) { + return; + } + ll = ifc.ifc.pwhe.pwom.getLabelLoc(); + if (ll < 0) { + if (ifc.sentLabel < 0) { + return; + } + lower.sendLine("pwhelab_del " + ifc.sentLabel + " " + ifc.id); + ifc.sentLabel = -1; + return; + } + if (ll != ifc.sentLabel) { + String a; + if (ifc.sentLabel < 0) { + a = "add"; + } else { + a = "mod"; + } + lower.sendLine("pwhelab_" + a + " " + ll + " " + ifc.id); + ifc.sentLabel = ll; + } + lr = ifc.ifc.pwhe.pwom.getLabelRem(); + if (lr < 0) { + return; + } + addrIP adr = ifc.ifc.pwhe.pwom.getRemote(); + if (adr == null) { + return; + } + ipFwd ofwd = ifc.ifc.pwhe.pwom.vrf.getFwd(adr); + servP4langVrf ovrf = lower.findVrf(ofwd); + if (ovrf == null) { + return; + } + tabRouteEntry ntry = ofwd.actualU.route(adr); + ntry = lower.convRou(ntry, false); + if (ntry == null) { + return; + } + if (ntry.best.iface == null) { + return; + } + hop = lower.findNei(ntry.best.iface, ntry.best.nextHop); + if (hop == null) { + return; + } + ll = servP4langUtil.getLabel(ntry); + } String afi; if (ipv4) { afi = "4"; @@ -3540,6 +3596,10 @@ private void doNeighs(boolean ipv4, servP4langIfc ifc, ipIfc ipi) { outIfc = oif.id; old.viaI = oif; } + if (hop != null) { + old.viaI = hop.getVia(); + outIfc = old.viaI.id; + } String act; if (added || (old.mac == null)) { act = "add"; @@ -3551,7 +3611,11 @@ private void doNeighs(boolean ipv4, servP4langIfc ifc, ipIfc ipi) { } old.mac = ntry.mac; old.sentIfc = outIfc; - lower.sendLine("neigh" + afi + "_" + act + " " + old.id + " " + old.adr + " " + old.mac.toEmuStr() + " " + vrf.id + " " + ifc.getMac().toEmuStr() + " " + old.sentIfc); + if (hop != null) { + lower.sendLine("pwhenei" + afi + "_" + act + " " + old.id + " " + old.adr + " " + old.mac.toEmuStr() + " " + vrf.id + " " + ifc.getMac().toEmuStr() + " " + old.sentIfc + " " + ifc.id + " " + hop.mac.toEmuStr() + " " + old.viaI.getMac().toEmuStr() + " " + ll + " " + lr); + } else { + lower.sendLine("neigh" + afi + "_" + act + " " + old.id + " " + old.adr + " " + old.mac.toEmuStr() + " " + vrf.id + " " + ifc.getMac().toEmuStr() + " " + old.sentIfc); + } } } diff --git a/src/org/freertr/serv/servP4langIfc.java b/src/org/freertr/serv/servP4langIfc.java index f18faa1b46..3364aee7c8 100644 --- a/src/org/freertr/serv/servP4langIfc.java +++ b/src/org/freertr/serv/servP4langIfc.java @@ -421,7 +421,7 @@ protected boolean suppressState() { if (ifc == null) { return true; } - return (master != null) || (ifc.type == tabRouteIface.ifaceType.bundle) || (ifc.type == tabRouteIface.ifaceType.bridge) || (ifc.type == tabRouteIface.ifaceType.dialer) || (ifc.type == tabRouteIface.ifaceType.hairpin) || (ifc.type == tabRouteIface.ifaceType.tunnel) || (ifc.type == tabRouteIface.ifaceType.virtppp); + return (master != null) || (ifc.type == tabRouteIface.ifaceType.bundle) || (ifc.type == tabRouteIface.ifaceType.bridge) || (ifc.type == tabRouteIface.ifaceType.dialer) || (ifc.type == tabRouteIface.ifaceType.hairpin) || (ifc.type == tabRouteIface.ifaceType.tunnel) || (ifc.type == tabRouteIface.ifaceType.virtppp) || (ifc.type == tabRouteIface.ifaceType.pweth); } /** diff --git a/src/rtr.csv b/src/rtr.csv index 9e71008504..5bbd6b6d31 100644 --- a/src/rtr.csv +++ b/src/rtr.csv @@ -1,6 +1,6 @@ url;file;result;test -;-;-;freeRouter v24.12.22-cur, done by sprscc13@mrn0b0dy. --;-;-;2024-12-22 12:07:29, took 00:14:59, with 50 workers, on 3558 cases, 0 failed, 0 traces, 2 retries +-;-;-;2024-12-22 15:44:31, took 00:14:38, with 50 workers, on 3558 cases, 0 failed, 0 traces, 4 retries -;-;-;./rtr.bin http://sources.freertr.org/cfg/basic01.tst;basic01.tst;success;dummy test http://sources.freertr.org/cfg/basic02.tst;basic02.tst;success;interface with slot diff --git a/src/rtr.html b/src/rtr.html index b081bb0586..c920c3980a 100644 --- a/src/rtr.html +++ b/src/rtr.html @@ -10,7 +10,7 @@ tester release: freeRouter v24.12.22-cur, done by sprscc13@mrn0b0dy.
-tested: 2024-12-22 12:07:29, took 00:14:59, with 50 workers, on 3558 cases, 0 failed, 0 traces, 2 retries
+tested: 2024-12-22 15:44:31, took 00:14:38, with 50 workers, on 3558 cases, 0 failed, 0 traces, 4 retries
jvm: ./rtr.bin

diff --git a/src/rtr8.csv b/src/rtr8.csv index 49974defac..bd70c9998b 100644 --- a/src/rtr8.csv +++ b/src/rtr8.csv @@ -1,6 +1,6 @@ url;file;result;test -;-;-;freeRouter v24.12.22-cur, done by sprscc13@mrn0b0dy. --;-;-;2024-12-22 12:17:42, took 00:09:52, with 50 workers, on 630 cases, 0 failed, 0 traces, 0 retries +-;-;-;2024-12-22 15:54:32, took 00:09:40, with 50 workers, on 630 cases, 0 failed, 0 traces, 1 retries -;-;-;./rtr.bin http://sources.freertr.org/cfg/p4lang-acl001.tst;p4lang-acl001.tst;success;p4lang: copp http://sources.freertr.org/cfg/p4lang-acl002.tst;p4lang-acl002.tst;success;p4lang: ingress access list diff --git a/src/rtr8.html b/src/rtr8.html index fdb8aafa17..785e83d268 100644 --- a/src/rtr8.html +++ b/src/rtr8.html @@ -10,7 +10,7 @@ tester release: freeRouter v24.12.22-cur, done by sprscc13@mrn0b0dy.
-tested: 2024-12-22 12:17:42, took 00:09:52, with 50 workers, on 630 cases, 0 failed, 0 traces, 0 retries
+tested: 2024-12-22 15:54:32, took 00:09:40, with 50 workers, on 630 cases, 0 failed, 0 traces, 1 retries
jvm: ./rtr.bin

fileresulttest
fileresulttest