Ticket #198: avahi-utils.patch
| File avahi-utils.patch, 9.4 kB (added by Arthur_van_Hoff@Dell.com, 9 months ago) |
|---|
-
avahi-resolve.c
old new 56 56 int verbose; 57 57 Command command; 58 58 AvahiProtocol proto; 59 AvahiIfIndex interface; 59 60 } Config; 60 61 61 62 static AvahiSimplePoll *simple_poll = NULL; … … 163 164 " -n --name Resolve host name\n" 164 165 " -a --address Resolve address\n" 165 166 " -v --verbose Enable verbose mode\n" 167 " -i --interface=INTF Interface on which to publish\n" 166 168 " -6 Lookup IPv6 address\n" 167 169 " -4 Lookup IPv4 address\n"), 168 170 argv0, strstr(argv0, "host-name") ? "[-n]" : "-n", … … 177 179 { "version", no_argument, NULL, 'V' }, 178 180 { "name", no_argument, NULL, 'n' }, 179 181 { "address", no_argument, NULL, 'a' }, 182 { "interface", required_argument, NULL, 'i' }, 180 183 { "verbose", no_argument, NULL, 'v' }, 181 184 { NULL, 0, NULL, 0 } 182 185 }; … … 186 189 c->command = strstr(argv0, "address") ? COMMAND_RESOLVE_ADDRESS : (strstr(argv0, "host-name") ? COMMAND_RESOLVE_HOST_NAME : COMMAND_UNSPEC); 187 190 c->proto = AVAHI_PROTO_UNSPEC; 188 191 c->verbose = 0; 192 c->interface = AVAHI_IF_UNSPEC; 189 193 190 while ((o = getopt_long(argc, argv, "hVnav46 ", long_options, NULL)) >= 0) {194 while ((o = getopt_long(argc, argv, "hVnav46i:", long_options, NULL)) >= 0) { 191 195 192 196 switch(o) { 193 197 case 'h': … … 211 215 case '6': 212 216 c->proto = AVAHI_PROTO_INET6; 213 217 break; 218 case 'i': 219 c->interface = if_nametoindex(optarg); 220 if (c->interface == 0) { 221 c->interface = atoi(optarg); 222 } 223 if (c->interface == 0) { 224 fprintf(stderr, _("Invalid interface: %s\n"), optarg); 225 return -1; 226 } 227 break; 214 228 default: 215 229 return -1; 216 230 } … … 297 311 298 312 if (config.command == COMMAND_RESOLVE_HOST_NAME) { 299 313 300 if (!(avahi_host_name_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, argv[i], config.proto, 0, host_name_resolver_callback, NULL))) {314 if (!(avahi_host_name_resolver_new(client, config.interface, AVAHI_PROTO_UNSPEC, argv[i], config.proto, 0, host_name_resolver_callback, NULL))) { 301 315 fprintf(stderr, _("Failed to create host name resolver: %s\n"), avahi_strerror(avahi_client_errno(client))); 302 316 goto fail; 303 317 } … … 312 326 goto fail; 313 327 } 314 328 315 if (!(avahi_address_resolver_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, &a, 0, address_resolver_callback, NULL))) {329 if (!(avahi_address_resolver_new(client, config.interface, AVAHI_PROTO_UNSPEC, &a, 0, address_resolver_callback, NULL))) { 316 330 fprintf(stderr, _("Failed to create address resolver: %s\n"), avahi_strerror(avahi_client_errno(client))); 317 331 goto fail; 318 332 } -
avahi-browse.c
old new 73 73 #if defined(HAVE_GDBM) || defined(HAVE_DBM) 74 74 int no_db_lookup; 75 75 #endif 76 AvahiIfIndex interface; 76 77 } Config; 77 78 78 79 typedef struct ServiceInfo ServiceInfo; … … 351 352 352 353 if (!(b = avahi_service_browser_new( 353 354 client, 354 AVAHI_IF_UNSPEC,355 c->interface, 355 356 AVAHI_PROTO_UNSPEC, 356 357 stype, 357 358 domain, … … 418 419 419 420 if (!(b = avahi_service_type_browser_new( 420 421 client, 421 AVAHI_IF_UNSPEC,422 c->interface, 422 423 AVAHI_PROTO_UNSPEC, 423 424 c->domain, 424 425 0, … … 492 493 493 494 if (!(b = avahi_domain_browser_new( 494 495 client, 495 AVAHI_IF_UNSPEC,496 c->interface, 496 497 AVAHI_PROTO_UNSPEC, 497 498 c->domain, 498 499 AVAHI_DOMAIN_BROWSER_BROWSE, … … 638 639 " -c --cache Terminate after dumping all entries from the cache\n" 639 640 " -l --ignore-local Ignore local services\n" 640 641 " -r --resolve Resolve services found\n" 642 " -i --interface=INTF Interface which to browse\n" 641 643 " -f --no-fail Don't fail if the daemon is not available\n" 642 644 " -p --parsable Output in parsable format\n"), 643 645 #if defined(HAVE_GDBM) || defined(HAVE_DBM) … … 664 666 { "ignore-local", no_argument, NULL, 'l' }, 665 667 { "resolve", no_argument, NULL, 'r' }, 666 668 { "no-fail", no_argument, NULL, 'f' }, 667 { "parsable", no_argument, NULL, 'p' }, 669 { "interface", required_argument, NULL, 'i' }, 670 { "parsable", no_argument, NULL, 'p' }, 668 671 #if defined(HAVE_GDBM) || defined(HAVE_DBM) 669 672 { "no-db-lookup", no_argument, NULL, 'k' }, 670 673 { "dump-db", no_argument, NULL, 'b' }, … … 683 686 c->no_fail = 684 687 c->parsable = 0; 685 688 c->domain = c->stype = NULL; 689 c->interface = AVAHI_IF_UNSPEC; 686 690 687 691 #if defined(HAVE_GDBM) || defined(HAVE_DBM) 688 692 c->no_db_lookup = 0; 689 693 #endif 690 694 691 while ((o = getopt_long(argc, argv, "hVd:avtclrDfp "695 while ((o = getopt_long(argc, argv, "hVd:avtclrDfpi:" 692 696 #if defined(HAVE_GDBM) || defined(HAVE_DBM) 693 697 "kb" 694 698 #endif … … 732 736 case 'p': 733 737 c->parsable = 1; 734 738 break; 739 case 'i': 740 c->interface = if_nametoindex(optarg); 741 if (c->interface == 0) { 742 c->interface = atoi(optarg); 743 } 744 if (c->interface == 0) { 745 fprintf(stderr, _("Invalid interface: %s\n"), optarg); 746 return -1; 747 } 748 break; 735 749 #if defined(HAVE_GDBM) || defined(HAVE_DBM) 736 750 case 'k': 737 751 c->no_db_lookup = 1; -
avahi-publish.c
old new 57 57 uint16_t port; 58 58 AvahiStringList *txt, *subtypes; 59 59 AvahiAddress address; 60 AvahiIfIndex interface; 60 61 } Config; 61 62 62 63 static AvahiSimplePoll *simple_poll = NULL; … … 132 133 133 134 assert(config->command == COMMAND_PUBLISH_SERVICE); 134 135 135 if (avahi_entry_group_add_service_strlst(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, config->host, config->port, config->txt) < 0) {136 if (avahi_entry_group_add_service_strlst(entry_group, config->interface, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, config->host, config->port, config->txt) < 0) { 136 137 fprintf(stderr, _("Failed to add service: %s\n"), avahi_strerror(avahi_client_errno(client))); 137 138 return -1; 138 139 } 139 140 140 141 for (i = config->subtypes; i; i = i->next) 141 if (avahi_entry_group_add_service_subtype(entry_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, (char*) i->text) < 0) {142 if (avahi_entry_group_add_service_subtype(entry_group, config->interface, AVAHI_PROTO_UNSPEC, 0, config->name, config->stype, config->domain, (char*) i->text) < 0) { 142 143 fprintf(stderr, _("Failed to add subtype '%s': %s\n"), i->text, avahi_strerror(avahi_client_errno(client))); 143 144 return -1; 144 145 } … … 225 226 " -d --domain=DOMAIN Domain to publish service in\n" 226 227 " -H --host=DOMAIN Host where service resides\n" 227 228 " --subtype=SUBTYPE An additional subtype to register this service with\n" 229 " -i --interface=INTF Interface on which to publish\n" 228 230 " -f --no-fail Don't fail if the daemon is not available\n"), 229 231 argv0, strstr(argv0, "service") ? "[-s]" : "-s", 230 232 argv0, strstr(argv0, "address") ? "[-a]" : "-a"); … … 245 247 { "verbose", no_argument, NULL, 'v' }, 246 248 { "domain", required_argument, NULL, 'd' }, 247 249 { "host", required_argument, NULL, 'H' }, 250 { "interface", required_argument, NULL, 'i' }, 248 251 { "subtype", required_argument, NULL, ARG_SUBTYPE}, 249 252 { "no-fail", no_argument, NULL, 'f' }, 250 253 { NULL, 0, NULL, 0 } … … 257 260 c->host = c->name = c->domain = c->stype = NULL; 258 261 c->port = 0; 259 262 c->txt = c->subtypes = NULL; 263 c->interface = AVAHI_IF_UNSPEC; 260 264 261 while ((o = getopt_long(argc, argv, "hVsavd:H: f", long_options, NULL)) >= 0) {265 while ((o = getopt_long(argc, argv, "hVsavd:H:i:f", long_options, NULL)) >= 0) { 262 266 263 267 switch(o) { 264 268 case 'h': … … 287 291 case 'f': 288 292 c->no_fail = 1; 289 293 break; 294 case 'i': 295 c->interface = if_nametoindex(optarg); 296 if (c->interface == 0) { 297 c->interface = atoi(optarg); 298 } 299 if (c->interface == 0) { 300 fprintf(stderr, _("Invalid interface: %s\n"), optarg); 301 return -1; 302 } 303 break; 290 304 case ARG_SUBTYPE: 291 305 c->subtypes = avahi_string_list_add(c->subtypes, optarg); 292 306 break;
