Changeset 8951


Ignore:
Timestamp:
02/06/08 17:45:26 (5 years ago)
Author:
BrainSlayer
Message:

count igmp interfaces and decide if we need to start the daemon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/services/igmp.c

    r8946 r8951  
    3333  pid_t pid; 
    3434  char name[80], *next, *svbuf; 
    35   char *argv[] = { "igmprt", NULL}; 
     35  char *argv[] = { "igmprt", NULL }; 
    3636 
    3737 
    3838 
    3939  stop_igmp_proxy (); 
     40  int ifcount = 0; 
    4041 
    4142 
    42  
     43  FILE *fp = fopen ("/tmp/igmpproxy.conf", "wb"); 
     44  fprintf (fp, "quickleave\n"); 
     45  fprintf (fp, "phyint %s upstream  ratelimit 0  threshold 1\n", 
     46           nvram_safe_get ("wan_iface")); 
    4347  if (nvram_match ("block_multicast", "0")) 
    4448    { 
    45       FILE *fp = fopen ("/tmp/igmpproxy.conf", "wb"); 
    46       fprintf (fp, "quickleave\n"); 
    47       fprintf (fp, "phyint %s upstream  ratelimit 0  threshold 1\n", 
    48                nvram_safe_get ("wan_iface")); 
    4949      fprintf (fp, "phyint %s downstream  ratelimit 0  threshold 1\n", 
    5050               nvram_safe_get ("lan_ifname")); 
    51       foreach (name, nvram_safe_get ("lan_ifnames"), next) 
     51      ifcount++; 
     52    } 
     53  foreach (name, nvram_safe_get ("lan_ifnames"), next) 
     54  { 
     55    if (nvram_nmatch ("0", "%s_bridged", name) 
     56        && nvram_nmatch ("1", "%s_multicast", name)) 
    5257      { 
    53         if (nvram_nmatch ("0", "%s_bridged", name) 
    54             && nvram_nmatch ("1", "%s_multicast", name)) 
    55           fprintf (fp, "phyint %s downstream  ratelimit 0  threshold 1\n", 
    56                    name); 
    57         else 
    58           fprintf (fp, "phyint %s disabled\n", name); 
     58        fprintf (fp, "phyint %s downstream  ratelimit 0  threshold 1\n", 
     59                 name); 
     60        ifcount++; 
    5961      } 
    60       fprintf (fp, "phyint lo disabled\n"); 
    61       fclose (fp); 
    62       if (nvram_match ("wan_proto", "disabled")) //todo: add upstream config 
    63       { 
     62    else 
     63      fprintf (fp, "phyint %s disabled\n", name); 
     64  } 
     65  fprintf (fp, "phyint lo disabled\n"); 
     66  fclose (fp); 
     67  if (nvram_match ("wan_proto", "disabled"))    //todo: add upstream config 
     68    { 
    6469//        ret = _evalpid (igmp_proxybr_argv, NULL, 0, &pid); 
    65         return ret; 
    66       } 
    67       else 
    68       ret = _evalpid(argv, NULL, 0, &pid); 
    69       syslog (LOG_INFO, "igmprt : multicast daemon successfully started\n"); 
     70      return ret; 
     71    } 
     72  else 
     73    { 
     74      if (ifcount) 
     75        { 
     76          ret = _evalpid (argv, NULL, 0, &pid); 
     77          syslog (LOG_INFO, 
     78                  "igmprt : multicast daemon successfully started\n"); 
     79        } 
    7080    } 
    7181 
Note: See TracChangeset for help on using the changeset viewer.