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