@@ -46,7 +46,7 @@ int link_new(Manager *m, Link **ret, int ifindex) {
4646 return - ENOMEM ;
4747
4848 l -> ifindex = ifindex ;
49- l -> llmnr_support = SUPPORT_YES ;
49+ l -> llmnr_support = RESOLVE_SUPPORT_YES ;
5050
5151 r = hashmap_put (m -> links , INT_TO_PTR (ifindex ), l );
5252 if (r < 0 )
@@ -99,8 +99,8 @@ static void link_allocate_scopes(Link *l) {
9999 l -> unicast_scope = dns_scope_free (l -> unicast_scope );
100100
101101 if (link_relevant (l , AF_INET ) &&
102- l -> llmnr_support != SUPPORT_NO &&
103- l -> manager -> llmnr_support != SUPPORT_NO ) {
102+ l -> llmnr_support != RESOLVE_SUPPORT_NO &&
103+ l -> manager -> llmnr_support != RESOLVE_SUPPORT_NO ) {
104104 if (!l -> llmnr_ipv4_scope ) {
105105 r = dns_scope_new (l -> manager , & l -> llmnr_ipv4_scope , l , DNS_PROTOCOL_LLMNR , AF_INET );
106106 if (r < 0 )
@@ -110,8 +110,8 @@ static void link_allocate_scopes(Link *l) {
110110 l -> llmnr_ipv4_scope = dns_scope_free (l -> llmnr_ipv4_scope );
111111
112112 if (link_relevant (l , AF_INET6 ) &&
113- l -> llmnr_support != SUPPORT_NO &&
114- l -> manager -> llmnr_support != SUPPORT_NO &&
113+ l -> llmnr_support != RESOLVE_SUPPORT_NO &&
114+ l -> manager -> llmnr_support != RESOLVE_SUPPORT_NO &&
115115 socket_ipv6_is_supported ()) {
116116 if (!l -> llmnr_ipv6_scope ) {
117117 r = dns_scope_new (l -> manager , & l -> llmnr_ipv6_scope , l , DNS_PROTOCOL_LLMNR , AF_INET6 );
@@ -122,8 +122,8 @@ static void link_allocate_scopes(Link *l) {
122122 l -> llmnr_ipv6_scope = dns_scope_free (l -> llmnr_ipv6_scope );
123123
124124 if (link_relevant (l , AF_INET ) &&
125- l -> mdns_support != SUPPORT_NO &&
126- l -> manager -> mdns_support != SUPPORT_NO ) {
125+ l -> mdns_support != RESOLVE_SUPPORT_NO &&
126+ l -> manager -> mdns_support != RESOLVE_SUPPORT_NO ) {
127127 if (!l -> mdns_ipv4_scope ) {
128128 r = dns_scope_new (l -> manager , & l -> mdns_ipv4_scope , l , DNS_PROTOCOL_MDNS , AF_INET );
129129 if (r < 0 )
@@ -133,8 +133,8 @@ static void link_allocate_scopes(Link *l) {
133133 l -> mdns_ipv4_scope = dns_scope_free (l -> mdns_ipv4_scope );
134134
135135 if (link_relevant (l , AF_INET6 ) &&
136- l -> mdns_support != SUPPORT_NO &&
137- l -> manager -> mdns_support != SUPPORT_NO ) {
136+ l -> mdns_support != RESOLVE_SUPPORT_NO &&
137+ l -> manager -> mdns_support != RESOLVE_SUPPORT_NO ) {
138138 if (!l -> mdns_ipv6_scope ) {
139139 r = dns_scope_new (l -> manager , & l -> mdns_ipv6_scope , l , DNS_PROTOCOL_MDNS , AF_INET6 );
140140 if (r < 0 )
@@ -233,22 +233,16 @@ static int link_update_llmnr_support(Link *l) {
233233 if (r < 0 )
234234 goto clear ;
235235
236- r = parse_boolean (b );
237- if (r < 0 ) {
238- if (streq (b , "resolve" ))
239- l -> llmnr_support = SUPPORT_RESOLVE ;
240- else
241- goto clear ;
242-
243- } else if (r > 0 )
244- l -> llmnr_support = SUPPORT_YES ;
245- else
246- l -> llmnr_support = SUPPORT_NO ;
236+ l -> llmnr_support = resolve_support_from_string (b );
237+ if (l -> llmnr_support < 0 ) {
238+ r = - EINVAL ;
239+ goto clear ;
240+ }
247241
248242 return 0 ;
249243
250244clear :
251- l -> llmnr_support = SUPPORT_YES ;
245+ l -> llmnr_support = RESOLVE_SUPPORT_YES ;
252246 return r ;
253247}
254248
@@ -459,8 +453,8 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) {
459453 if (!force_remove &&
460454 link_address_relevant (a ) &&
461455 a -> link -> llmnr_ipv4_scope &&
462- a -> link -> llmnr_support == SUPPORT_YES &&
463- a -> link -> manager -> llmnr_support == SUPPORT_YES ) {
456+ a -> link -> llmnr_support == RESOLVE_SUPPORT_YES &&
457+ a -> link -> manager -> llmnr_support == RESOLVE_SUPPORT_YES ) {
464458
465459 if (!a -> link -> manager -> llmnr_host_ipv4_key ) {
466460 a -> link -> manager -> llmnr_host_ipv4_key = dns_resource_key_new (DNS_CLASS_IN , DNS_TYPE_A , a -> link -> manager -> llmnr_hostname );
@@ -516,8 +510,8 @@ void link_address_add_rrs(LinkAddress *a, bool force_remove) {
516510 if (!force_remove &&
517511 link_address_relevant (a ) &&
518512 a -> link -> llmnr_ipv6_scope &&
519- a -> link -> llmnr_support == SUPPORT_YES &&
520- a -> link -> manager -> llmnr_support == SUPPORT_YES ) {
513+ a -> link -> llmnr_support == RESOLVE_SUPPORT_YES &&
514+ a -> link -> manager -> llmnr_support == RESOLVE_SUPPORT_YES ) {
521515
522516 if (!a -> link -> manager -> llmnr_host_ipv6_key ) {
523517 a -> link -> manager -> llmnr_host_ipv6_key = dns_resource_key_new (DNS_CLASS_IN , DNS_TYPE_AAAA , a -> link -> manager -> llmnr_hostname );
0 commit comments