Skip to content

simple_forward: Validate destination argument (-d)#339

Open
harshraj1695 wants to merge 1 commit intosdnfv:developfrom
harshraj1695:fix-validate-destination
Open

simple_forward: Validate destination argument (-d)#339
harshraj1695 wants to merge 1 commit intosdnfv:developfrom
harshraj1695:fix-validate-destination

Conversation

@harshraj1695
Copy link

Problem

Previously, the -d argument was parsed without validating the input.
This could lead to unintended behavior when non-numeric values were
provided, silently defaulting to 0.

Solution

Added validation to ensure only valid numeric service IDs are accepted.

Test Plan

  • Ran NF with valid -d values (e.g., 1, 2) → works correctly
  • Ran NF with invalid values (e.g., abc, 1abc) → error handled

@twood02
Copy link
Member

twood02 commented Mar 18, 2026

Thanks for your contribution @harshraj1695 ! This looks like a reasonable fix. Please update the indentation to match the style of the rest of the code and we will accept your change.

Previously, the -d argument was parsed without validating the input.
This could lead to unintended behavior when non-numeric values were
provided, silently defaulting to 0.

This patch adds proper validation to ensure only valid numeric
service IDs are accepted.

Tested by running NF with valid and invalid -d values.
@harshraj1695 harshraj1695 force-pushed the fix-validate-destination branch from 71376c4 to c065e4b Compare March 18, 2026 17:12
@harshraj1695
Copy link
Author

Added braces for proper scoping under case 'd' and fixed indentation.

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