Skip to content

Enhancement: Log more Infos on Filtering (JoinEui Filter, DevAddr Filter) #72

@sil-zh

Description

@sil-zh

Hallo,

When Chirpstack MQTT Forwarder is configured to filter packages (based on devAddr or JoinEUI), packages that not match the filter will be ignored.
This leads to the debug message

Ignoring uplink frame because of dev_addr and join_eui filters, uplink_id: 2233143934

To have a better overview whats going on on the gateway, what is blocked and also why, it would be nice to have a output like this:

for devAddr:
Ignoring uplink frame because of dev_addr filters: devAddr: 016b204b, devAddr Filter: 0000ff00/24, uplink_id: 2233143934

for JoinEui:
Ignoring uplink frame because of join_eui filters: JoinEui: E13D29FA81000123/64, devAddr Filter: A13B29EF81000123/64, uplink_id: 2233143935

So basicly, every message has the information about the JoinEui/DevAddr and the configured filter(s). If the configured Filter is needed, i dont know. But maybe it's helpfull, if some people have different filters on different gateways.

I do not know, how time consuming it is to do this - but as far as i see the code, there is the chance to get this information out from uf.phy_payload

for uf in &uplink_frames {
    if let Some(rx_info) = &uf.rx_info
        && !((rx_info.crc_status() == gw::CrcStatus::CrcOk && state.forward_crc_ok)
            || (rx_info.crc_status() == gw::CrcStatus::BadCrc && state.forward_crc_invalid)
            || (rx_info.crc_status() == gw::CrcStatus::NoCrc && state.forward_crc_missing))
        {
            debug!(
                "Ignoring uplink frame because of forward_crc_ flags, uplink_id: {}",
                uf.rx_info.as_ref().map(|v| v.uplink_id).unwrap_or_default(),
            );

            continue;
        }

    if lrwn_filters::matches(&uf.phy_payload, &state.filters) {
        state.count_uplink(uf).await?;
        send_uplink_frame(uf).await?;
    } else {
        debug!(
            "Ignoring uplink frame because of dev_addr and join_eui filters, uplink_id: {}",
            uf.rx_info.as_ref().map(|v| v.uplink_id).unwrap_or_default()
        );
    }
}`

Edit, Aditional Infos:

Based on thel lrwn_filters::matches part of this code from the chirpstack repository could be used.
Chirsptack Repo - lrwn_filters

As it extracts the devAddr or JoinEui from the pyh_payload

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions