/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/mandosclient.c

  • Committer: Teddy Hogeborn
  • Date: 2008-07-31 19:48:05 UTC
  • Revision ID: teddy@fukt.bsnet.se-20080731194805-mseis21dxwrdfqhk
* plugins.d/mandosclient.c (start_mandos_communication): Changed
                                                        "if_index" to
                                                        be of type
                                                        "AvahiIfIndex".
                                                        All callers
                                                        changed.
 (main): Add default values to "interface" and "if_index".  Only
         change if_index from default if "interface" was given.

* server.py (IPv6_TCPServer.server_bind): Bug fix: test if interface
                                          is empty, not if equal to
                                          avahi.IF_UNSPEC.
  (if_nametoindex): Bug fix; typo: assign to _func[0], not func[0].
  (main): Bug fix: Do not set service.interface unless the interface
          setting has been given.

Show diffs side-by-side

added added

removed removed

Lines of Context:
343
343
               __attribute__((unused)) const char *txt){}
344
344
 
345
345
int start_mandos_communication(const char *ip, uint16_t port,
346
 
                               unsigned int if_index){
 
346
                               AvahiIfIndex if_index){
347
347
  int ret, tcp_sd;
348
348
  struct sockaddr_in6 to;
349
349
  encrypted_session es;
367
367
    return -1;
368
368
  }
369
369
  
370
 
  if(if_indextoname(if_index, interface) == NULL){
 
370
  if(if_indextoname((unsigned int)if_index, interface) == NULL){
371
371
    if(debug){
372
372
      perror("if_indextoname");
373
373
    }
564
564
        fprintf(stderr, "Mandos server \"%s\" found on %s (%s) on"
565
565
                " port %d\n", name, host_name, ip, port);
566
566
      }
567
 
      int ret = start_mandos_communication(ip, port,
568
 
                                           (unsigned int) interface);
 
567
      int ret = start_mandos_communication(ip, port, interface);
569
568
      if (ret == 0){
570
569
        exit(EXIT_SUCCESS);
571
570
      }
629
628
    int error;
630
629
    int ret;
631
630
    int returncode = EXIT_SUCCESS;
632
 
    const char *interface = "eth0";
633
 
    unsigned int if_index;
 
631
    const char *interface = NULL;
 
632
    AvahiIfIndex if_index = AVAHI_IF_UNSPEC;
634
633
    char *connect_to = NULL;
635
634
    
636
635
    while (true){
662
661
      }
663
662
    }
664
663
    
665
 
    if_index = if_nametoindex(interface);
666
 
    if(if_index == 0){
667
 
      fprintf(stderr, "No such interface: \"%s\"\n", interface);
668
 
      exit(EXIT_FAILURE);
 
664
    if(interface != NULL){
 
665
      if_index = (AvahiIfIndex) if_nametoindex(interface);
 
666
      if(if_index == 0){
 
667
        fprintf(stderr, "No such interface: \"%s\"\n", interface);
 
668
        exit(EXIT_FAILURE);
 
669
      }
669
670
    }
670
671
    
671
672
    if(connect_to != NULL){
729
730
    }
730
731
    
731
732
    /* Create the service browser */
732
 
    sb = avahi_s_service_browser_new(server, (AvahiIfIndex)if_index,
 
733
    sb = avahi_s_service_browser_new(server, if_index,
733
734
                                     AVAHI_PROTO_INET6,
734
735
                                     "_mandos._tcp", NULL, 0,
735
736
                                     browse_callback, server);