Subject: Re: [PATCH net 2/3] pktgen: give user result when disable vlan/svlan

From: Daniel Borkmann <[email-masked]>
Date: Thu, 15 May 2014 12:00:31 +0200

On 05/15/2014 11:46 AM, Hangbin Liu wrote:
> Signed-off-by: Hangbin Liu <[email-masked]>
> ---
>   net/core/pktgen.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index dcf367f..1809bdf 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -1573,8 +1573,7 @@ static ssize_t pktgen_if_write(struct file *file,
>   			pkt_dev->vlan_id = 0xffff; /* turn off VLAN/SVLAN */
>   			pkt_dev->svlan_id = 0xffff;
>
> -			if (debug)
> -				pr_debug("VLAN/SVLAN turned off\n");
> +			sprintf(pg_result, "OK: VLAN/SVLAN turned off");

I think that might break user scripts as pg_result is copied to user
space, and currently only expected to return 'OK: svlan_id=%u' if it
was actually successful. Unfortunately, scripts that might only check
for 'OK' in the string could make wrong assumptions later on.

>   		}
>   		return count;
>   	}
> @@ -1629,8 +1628,7 @@ static ssize_t pktgen_if_write(struct file *file,
>   		} else {
>   			pkt_dev->svlan_id = 0xffff;
>
> -			if (debug)
> -				pr_debug("SVLAN turned off\n");
> +			sprintf(pg_result, "OK: SVLAN turned off");

Ditto.

>   		}
>   		return count;
>   	}