upgrade to new version of br2684ctl
[openwrt/svn-archive/archive.git] / package / br2684ctl / patches / 100-debian.patch
1 --- br2684ctl-20040226.orig/br2684ctl.c
2 +++ br2684ctl-20040226/br2684ctl.c
3 @@ -3,6 +3,8 @@
4 #include <unistd.h>
5 #include <errno.h>
6 #include <sys/ioctl.h>
7 +#include <sys/types.h>
8 +#include <signal.h>
9 #include <string.h>
10 #include <syslog.h>
11 #include <atm.h>
12 @@ -22,9 +24,9 @@
13 */
14
15
16 -#define LOG_NAME "RFC1483/2684 bridge"
17 -#define LOG_OPTION LOG_PERROR
18 -#define LOG_FACILITY LOG_LOCAL0
19 +#define LOG_NAME "br2684ctl"
20 +#define LOG_OPTION LOG_PERROR|LOG_PID
21 +#define LOG_FACILITY LOG_LOCAL2
22
23
24 int lastsock, lastitf;
25 @@ -39,10 +41,16 @@
26
27 void exitFunc(void)
28 {
29 - syslog (LOG_PID,"Daemon terminated\n");
30 + syslog (LOG_NOTICE,"Daemon terminated\n");
31 }
32
33
34 +void int_signal(int dummy)
35 +{
36 + syslog (LOG_INFO,"Killed by a signal\n");
37 + exit(0);
38 +}
39 +
40 int create_pidfile(int num)
41 {
42 FILE *pidfile = NULL;
43 @@ -80,7 +88,7 @@
44 err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
45
46 if (err == 0)
47 - syslog(LOG_INFO, "Interface \"%s\" created sucessfully\n",ni.ifname);
48 + syslog(LOG_NOTICE, "Interface \"%s\" created sucessfully\n",ni.ifname);
49 else
50 syslog(LOG_INFO, "Interface \"%s\" could not be created, reason: %s\n",
51 ni.ifname,
52 @@ -112,7 +120,7 @@
53 addr.sap_addr.vpi = 0;
54 addr.sap_addr.vci = vci;
55 #endif
56 - syslog(LOG_INFO,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
57 + syslog(LOG_NOTICE,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
58 addr.sap_addr.vpi,
59 addr.sap_addr.vci,
60 encap?"VC mux":"LLC");
61 @@ -261,11 +269,13 @@
62 }
63
64 create_pidfile(itfnum);
65 + signal(SIGINT, int_signal);
66 + signal(SIGTERM, int_signal);
67
68 syslog (LOG_INFO, "RFC 1483/2684 bridge daemon started\n");
69 atexit (exitFunc);
70
71 - while (1) sleep(30); /* to keep the sockets... */
72 + while (1) pause(); /* to keep the sockets... */
73 return 0;
74 }
75
76 --- br2684ctl-20040226.orig/Makefile
77 +++ br2684ctl-20040226/Makefile
78 @@ -0,0 +1,13 @@
79 +OPTS := -O2
80 +CFLAGS := -Wall -g
81 +LIBS := -latm
82 +
83 +all: br2684ctl
84 +
85 +br2684ctl: br2684ctl.c
86 + $(CC) $(OPTS) $(CFLAGS) $(LIBS) $< -o $@
87 +
88 +distclean: clean
89 +clean:
90 + rm -f br2684ctl
91 +