Skip to content

Commit 1e207b2

Browse files
Bastian-KrauseEmantor
authored andcommitted
helpers/labgrid-raw-interface: make tcpdump count argument actually optional
The intention of labgrid-raw-interface was to have an optional "count" argument, allowing for packet capture on an interface until a timeout is reached, no matter how many packets are received. This is used when calling: RawNetworkInterfaceDriver.start_record(filename, timeout=10) However, the missing `nargs="?"` kwarg when adding the argument actually required the argument to be given: usage: labgrid-raw-interface tcpdump [-h] [--timeout TIMEOUT] ifname count labgrid-raw-interface tcpdump: error: the following arguments are required: count The original commit introducing the option actually included it [1]. Fix that by re-adding `nargs="?"`. [1] 90cf941 ("helpers: add labgrid-raw-interface helper") Fixes: c1aec37 ("helpers/labgrid-raw-interface: introduce subparsers per program, pass options") Signed-off-by: Bastian Krause <bst@pengutronix.de>
1 parent 03429b4 commit 1e207b2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

helpers/labgrid-raw-interface

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ if __name__ == "__main__":
126126
# tcpdump
127127
tcpdump_parser = subparsers.add_parser("tcpdump")
128128
tcpdump_parser.add_argument("ifname", type=str, help="interface name")
129-
tcpdump_parser.add_argument("count", type=int, default=None, help="amount of frames to capture while recording")
129+
tcpdump_parser.add_argument("count", type=int, nargs="?", default=None, help="amount of frames to capture while recording")
130130
tcpdump_parser.add_argument(
131131
"--timeout", type=int, default=None, help="Amount of time to capture while recording. 0 means capture forever"
132132
)

0 commit comments

Comments
 (0)