Commit 9ce5ca58 authored by Roland Knall's avatar Roland Knall Committed by Pascal Quantin

extcap: Catch unknown arguments to fix spaces

 - If boolflags are being used, an extra space is added
   to the call of the extcap filter. This leads to the
   argumentparser of python to exit with an error-code,
   and the extcap filter will not start. This patch instead
   catches the unknown arguments and prints them on stdout,
   as well as running the dissection with the rest of the
   arguments list.

   Basically this is a work-around, for a behaviour not
   yet fixed in extcap, but it stabilizes the usage of the demo

Change-Id: I7589292692b0b3c839909fd09d62a4714cbe869e
Reviewed-on: https://code.wireshark.org/review/4638Reviewed-by: default avatarRoland Knall <rknall@gmail.com>
Reviewed-by: default avatarTomasz Moń <desowin@gmail.com>
Reviewed-by: default avatarPascal Quantin <pascal.quantin@gmail.com>
parent 631834ff
......@@ -236,7 +236,7 @@ if __name__ == '__main__':
parser.add_argument("--remote", help="Demonstrates a selector choice", default="if1", choices=["if1", "if2"] )
parser.add_argument("--message", help="Demonstrates string variable", nargs='?', default="" )
args = parser.parse_args()
args, unknown = parser.parse_known_args()
if ( len(sys.argv) <= 1 ):
parser.exit("No arguments given!")
......@@ -247,6 +247,9 @@ if __name__ == '__main__':
extcap_interfaces()
sys.exit(0)
if ( len(unknown) > 1 ):
print("Extcap Example %d unknown arguments given" % len(unknown) )
m = re.match ( 'example(\d+)', args.extcap_interface )
if not m:
sys.exit(ERROR_INTERFACE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment