diff --git a/README.md b/README.md index b93e728..5a9f83d 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ MulticastSiteAddress: ff05::2:1001 # Default domain to use DefaultDomain: # Default domain type -DefaultDomainType: batadv +DomainType: batadv # A domain [] @@ -131,7 +131,7 @@ Port: 1001 MulticastLinkAddress: ff02::2:1001 MulticastSiteAddress: ff05::2:1001 # Default domain type -DefaultDomainType: batadv +DomainType: batadv # IPv4 gateway option for ddhcpd IPv4Gateway: 10.42.0.1 @@ -169,7 +169,7 @@ Port: 1001 MulticastLinkAddress: ff02::2:1001 MulticastSiteAddress: ff05::2:1001 # Default domain type -DefaultDomainType: batadv +DomainType: batadv # First domain [one] diff --git a/config.py b/config.py index 8ebf80a..fc8b59c 100644 --- a/config.py +++ b/config.py @@ -3,13 +3,9 @@ class GlobalOptions(): ''' Container class for global options ''' - def __init__(self, port, mcast_link, mcast_site, default_domain, default_domain_type, ipv4_gateway): + def __init__(self, port, default_domain): self.port = port - self.mcast_link = mcast_link - self.mcast_site = mcast_site self.default_domain = default_domain - self.default_domain_type = default_domain_type - self.ipv4_gateway = ipv4_gateway class DomainOptions(): ''' Base container class for per domain options @@ -21,7 +17,7 @@ def from_parser(cls, section, parser, globals): ''' from domain import DomainType - domain_type = parser.get(section, 'DomainType', fallback=globals.default_domain_type) + domain_type = parser.get(section, 'DomainType', fallback='simple') # Get DomainOptions subclass for type and instantiate return DomainType.get(domain_type.lower()).options(section, parser, globals) @@ -32,9 +28,9 @@ def __init__(self, name, parser, globals): self.name = name self.interfaces = list(map(str.strip, parser.get(name, 'Interfaces', fallback='').split(','))) - self.mcast_link = parser.get(name, 'MulticastLinkAddress', fallback=globals.mcast_link) - self.mcast_site = parser.get(name, 'MulticastSiteAddress', fallback=globals.mcast_site) - self.ipv4_gateway = parser.get(name, 'IPv4Gateway', fallback=globals.ipv4_gateway) + self.mcast_link = parser.get(name, 'MulticastLinkAddress', fallback='ff02::2:1001') + self.mcast_site = parser.get(name, 'MulticastSiteAddress', fallback='ff05::2:1001') + self.ipv4_gateway = parser.get(name, 'IPv4Gateway', fallback=None) self.domain_type = Domain class BatmanDomainOptions(DomainOptions): @@ -77,12 +73,8 @@ def _initialize_global_options(self, parser): ''' Set all global options ''' self.globals = GlobalOptions( - parser.getint(None, 'Port', fallback=1001), - parser.get(None, 'MulticastLinkAddress', fallback='ff02::2:1001'), - parser.get(None, 'MulticastSiteAddress', fallback='ff05::2:1001'), - parser.get(None, 'DefaultDomain', fallback=None), - parser.get(None, 'DefaultDomainType', fallback='simple'), - parser.get(None, 'IPv4Gateway', fallback=None), + parser.getint('Defaults', 'Port', fallback=1001), + parser.get('Defaults', 'DefaultDomain', fallback=None) ) def _initialize_domain_options(self, parser, domain): diff --git a/respondd.conf.example b/respondd.conf.example index e0be388..e85bed2 100644 --- a/respondd.conf.example +++ b/respondd.conf.example @@ -15,7 +15,7 @@ MulticastSiteAddress: ff05::2:1001 DefaultDomain: ffki # Default domain type # optional -DefaultDomainType: batadv +DomainType: batadv # Default ddhcpd IPv4 gateway address # optional IPv4Gateway: 10.116.128.8 @@ -24,7 +24,7 @@ IPv4Gateway: 10.116.128.8 # User your own domain name here [ffki] # This is a batman domain -# optional, mandatory if DefaultDomainType not set, default: @DefaultDomainType +# optional, mandatory if DomainType not set, default: @DomainType # supported domain types are: simple, batadv DomainType: batadv # Batman interface