From: Michael Tremer Date: Mon, 9 Dec 2019 17:08:59 +0000 (+0000) Subject: location-query: Translate family only when it is set X-Git-Tag: 0.9.1~98 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=6961aaf3a433f6101750c01d46d544609087803f location-query: Translate family only when it is set Fixes: #12253 Signed-off-by: Michael Tremer --- diff --git a/src/python/location-query.in b/src/python/location-query.in index 052befb..f22b23e 100644 --- a/src/python/location-query.in +++ b/src/python/location-query.in @@ -223,13 +223,14 @@ class CLI(object): % (args.database, e)) sys.exit(1) - # Translate family - if args.family == "ipv6": - args.family = socket.AF_INET6 - elif args.family == "ipv4": - args.family = socket.AF_INET - else: - args.family = 0 + # Translate family (if present) + if "family" in args: + if args.family == "ipv6": + args.family = socket.AF_INET6 + elif args.family == "ipv4": + args.family = socket.AF_INET + else: + args.family = 0 # Call function ret = args.func(db, args)