2
0

500-br2684ctl_script.patch 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --- a/src/br2684/br2684ctl.c
  2. +++ b/src/br2684/br2684ctl.c
  3. @@ -1,3 +1,4 @@
  4. +#define _GNU_SOURCE
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <unistd.h>
  8. @@ -43,6 +44,7 @@ struct br2684_params {
  9. int lastsock, lastitf;
  10. +static char *up_script;
  11. void fatal(const char *str, int err)
  12. @@ -185,6 +187,8 @@ int assign_vcc(char *astr, int encap, in
  13. void start_interface(struct br2684_params* params)
  14. {
  15. + char *cmd;
  16. +
  17. if (params->astr==NULL) {
  18. syslog(LOG_ERR, "Required ATM parameters not specified.");
  19. exit(1);
  20. @@ -193,13 +197,18 @@ void start_interface(struct br2684_param
  21. create_br(params->itfnum, params->payload);
  22. assign_vcc(params->astr, params->encap, params->payload, params->sndbuf,
  23. params->reqqos);
  24. + if (up_script) {
  25. + asprintf(&cmd, "%s nas%d", up_script, lastitf);
  26. + system(cmd);
  27. + free(cmd);
  28. + }
  29. }
  30. void usage(char *s)
  31. {
  32. printf("usage: %s [-b] [[-c number] [-e 0|1] [-s sndbuf] [-q qos] [-p 0|1] "
  33. - "[-a [itf.]vpi.vci]*]*\n", s);
  34. + "[-a [itf.]vpi.vci]*]* [-S script]\n", s);
  35. printf(" encapsulations: 0=llc, 1=vcmux\n payloads: 0=routed, 1=bridged\n");
  36. exit(1);
  37. }
  38. @@ -225,7 +234,7 @@ int main (int argc, char **argv)
  39. openlog (LOG_NAME,LOG_OPTION,LOG_FACILITY);
  40. if (argc>1)
  41. - while ((c = getopt(argc, argv,"q:a:bc:e:s:p:?h")) !=EOF)
  42. + while ((c = getopt(argc, argv,"q:a:bc:e:s:S:p:?h")) !=EOF)
  43. switch (c) {
  44. case 'q':
  45. printf ("optarg : %s",optarg);
  46. @@ -258,6 +267,9 @@ int main (int argc, char **argv)
  47. params.sndbuf=8192;
  48. }
  49. break;
  50. + case 'S':
  51. + up_script = optarg;
  52. + break;
  53. case 'p': /* payload type: routed (0) or bridged (1) */
  54. #ifdef BR2684_FLAG_ROUTED
  55. params.payload = atoi(optarg);