Skip to content

Commit

Permalink
automatic commit at releng box
Browse files Browse the repository at this point in the history
  • Loading branch information
mc36 committed Jan 27, 2025
1 parent f54b6ed commit 243264a
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 62 deletions.
12 changes: 6 additions & 6 deletions misc/native/p4emu_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1661,16 +1661,16 @@ void processDataPacket(struct packetContext *ctx, int bufS, int prt) {
}
doDropper;
case ETHERTYPE_VLAN: // dot1q
if (port2vrf_res == NULL) doDropper;
ctx->stat->packVlan++;
ctx->stat->byteVlan += bufS;
ttl = get16msb(bufD, bufP) & 0xfff;
ctx->hash ^= ttl;
vlanin_ntry.port = prt;
vlanin_ntry.vlan = ttl;
bufP += 2;
index = table_find(&port2vrf_res->vlanin, &vlanin_ntry);
index = table_find(&vlanin_table, &vlanin_ntry);
if (index < 0) doDropper;
vlanin_res = table_get(&port2vrf_res->vlanin, index);
vlanin_res = table_get(&vlanin_table, index);
prt = vlanin_res->id;
vlanin_res->pack++;
vlanin_res->byte += bufS;
Expand Down Expand Up @@ -2276,14 +2276,14 @@ void processDataPacket(struct packetContext *ctx, int bufS, int prt) {
}
doDropper;
case ETHERTYPE_PPPOE_DATA: // pppoe
if (port2vrf_res == NULL) doDropper;
ctx->stat->packPppoe++;
ctx->stat->bytePppoe += bufS;
pppoe_ntry.port = prt;
pppoe_ntry.session = get16msb(bufD, bufP + 2);
ctx->hash ^= pppoe_ntry.session;
index = table_find(&port2vrf_res->pppoe, &pppoe_ntry);
index = table_find(&pppoe_table, &pppoe_ntry);
if (index < 0) doDropper;
pppoe_res = table_get(&port2vrf_res->pppoe, index);
pppoe_res = table_get(&pppoe_table, index);
pppoe_res->pack++;
pppoe_res->byte += bufS;
bufP += 6;
Expand Down
62 changes: 32 additions & 30 deletions misc/native/p4emu_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -839,25 +839,23 @@ int doOneCommand(struct packetContext *ctx, unsigned char* buf) {
return 0;
}
if (strcmp(arg[0], "portvlan") == 0) {
vlanout_ntry.port = port2vrf_ntry.port = atoi(arg[3]);
port2vrf_res = port2vrf_init(&port2vrf_ntry);
vlanout_ntry.id = vlanin_ntry.id = atoi(arg[2]);
vlanout_ntry.port = vlanin_ntry.port = atoi(arg[3]);
vlanout_ntry.vlan = vlanin_ntry.vlan = atoi(arg[4]);
if (del == 0) table_del(&port2vrf_res->vlanin, &vlanin_ntry);
else table_add(&port2vrf_res->vlanin, &vlanin_ntry);
if (del == 0) table_del(&vlanin_table, &vlanin_ntry);
else table_add(&vlanin_table, &vlanin_ntry);
if (del == 0) table_del(&vlanout_table, &vlanout_ntry);
else table_add(&vlanout_table, &vlanout_ntry);
return 0;
}
if (strcmp(arg[0], "portqinq") == 0) {
vlanout_ntry.port2 = port2vrf_ntry.port = atoi(arg[4]);
port2vrf_res = port2vrf_init(&port2vrf_ntry);
vlanout_ntry.id = vlanin_ntry.id = atoi(arg[2]);
vlanout_ntry.port = atoi(arg[3]);
vlanout_ntry.port2 = vlanin_ntry.port = atoi(arg[4]);
vlanout_ntry.vlan2 = atoi(arg[5]);
vlanout_ntry.vlan = vlanin_ntry.vlan = atoi(arg[6]);
if (del == 0) table_del(&port2vrf_res->vlanin, &vlanin_ntry);
else table_add(&port2vrf_res->vlanin, &vlanin_ntry);
if (del == 0) table_del(&vlanin_table, &vlanin_ntry);
else table_add(&vlanin_table, &vlanin_ntry);
if (del == 0) table_del(&vlanout_table, &vlanout_ntry);
else table_add(&vlanout_table, &vlanout_ntry);
return 0;
Expand Down Expand Up @@ -1631,35 +1629,32 @@ int doOneCommand(struct packetContext *ctx, unsigned char* buf) {
return 0;
}
if (strcmp(arg[0], "bundlevlan") == 0) {
port2vrf_ntry.port = atoi(arg[2]);
port2vrf_res = port2vrf_init(&port2vrf_ntry);
vlanin_ntry.id = atoi(arg[4]);
vlanin_ntry.port = atoi(arg[2]);
vlanin_ntry.vlan = atoi(arg[3]);
if (del == 0) table_del(&port2vrf_res->vlanin, &vlanin_ntry);
else table_add(&port2vrf_res->vlanin, &vlanin_ntry);
if (del == 0) table_del(&vlanin_table, &vlanin_ntry);
else table_add(&vlanin_table, &vlanin_ntry);
return 0;
}
if (strcmp(arg[0], "bundleqinq") == 0) {
port2vrf_ntry.port = atoi(arg[2]);
port2vrf_res = port2vrf_init(&port2vrf_ntry);
vlanin_ntry.id = atoi(arg[4]);
vlanin_ntry.port = atoi(arg[2]);
vlanin_ntry.vlan = atoi(arg[3]);
if (del == 0) table_del(&port2vrf_res->vlanin, &vlanin_ntry);
else table_add(&port2vrf_res->vlanin, &vlanin_ntry);
if (del == 0) table_del(&vlanin_table, &vlanin_ntry);
else table_add(&vlanin_table, &vlanin_ntry);
return 0;
}
if (strcmp(arg[0], "pppoe") == 0) {
neigh_ntry.port = port2vrf_ntry.port = atoi(arg[3]);
port2vrf_res = port2vrf_init(&port2vrf_ntry);
neigh_ntry.aclport = pppoe_ntry.aclport = atoi(arg[2]);
neigh_ntry.port = pppoe_ntry.port = atoi(arg[3]);
neigh_ntry.tid = pppoe_ntry.session = atoi(arg[6]);
neigh_ntry.id = atoi(arg[4]);
neigh_ntry.vrf = atoi(arg[5]);
neigh_ntry.command = 2;
str2mac(&neigh_ntry.macs[0], arg[7]);
str2mac(&neigh_ntry.macs[6], arg[8]);
if (del == 0) table_del(&port2vrf_res->pppoe, &pppoe_ntry);
else table_add(&port2vrf_res->pppoe, &pppoe_ntry);
if (del == 0) table_del(&pppoe_table, &pppoe_ntry);
else table_add(&pppoe_table, &pppoe_ntry);
if (del == 0) table_del(&neigh_table, &neigh_ntry);
else table_add(&neigh_table, &neigh_ntry);
return 0;
Expand Down Expand Up @@ -3061,9 +3056,20 @@ void doStatLoop() {
struct bundle_entry *ntry = table_get(&bundle_table, i);
fprintf(commandTx, "counter %i 0 0 %li %li 0 0\r\n", ntry->id, ntry->pack, ntry->byte);
}
for (int i=0; i<pppoe_table.size; i++) {
struct pppoe_entry *ntry = table_get(&pppoe_table, i);
fprintf(commandTx, "counter %i %li %li 0 0 0 0\r\n", ntry->aclport, ntry->pack, ntry->byte);
}
for (int i=0; i<vlanout_table.size; i++) {
struct vlanout_entry *ntry = table_get(&vlanout_table, i);
fprintf(commandTx, "counter %i 0 0 %li %li 0 0\r\n", ntry->id, ntry->pack, ntry->byte);
struct vlanout_entry *ontry = table_get(&vlanout_table, i);
struct vlanin_entry ival;
if (ontry->port2 != 0) ival.port = ontry->port2;
else ival.port = ontry->port;
ival.vlan = ontry->vlan;
int o = table_find(&vlanin_table, &ival);
if (o < 0) continue;
struct vlanin_entry *intry = table_get(&vlanin_table, o);
fprintf(commandTx, "counter %i %li %li %li %li 0 0\r\n", intry->id, intry->pack, intry->byte, ontry->pack, ontry->byte);
}
if ((round % 150) != 0) {
fflush(commandTx);
Expand Down Expand Up @@ -3101,17 +3107,13 @@ void doStatLoop() {
}
doStatRound_ipvX(&vrf2rib4_table, &doStatRound_rou4, &doStatRound_nat4, &doStatRound_tun4, &doStatRound_mcst4, 4);
doStatRound_ipvX(&vrf2rib6_table, &doStatRound_rou6, &doStatRound_nat6, &doStatRound_tun6, &doStatRound_mcst6, 6);
#ifndef HAVE_NOCRYPTO
for (int i=0; i<port2vrf_table.size; i++) {
struct port2vrf_entry *ntry = table_get(&port2vrf_table, i);
for (int o=0; o<ntry->pppoe.size; o++) {
struct pppoe_entry *ntry2 = table_get(&ntry->pppoe, o);
fprintf(commandTx, "counter %i %li %li 0 0 0 0\r\n", ntry2->aclport, ntry2->pack, ntry2->byte);
}
#ifndef HAVE_NOCRYPTO
if (ntry->mcscEthtyp == 0) continue;
fprintf(commandTx, "macsec_cnt %i %li %li %li %li %li %li\r\n", ntry->port, ntry->mcscPackRx, ntry->mcscByteRx, ntry->mcscPackTx, ntry->mcscByteTx, (ntry->mcscPackRx - ntry->mcscPackOk), (ntry->mcscByteRx - ntry->mcscByteOk));
#endif
}
#endif
for (int i=0; i<acls4_table.size; i++) {
struct acls_entry *ntry1 = table_get(&acls4_table, i);
doStatRound_acl(ntry1, 4);
Expand Down Expand Up @@ -3240,8 +3242,8 @@ void doMainLoop() {
case 'v':
case 'V':
printf(" id vlan port\n");
for (int i=0; i<vlanout_table.size; i++) {
struct vlanout_entry *ntry = table_get(&vlanout_table, i);
for (int i=0; i<vlanin_table.size; i++) {
struct vlanin_entry *ntry = table_get(&vlanin_table, i);
printf("%10i %10i %10i\n", ntry->id, ntry->vlan, ntry->port);
}
break;
Expand Down
46 changes: 24 additions & 22 deletions misc/native/p4emu_tab.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ struct port2vrf_entry {
int monPackets;
int sgtSet;
int sgtTag;
struct table_head pppoe;
struct table_head vlanin;
#ifndef HAVE_NOCRYPTO
int mcscEthtyp;
int mcscCrTxKeyLen;
Expand Down Expand Up @@ -148,22 +146,6 @@ struct port2vrf_entry {
struct table_head port2vrf_table;


struct pppoe_entry {
int session;
int aclport;
long pack;
long byte;
};


struct vlanin_entry {
int vlan;
int id;
long pack;
long byte;
};


struct port2vrf_entry* port2vrf_init(struct port2vrf_entry *ntry) {
int index = table_find(&port2vrf_table, ntry);
if (index >= 0) return table_get(&port2vrf_table, index);
Expand All @@ -172,8 +154,6 @@ struct port2vrf_entry* port2vrf_init(struct port2vrf_entry *ntry) {
ntry = table_get(&port2vrf_table, index);
ntry->monTarget = -1;
ntry->sgtSet = -1;
table_init(&ntry->pppoe, sizeof(struct pppoe_entry), 1);
table_init(&ntry->vlanin, sizeof(struct vlanin_entry), 1);
return ntry;
}

Expand All @@ -182,8 +162,6 @@ void port2vrf_deinit(struct port2vrf_entry *ntry) {
int index = table_find(&port2vrf_table, ntry);
if (index < 0) return;
ntry = table_get(&port2vrf_table, index);
table_deinit(&ntry->pppoe);
table_deinit(&ntry->vlanin);
table_del(&port2vrf_table, ntry);
}

Expand Down Expand Up @@ -335,6 +313,17 @@ struct bridge_entry {
struct table_head bridge_table;


struct vlanin_entry {
int vlan;
int port;
int id;
long pack;
long byte;
};

struct table_head vlanin_table;


struct vlanout_entry {
int id;
int vlan;
Expand Down Expand Up @@ -613,6 +602,17 @@ struct bundle_entry {
struct table_head bundle_table;


struct pppoe_entry {
int port;
int session;
int aclport;
long pack;
long byte;
};

struct table_head pppoe_table;


struct tun4_entry {
int srcPort;
int trgPort;
Expand Down Expand Up @@ -748,11 +748,13 @@ int initTables() {
table_init(&vrf2rib4_table, sizeof(struct vrf2rib_entry), 1);
table_init(&vrf2rib6_table, sizeof(struct vrf2rib_entry), 1);
table_init(&neigh_table, sizeof(struct neigh_entry), 1);
table_init(&vlanin_table, sizeof(struct vlanin_entry), 2);
table_init(&vlanout_table, sizeof(struct vlanout_entry), 1);
table_init(&bridge_table, sizeof(struct bridge_entry), 3);
table_init(&acls4_table, sizeof(struct acls_entry), 2);
table_init(&acls6_table, sizeof(struct acls_entry), 2);
table_init(&bundle_table, sizeof(struct bundle_entry), 1);
table_init(&pppoe_table, sizeof(struct pppoe_entry), 2);
table_init(&policer_table, sizeof(struct policer_entry), 3);
#ifndef HAVE_NOCRYPTO
printf("openssl version: %s\n", OpenSSL_version(OPENSSL_VERSION));
Expand Down
2 changes: 1 addition & 1 deletion src/rtr.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
url;file;result;test
-;-;-;freeRouter v25.1.27-cur, done by sprscc13@mrn0b0dy.
-;-;-;2025-01-27 19:20:50, took 00:15:02, with 50 workers, on 3634 cases, 0 failed, 0 traces, 4 retries
-;-;-;2025-01-27 19:51:47, took 00:15:11, with 50 workers, on 3634 cases, 0 failed, 0 traces, 2 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
Expand Down
2 changes: 1 addition & 1 deletion src/rtr.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</style>
<title>tester</title></head><body>
release: freeRouter v25.1.27-cur, done by sprscc13@mrn0b0dy.<br/>
tested: 2025-01-27 19:20:50, took 00:15:02, with 50 workers, on 3634 cases, 0 failed, 0 traces, 4 retries<br/>
tested: 2025-01-27 19:51:47, took 00:15:11, with 50 workers, on 3634 cases, 0 failed, 0 traces, 2 retries<br/>
jvm: ./rtr.bin<br/>
<br/>
<table><thead><tr><td><b>file</b></td><td><b>result</b></td><td><b>test</b></td></tr></thead><tbody>
Expand Down
2 changes: 1 addition & 1 deletion src/rtr8.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
url;file;result;test
-;-;-;freeRouter v25.1.27-cur, done by sprscc13@mrn0b0dy.
-;-;-;2025-01-27 19:34:08, took 00:12:55, with 50 workers, on 700 cases, 0 failed, 0 traces, 1 retries
-;-;-;2025-01-27 20:04:53, took 00:12:42, with 50 workers, on 700 cases, 0 failed, 0 traces, 0 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
Expand Down
2 changes: 1 addition & 1 deletion src/rtr8.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</style>
<title>tester</title></head><body>
release: freeRouter v25.1.27-cur, done by sprscc13@mrn0b0dy.<br/>
tested: 2025-01-27 19:34:08, took 00:12:55, with 50 workers, on 700 cases, 0 failed, 0 traces, 1 retries<br/>
tested: 2025-01-27 20:04:53, took 00:12:42, with 50 workers, on 700 cases, 0 failed, 0 traces, 0 retries<br/>
jvm: ./rtr.bin<br/>
<br/>
<table><thead><tr><td><b>file</b></td><td><b>result</b></td><td><b>test</b></td></tr></thead><tbody>
Expand Down

0 comments on commit 243264a

Please sign in to comment.