Skip to content

Separating ARP/ND cache maintenance from sending gratuitous ARP and UNAs#1342

Draft
htibosch wants to merge 3 commits into
FreeRTOS:mainfrom
htibosch:ARP_gratuitous_and_ND_UNA_packets
Draft

Separating ARP/ND cache maintenance from sending gratuitous ARP and UNAs#1342
htibosch wants to merge 3 commits into
FreeRTOS:mainfrom
htibosch:ARP_gratuitous_and_ND_UNA_packets

Conversation

@htibosch
Copy link
Copy Markdown
Contributor

@htibosch htibosch commented May 25, 2026

Description

In FreeRTOS+TCP, the sending of gratuitous packets was always done from the cache check routine. This PR will separate the two. Also the timing of sending gratuitous (and UNA) packets should have a random start in order to avoid IP-storms at boot time.

In the new release, I want to do this for both ARP and ND. This is how it works now:

    void vARPAgeCache()
    {
        Check the ARP cache table
        if( timer done )
        {
            reset timer;
            vARPSendGratuitous();
        }
    }

I want to use intervals for calling 'vARPSendGratuitous()' that have a random factor:

Interval = 40 seconds + ( rand() % 40 );  // Get a period between 40 and 80 seconds

And the new solution, one extra timer:

/** @brief ARP timer, to check its table entries. */
    static IPTimer_t xARPTimer;

/** @brief Gratuitous timer, to send our IP-address unsolicited. */
    static IPTimer_t xGratuitousTimer;

    void vARPAgeCache()  // triggered by xARPTimer
    {
        Check the ARP cache table
    }
    
    void vARPSendGratuitous() // triggered by xGratuitousTimer
    {
        Send a gratuitous packet to advertise my IP
    }

Test Steps

Build a project, run it, and play with the value of:
ipARP_TIMER_PERIOD_MS
ipND_TIMER_PERIOD_MS

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Before this PR, gratuitous ARPs are sent at unpredictable times.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@htibosch htibosch marked this pull request as draft May 25, 2026 16:35
@george-palmsens
Copy link
Copy Markdown
Contributor

Hi - Is this relevant to #1341?

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.

2 participants