summaryrefslogtreecommitdiffstats
path: root/package/br2684ctl/patches/100-debian.patch
blob: 45f63640dadbe0164bdf77ef930b418419c1473f (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Index: br2684ctl-20040226.orig/br2684ctl.c
===================================================================
--- br2684ctl-20040226.orig.orig/br2684ctl.c	2007-06-04 13:22:22.142489112 +0200
+++ br2684ctl-20040226.orig/br2684ctl.c	2007-06-04 13:22:22.213478320 +0200
@@ -3,6 +3,8 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/ioctl.h>
+#include <sys/types.h>
+#include <signal.h>
 #include <string.h>
 #include <syslog.h>
 #include <atm.h>
@@ -22,9 +24,9 @@
 */
 
 
-#define LOG_NAME "RFC1483/2684 bridge"
-#define LOG_OPTION     LOG_PERROR
-#define LOG_FACILITY   LOG_LOCAL0
+#define LOG_NAME       "br2684ctl"
+#define LOG_OPTION     LOG_PERROR|LOG_PID
+#define LOG_FACILITY   LOG_LOCAL2
 
 
 int lastsock, lastitf;
@@ -39,10 +41,16 @@
 
 void exitFunc(void)
 {
-  syslog (LOG_PID,"Daemon terminated\n");	
+  syslog (LOG_NOTICE,"Daemon terminated\n");
 }
 
 
+void int_signal(int dummy)
+{
+  syslog (LOG_INFO,"Killed by a signal\n");
+  exit(0);
+}
+
 int create_pidfile(int num)
 {
   FILE *pidfile = NULL;
@@ -80,7 +88,7 @@
       err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni);
   
       if (err == 0)
-	syslog(LOG_INFO, "Interface \"%s\" created sucessfully\n",ni.ifname);
+	syslog(LOG_NOTICE, "Interface \"%s\" created sucessfully\n",ni.ifname);
       else
 	syslog(LOG_INFO, "Interface \"%s\" could not be created, reason: %s\n",
 	       ni.ifname,
@@ -112,7 +120,7 @@
     addr.sap_addr.vpi = 0;
     addr.sap_addr.vci = vci;
 #endif
-    syslog(LOG_INFO,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
+    syslog(LOG_NOTICE,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf,
 	   addr.sap_addr.vpi,
 	   addr.sap_addr.vci,
 	   encap?"VC mux":"LLC");
@@ -261,11 +269,13 @@
   }
   
   create_pidfile(itfnum);
+  signal(SIGINT, int_signal);
+  signal(SIGTERM, int_signal);
 
   syslog (LOG_INFO, "RFC 1483/2684 bridge daemon started\n");	
   atexit (exitFunc);
   
-  while (1) sleep(30);	/* to keep the sockets... */
+  while (1) pause();	/* to keep the sockets... */
   return 0;
 }
 
Index: br2684ctl-20040226.orig/Makefile
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ br2684ctl-20040226.orig/Makefile	2007-06-04 13:22:22.215478016 +0200
@@ -0,0 +1,13 @@
+OPTS := -O2
+CFLAGS := -Wall -g
+LIBS := -latm
+
+all: br2684ctl
+
+br2684ctl: br2684ctl.c
+	$(CC) $(OPTS) $(CFLAGS) $(LIBS) $< -o $@
+
+distclean: clean
+clean:
+	rm -f br2684ctl
+