]>
Commit | Line | Data |
---|---|---|
a451f951 JB |
1 | --- br2684ctl-20040226.orig/br2684ctl.8 |
2 | +++ br2684ctl-20040226/br2684ctl.8 | |
3 | @@ -1,5 +1,5 @@ | |
4 | .\" | |
5 | -.TH br2684ctl 1 "7 Jul 2003" | |
6 | +.TH br2684ctl 8 "7 Jul 2003" | |
7 | .SH NAME | |
8 | br2684ctl \- RFC1483/2684 Bridge Daemon | |
9 | .SH SYNOPSIS | |
10 | @@ -68,6 +68,9 @@ | |
11 | also assign a Ethernet MAC address to the interface nas0, if necessary. | |
12 | ||
13 | % ifconfig nas0 192.168.2.1 netmask 255.255.255.0 | |
14 | + | |
15 | +Messages are logged to the LOCAL2 syslog facility. | |
16 | + | |
17 | .SH NOTES | |
18 | This man page is based on a tutorial by by Joonbum Byun <jbyun@megaxess.com> | |
19 | .SH SEE ALSO | |
20 | --- br2684ctl-20040226.orig/br2684ctl.c | |
21 | +++ br2684ctl-20040226/br2684ctl.c | |
22 | @@ -3,6 +3,8 @@ | |
23 | #include <unistd.h> | |
24 | #include <errno.h> | |
25 | #include <sys/ioctl.h> | |
26 | +#include <sys/types.h> | |
27 | +#include <signal.h> | |
28 | #include <string.h> | |
29 | #include <syslog.h> | |
30 | #include <atm.h> | |
31 | @@ -22,9 +24,9 @@ | |
32 | */ | |
33 | ||
34 | ||
35 | -#define LOG_NAME "RFC1483/2684 bridge" | |
36 | -#define LOG_OPTION LOG_PERROR | |
37 | -#define LOG_FACILITY LOG_LOCAL0 | |
38 | +#define LOG_NAME "br2684ctl" | |
39 | +#define LOG_OPTION LOG_PERROR|LOG_PID | |
40 | +#define LOG_FACILITY LOG_LOCAL2 | |
41 | ||
42 | ||
43 | int lastsock, lastitf; | |
44 | @@ -39,10 +41,16 @@ | |
45 | ||
46 | void exitFunc(void) | |
47 | { | |
48 | - syslog (LOG_PID,"Daemon terminated\n"); | |
49 | + syslog (LOG_NOTICE,"Daemon terminated\n"); | |
50 | } | |
51 | ||
52 | ||
53 | +void int_signal(int dummy) | |
54 | +{ | |
55 | + syslog (LOG_INFO,"Killed by a signal\n"); | |
56 | + exit(0); | |
57 | +} | |
58 | + | |
59 | int create_pidfile(int num) | |
60 | { | |
61 | FILE *pidfile = NULL; | |
62 | @@ -80,7 +88,7 @@ | |
63 | err=ioctl (lastsock, ATM_NEWBACKENDIF, &ni); | |
64 | ||
65 | if (err == 0) | |
66 | - syslog(LOG_INFO, "Interface \"%s\" created sucessfully\n",ni.ifname); | |
67 | + syslog(LOG_NOTICE, "Interface \"%s\" created sucessfully\n",ni.ifname); | |
68 | else | |
69 | syslog(LOG_INFO, "Interface \"%s\" could not be created, reason: %s\n", | |
70 | ni.ifname, | |
71 | @@ -112,7 +120,7 @@ | |
72 | addr.sap_addr.vpi = 0; | |
73 | addr.sap_addr.vci = vci; | |
74 | #endif | |
75 | - syslog(LOG_INFO,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf, | |
76 | + syslog(LOG_NOTICE,"Communicating over ATM %d.%d.%d, encapsulation: %s\n", addr.sap_addr.itf, | |
77 | addr.sap_addr.vpi, | |
78 | addr.sap_addr.vci, | |
79 | encap?"VC mux":"LLC"); | |
80 | @@ -261,11 +269,13 @@ | |
81 | } | |
82 | ||
83 | create_pidfile(itfnum); | |
84 | + signal(SIGINT, int_signal); | |
85 | + signal(SIGTERM, int_signal); | |
86 | ||
87 | syslog (LOG_INFO, "RFC 1483/2684 bridge daemon started\n"); | |
88 | atexit (exitFunc); | |
89 | ||
90 | - while (1) sleep(30); /* to keep the sockets... */ | |
91 | + while (1) pause(); /* to keep the sockets... */ | |
92 | return 0; | |
93 | } | |
94 | ||
95 | --- br2684ctl-20040226.orig/Makefile | |
96 | +++ br2684ctl-20040226/Makefile | |
97 | @@ -0,0 +1,13 @@ | |
98 | +OPTS := -O2 | |
99 | +CFLAGS := -Wall -g | |
100 | +LIBS := -latm | |
101 | + | |
102 | +all: br2684ctl | |
103 | + | |
104 | +br2684ctl: br2684ctl.c | |
105 | + $(CC) $(OPTS) $(CFLAGS) $< $(LIBS) -o $@ | |
106 | + | |
107 | +distclean: clean | |
108 | +clean: | |
109 | + rm -f br2684ctl | |
110 | + |