Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: William Gonzalez <gonzalez.williamalexander1@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] bridge: tighten VLAN parsing
Date: Sun, 2 Aug 2026 11:44:21 -0700	[thread overview]
Message-ID: <20260802114421.32eeed65@phoenix.local> (raw)
In-Reply-To: <20260801024051.10581-1-gonzalez.williamalexander1@gmail.com>

On Fri, 31 Jul 2026 22:40:51 -0400
William Gonzalez <gonzalez.williamalexander1@gmail.com> wrote:

> ---

It is good to see more input validation but this patch fails the basic
requirements of iproute2 submissions.

1. No Signed-off-by
2. No commit message
3. No explanation

Longer AI generated review.

Subject: Re: [PATCH] bridge: tighten VLAN parsing

On Fri, 31 Jul 2026 22:40:51 -0400, William Gonzalez wrote:

This patch cannot be accepted in its current form due to missing required elements.

## BLOCKING ISSUES

### 1. Missing Commit Message (REQUIRED)

The patch has no commit description at all. This is unacceptable for iproute2.
Every patch MUST have:
- A clear subject line
- A description of what problem is being solved
- An explanation of the approach taken
- Examples of before/after behavior if applicable
- Signed-off-by line (DCO compliance)

### 2. Missing DCO Sign-off

The patch lacks a Signed-off-by line, which is mandatory for DCO (Developer
Certificate of Origin) compliance. All patches must include:

```
Signed-off-by: William Gonzalez <gonzalez.williamalexander1@gmail.com>
```

This certifies that you have the right to submit the patch under the GPL-2.0+
license and that you agree to the Developer Certificate of Origin.

## Technical Review

The technical changes (replacing atoi() with validated parsing) are good, but
there are issues that need addressing:

### VLAN 0 Handling Issue

The get_vlan() function rejects VLAN ID 0:

```c
if (*val < 1 || *val > 4094)
	return -1;
```

VLAN ID 0 is valid for 802.1Q priority-tagged frames. The patch needs to
either:
1. Document why VLAN 0 is rejected (if intentional)
2. Support VLAN 0 where appropriate
3. Have different validators for different contexts

### Memory Allocation

Using malloc() for parsing 4-digit numbers is unnecessary:

```c
start_arg = malloc(len + 1);
```

Better alternatives:
1. Use `strdupa()` to avoid malloc/free handling:
```c
char *start_arg = strdupa(arg);
start_arg[len] = '\0';
```

2. Or use a fixed stack buffer:
```c
char start_arg[8];  /* max "4094" plus null */
```

The `strdupa()` approach is cleaner as it avoids both malloc failure handling
and fixed buffer size checks.

### Range Validation Change

The patch changes behavior for ranges like "100-100" (single VLAN as range).
This needs to be documented or fixed.

## Required for Resubmission

1. **Add proper commit message** explaining:
   - What problem this solves
   - Why atoi() is inadequate
   - What the new validation provides
   - Any behavior changes

2. **Add Signed-off-by line** for DCO compliance

3. **Address VLAN 0 handling** - either support it or document why not

4. **Remove unnecessary malloc()** - use stack buffer

5. **Clarify range validation** changes

Example of acceptable commit message:

```
bridge: tighten VLAN parsing

The current VLAN ID parsing uses atoi() which silently accepts
invalid input like "123abc" and treats it as 123. This can cause
user confusion and unexpected behavior.

Replace atoi() with get_vlan() helper that:
- Validates the entire string is numeric
- Ensures VLAN ID is in valid range (1-4094)
- Provides clear error messages for invalid input

Note: VLAN 0 is not accepted as [explain rationale].

Before: bridge fdb add ... vlan 123x  (silently uses 123)
After:  bridge fdb add ... vlan 123x  (error: invalid vlan)

Signed-off-by: William Gonzalez <gonzalez.williamalexander1@gmail.com>
```

Please resubmit with these required elements. The core idea is good but the
patch needs proper documentation and a few technical adjustments.

NACK - missing commit message and DCO sign-off

      reply	other threads:[~2026-08-02 18:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01  2:40 [PATCH] bridge: tighten VLAN parsing William Gonzalez
2026-08-02 18:44 ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260802114421.32eeed65@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=gonzalez.williamalexander1@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox