X-Git-Url: https://git.distorted.org.uk/~mdw/hippotat/blobdiff_plain/71f9ddb6f396ddbed730155dea6adbb83d2df841..4652e3827272085a9604176b3e8b772217730ed8:/hippotatlib/__init__.py diff --git a/hippotatlib/__init__.py b/hippotatlib/__init__.py index 8e00c15..bd5d2c3 100644 --- a/hippotatlib/__init__.py +++ b/hippotatlib/__init__.py @@ -386,11 +386,20 @@ def _cfg_process_putatives(): server_pat = r'[-.0-9A-Za-z]+' client_pat = r'[.:0-9a-f]+' server_re = regexp.compile(server_pat) - serverclient_re = regexp.compile(server_pat + r' ' + client_pat) + serverclient_re = regexp.compile( + server_pat + r' ' + '(?:' + client_pat + '|LIMIT)') for cs in cfg.sections(): + log_debug_config('putatives: section [%s]...' % (cs)) + + def log_ignore(why): + log_debug_config('putatives: section [%s] X ignore: %s' % (cs, why)) + print('warning: ignoring config section [%s] (%s)' % (cs, why), + file=sys.stderr) + if cs == 'LIMIT' or cs == 'COMMON': # plan A "[LIMIT]" or "[COMMON]" + log_debug_config('putatives: section [%s] A ignore' % (cs)) continue try: @@ -400,6 +409,7 @@ def _cfg_process_putatives(): if server_re.fullmatch(cs): # plan C "[]" + log_debug_config('putatives: section [%s] C ' % (cs)) putative(servers, cs, cs) continue @@ -409,6 +419,7 @@ def _cfg_process_putatives(): if pcs == 'LIMIT': # plan E "[ LIMIT]" + log_debug_config('putatives: section [%s] E LIMIT' % (cs)) continue try: @@ -416,18 +427,20 @@ def _cfg_process_putatives(): ci = ipaddr(pc) except AddressValueError: # plan F "[]" - # well, we ignore this - print('warning: ignoring config section %s' % cs, file=sys.stderr) + log_ignore('bad-addr') continue else: # no AddressValueError - # plan D "[ ]" part 3 + log_debug_config('putatives: section [%s] D ' + % (cs)) putative(clients, ci, pcs) putative(servers, pss, pss) continue else: # no AddressValueError # plan B "[" part 2 + log_debug_config('putatives: section [%s] B ' % (cs)) putative(clients, ci, cs) continue