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