]> git.karo-electronics.de Git - karo-tx-linux.git/commit
pktgen: correctly handle failures when adding a device
authorCong Wang <amwang@redhat.com>
Sun, 27 Jan 2013 21:14:08 +0000 (21:14 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 20 Feb 2013 03:15:34 +0000 (03:15 +0000)
commitf1d2eae64955762000021ef9844ef3967c290854
treec4d2cba5ac15a611a10213828f2263497c3b12fe
parent7047cf781217e4900c233ded2b3e856d7b894f5a
pktgen: correctly handle failures when adding a device

[ Upstream commit 604dfd6efc9b79bce432f2394791708d8e8f6efc ]

The return value of pktgen_add_device() is not checked, so
even if we fail to add some device, for example, non-exist one,
we still see "OK:...". This patch fixes it.

After this patch, I got:

# echo "add_device non-exist" > /proc/net/pktgen/kpktgend_0
-bash: echo: write error: No such device
# cat /proc/net/pktgen/kpktgend_0
Running:
Stopped:
Result: ERROR: can not add device non-exist
# echo "add_device eth0" > /proc/net/pktgen/kpktgend_0
# cat /proc/net/pktgen/kpktgend_0
Running:
Stopped: eth0
Result: OK: add_device=eth0

(Candidate for -stable)

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/core/pktgen.c