• C
    pktgen: correctly handle failures when adding a device · 604dfd6e
    Cong Wang 提交于
    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: NCong Wang <amwang@redhat.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    604dfd6e
pktgen.c 88.9 KB