Skip to content

feat: state the device's own address in origin.ip - #42

Merged
DavidCozens merged 1 commit into
mainfrom
stage/origin-ip
Jul 30, 2026
Merged

feat: state the device's own address in origin.ip#42
DavidCozens merged 1 commit into
mainfrom
stage/origin-ip

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Pull request

What this stage adds

The ip PARAM, sourced from the same interface address HOSTNAME reports. A relay or
NAT between device and collector rewrites what the collector observes; ip is what
the device says about itself, which survives the hop.

Flash +12,388 B (+408 on the previous stage)
RAM +7,384 B (unchanged)
Log stack +712 B (+8)
Service +992 B (unchanged)

ip is repeatable per RFC 5424 section 7.2, so the library asks for a count and then
one value per index rather than taking a string. This device has one address and
returns one, and none before the interface has an address.

SyslogFields_IpAddress is now the single place that reads the address; HOSTNAME
formats the same string through it.

The record is 260 bytes, inside the 512-byte cap with room for both counters at
full width.

Files

 README.md                  | 14 ++++++--------
 app/syslog/Syslog.c        | 29 +++++++++++++++++++++++++++--
 app/syslog/SyslogFields.c  | 19 +++++++++++++------
 app/syslog/SyslogFields.h  |  5 +++++
 measurements/origin-ip.csv | 13 +++++++++++++
 measurements/stages.tsv    |  1 +
 run-report.md              | 26 +++++++++++++-------------
 7 files changed, 78 insertions(+), 29 deletions(-)

Checklist

  • The diff is application-only — no change to board bring-up, config headers, or build infra.
  • measurements/origin-ip.csv committed.
  • Row added to measurements/stages.tsv.
  • README regenerated: python3 scripts/gen-cost-table.py.
  • ./run.sh green (build + QEMU + baseline self-check) — run-report.md committed.

Context for review: 15 of 21 sequential single-commit PRs replaying the integration on top of the Baseline root. Each lands green and reviewed before the next is built on it, because a change to an early commit would force every commit above it to be re-run and re-measured.

Summary by CodeRabbit

  • New Features

    • Syslog messages now include the device’s own IPv4 address in the origin information.
    • The origin address remains available when messages pass through relays or NAT.
  • Documentation

    • Updated usage documentation, cost estimates, and performance reports to reflect origin address support.
    • Added updated validation examples showing the origin IP in generated logs.

The ip PARAM, sourced from the same interface address HOSTNAME reports. A relay or
NAT between device and collector rewrites what the collector observes; ip is what
the device says about itself, which survives the hop.

  Flash      +12,388 B    (+408 on the previous stage)
  RAM         +7,384 B  (unchanged)
  Log stack     +712 B            (+8)
  Service       +992 B  (unchanged)

ip is repeatable per RFC 5424 section 7.2, so the library asks for a count and then
one value per index rather than taking a string. This device has one address and
returns one, and none before the interface has an address.

SyslogFields_IpAddress is now the single place that reads the address; HOSTNAME
formats the same string through it.

The record is 260 bytes, inside the 512-byte cap with room for both counters at
full width.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The syslog implementation now derives the default interface IPv4 address through a shared helper and emits it as the origin.ip structured-data value. README cost data and run-report measurements were updated for the new origin-address stage.

Changes

Origin IP emission

Layer / File(s) Summary
IPv4 address helper
app/syslog/SyslogFields.{c,h}
Adds SyslogFields_IpAddress, which formats a valid default-interface IPv4 address under the lwIP core lock; hostname generation reuses it.
Origin structured-data wiring
app/syslog/Syslog.c
Adds callbacks and configures the origin structured-data element to emit the address when available.
Documentation and measurements
README.md, run-report.md
Updates the origin-address stage, cost tables, run descriptor, size cross-check, and self-check output.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the new origin.ip feature and matches the main change set.
Description check ✅ Passed The description follows the template and includes the feature summary plus all checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stage/origin-ip

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/syslog/SyslogFields.c`:
- Around line 42-44: Update SyslogFields_IpAddress to return immediately when
out is NULL or size is zero, before accessing out[0]; preserve the existing
empty-string initialization for valid buffers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e84b1287-159a-40e6-9044-72ab40bfab06

📥 Commits

Reviewing files that changed from the base of the PR and between cc775f5 and f97a252.

⛔ Files ignored due to path filters (2)
  • measurements/origin-ip.csv is excluded by !**/*.csv
  • measurements/stages.tsv is excluded by !**/*.tsv
📒 Files selected for processing (5)
  • README.md
  • app/syslog/Syslog.c
  • app/syslog/SyslogFields.c
  • app/syslog/SyslogFields.h
  • run-report.md

Comment thread app/syslog/SyslogFields.c
@DavidCozens
DavidCozens merged commit 23bfd9c into main Jul 30, 2026
2 checks passed
@DavidCozens
DavidCozens deleted the stage/origin-ip branch July 30, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant