Skip to content
Merged

Dev #382

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
os: [ubuntu-22.04, ubuntu-24.04]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Download RtBrick libdict
shell: bash
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
run: cpack -G DEB

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: bngblaster-${{matrix.os}}
path: ${{ github.workspace }}/build/*.deb
Expand All @@ -80,7 +80,7 @@ jobs:
os: [bookworm, trixie]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install dependencies
shell: bash
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
run: cpack -G DEB

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: bngblaster-${{matrix.os}}
path: ${{ github.workspace }}/build/*.deb
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
echo "SOURCE_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.ref_name.outputs.SOURCE_TAG }}
Expand All @@ -36,7 +36,7 @@ jobs:
os: [ubuntu-22.04, ubuntu-24.04]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Download RtBrick libdict
shell: bash
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
os: [bookworm, trixie]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Install dependencies
shell: bash
Expand Down
14 changes: 14 additions & 0 deletions code/bngblaster/src/bbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,15 @@ bbl_ctrl_job(timer_s *timer)
}
}

void
logfile_fflush_job(timer_s *timer)
{
UNUSED(timer);
if(g_log_fp) {
fflush(g_log_fp);
}
}

/**
* @brief BNG BLASTER MAIN FUNCTION
*
Expand Down Expand Up @@ -520,6 +529,11 @@ main(int argc, char *argv[])

/* Open logfile. */
log_open();
if(g_log_fp) {
timer_add_periodic(&g_ctx->timer_root, &g_ctx->logfile_fflush_timer,
"logfile fflush()", 0, 100 * MSEC, g_ctx,
&logfile_fflush_job);
}

/* Init config. */
bbl_config_init_defaults();
Expand Down
13 changes: 11 additions & 2 deletions code/bngblaster/src/bbl_a10nsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,19 @@ bbl_a10nsp_dynamic(bbl_a10nsp_interface_s *interface,
io_new = interface->interface->io.tx;
stream->tx_interface = interface->interface;
}
if(stream->io) {

if(io_new && stream->io && io_new != stream->io) {
/* IO changed. */
stream->io->update_streams = true;
stream->io = io_new;
stream->update_pps = true;
} else if(stream->io) {
/* IO unchanged. */
stream->update_pps = true;
stream->io->update_streams = true;
} else {
} else if(io_new) {
/* IO was not assigned before. */
stream->io = io_new;
io_stream_add(io_new, stream);
}
}
Expand Down
1 change: 1 addition & 0 deletions code/bngblaster/src/bbl_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ typedef struct bbl_ctx_
struct timer_ *smear_timer;
struct timer_ *stats_timer;
struct timer_ *keyboard_timer;
struct timer_ *logfile_fflush_timer;

struct timer_ *tcp_timer;
struct timer_ *fragmentation_timer;
Expand Down
12 changes: 5 additions & 7 deletions code/bngblaster/src/bbl_lag.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,13 @@ static json_t *
bbl_lag_json(bbl_lag_s *lag)
{
bbl_lag_member_s *member;
io_handle_s *io;
json_t *jobj_lag, *jobj_member, *jobj_lacp, *jobj_array;

jobj_array = json_array();

CIRCLEQ_FOREACH(member, &lag->lag_member_qhead, lag_member_qnode) {
if(member->lacp_state) {
io = member->interface->io.tx;
jobj_lacp = json_pack("{si si si ss* si si si si si ss* si si si si si si sf}",
jobj_lacp = json_pack("{si si si ss* si si si si si ss* si si si si si }",
"bpdu-rx", member->stats.lacp_rx,
"bpdu-tx", member->stats.lacp_tx,
"bpdu-dropped", member->stats.lacp_dropped,
Expand All @@ -364,19 +362,19 @@ bbl_lag_json(bbl_lag_s *lag)
"partner-key", member->partner_key,
"partner-port-priority", member->partner_port_priority,
"partner-port-id", member->partner_port_id,
"partner-state", member->partner_state,
"stream-count", io->stream_count,
"stream-pps", io->stream_pps
"partner-state", member->partner_state
);
} else {
jobj_lacp = NULL;
}
jobj_member = json_pack("{ss* ss* si sI sI ss* so*}",
jobj_member = json_pack("{ss* ss* si sI sI si sf ss* so*}",
"interface", member->interface->name,
"state", interface_state_string(member->interface->state),
"state-transitions", member->interface->state_transitions,
"packets-rx", member->interface->io.rx->stats.packets,
"packets-tx", member->interface->io.tx->stats.packets,
"stream-count", member->interface->io.tx->stream_count,
"stream-pps", member->interface->io.tx->stream_pps,
"lacp-state", lacp_state_string(member->lacp_state),
"lacp", jobj_lacp);
if(jobj_member) {
Expand Down
35 changes: 22 additions & 13 deletions code/bngblaster/src/bbl_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ bbl_session_reset(bbl_session_s *session) {
session->ipv6_prefix.len = 0;
session->delegated_ipv6_prefix.len = 0;
session->arp_resolved = false;
if(session->dhcp_state > BBL_DHCP_DISABLED) {
session->dhcp_state = BBL_DHCP_INIT;
}
session->icmpv6_ra_received = false;
if(session->dhcpv6_state > BBL_DHCP_DISABLED) {
session->dhcpv6_state = BBL_DHCP_INIT;
Expand Down Expand Up @@ -566,6 +569,10 @@ bbl_session_update_state(bbl_session_s *session, session_state_t new_state)
clock_gettime(CLOCK_MONOTONIC, &g_ctx->timestamp_established);
}
bbl_tun_session_up(session);
} else if(new_state == BBL_PPPOE_INIT) {
if(old_state == BBL_PPPOE_REQUEST) {
bbl_session_reset(session);
}
} else if(new_state == BBL_PPP_TERMINATING) {
if(session->ipcp_state > BBL_PPP_DISABLED) {
session->ipcp_state = BBL_PPP_CLOSED;
Expand Down Expand Up @@ -1179,20 +1186,22 @@ bbl_session_substate_pppoe(bbl_session_s *session)
const char *
bbl_session_substate_ipoe(bbl_session_s *session)
{
if(session->access_config->ipv4_enable) {
if(session->dhcp_state > BBL_DHCP_DISABLED && session->dhcp_state < BBL_DHCP_BOUND) {
return "DHCPv4 pending";
}
if(!session->arp_resolved) {
return "ARP not resolved";
}
}
if(session->access_config->ipv6_enable) {
if (session->dhcpv6_state > BBL_DHCP_DISABLED && session->dhcpv6_state < BBL_DHCP_BOUND) {
return "DHCPv6 pending";
if(session->session_state == BBL_IPOE_SETUP) {
if(session->access_config->ipv4_enable) {
if(session->dhcp_state > BBL_DHCP_DISABLED && session->dhcp_state < BBL_DHCP_BOUND) {
return "DHCPv4 pending";
}
if(!session->arp_resolved) {
return "ARP not resolved";
}
}
if(!session->icmpv6_ra_received) {
return "Wait for ICMPv6 RA";
if(session->access_config->ipv6_enable) {
if (session->dhcpv6_state > BBL_DHCP_DISABLED && session->dhcpv6_state < BBL_DHCP_BOUND) {
return "DHCPv6 pending";
}
if(!session->icmpv6_ra_received) {
return "Wait for ICMPv6 RA";
}
}
}
return NULL;
Expand Down
1 change: 1 addition & 0 deletions code/bngblaster/src/bbl_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -2292,6 +2292,7 @@ void
bbl_stream_reset(bbl_stream_s *stream)
{
if(!stream) return;
if(stream->reset) return;
stream->tx_first_seq = UINT64_MAX;

stream->reset_packets_tx = stream->tx_packets;
Expand Down
1 change: 1 addition & 0 deletions code/common/src/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ timer_add(timer_root_s *root, timer_s **ptimer, char *name,

/* This timer already is enqueued. Requeue. */
if(timer) {
timer->delete = false; /* Stop a pending deferred deletion */
clock_gettime(CLOCK_MONOTONIC, &timer->expire);
timer_requeue(timer, sec, nsec);
/* Update data and cb if there was a change.
Expand Down
Loading