b258031d888a50da5185a71f786e63b44fd4d6b2
[openwrt.git] / package / ppp / patches / 107-debian_pppatm_cleanup.patch
1 diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
2 --- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
3 +++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
4 @@ -70,18 +70,20 @@
5 {
6 struct sockaddr_atmpvc addr;
7 extern struct stat devstat;
8 +
9 if (device_got_set)
10 return 0;
11 - //info("PPPoATM setdevname_pppoatm: '%s'", cp);
12 +
13 memset(&addr, 0, sizeof addr);
14 if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
15 - T2A_PVC | T2A_NAME) < 0) {
16 - if(doit)
17 - info("atm does not recognize: %s", cp);
18 + T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
19 + if (doit)
20 + info("cannot parse the ATM address: %s", cp);
21 return 0;
22 - }
23 - if (!doit) return 1;
24 - //if (!dev_set_ok()) return -1;
25 + }
26 + if (!doit)
27 + return 1;
28 +
29 memcpy(&pvcaddr, &addr, sizeof pvcaddr);
30 strlcpy(devnam, cp, sizeof devnam);
31 devstat.st_mode = S_IFSOCK;
32 @@ -93,7 +95,6 @@
33 lcp_allowoptions[0].neg_asyncmap = 0;
34 lcp_wantoptions[0].neg_pcompression = 0;
35 }
36 - info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
37 device_got_set = 1;
38 return 1;
39 }
40 @@ -108,6 +109,7 @@
41 static void set_line_discipline_pppoatm(int fd)
42 {
43 struct atm_backend_ppp be;
44 +
45 be.backend_num = ATM_BACKEND_PPP;
46 if (!llc_encaps)
47 be.encaps = PPPOATM_ENCAPS_VC;
48 @@ -115,6 +117,7 @@
49 be.encaps = PPPOATM_ENCAPS_LLC;
50 else
51 be.encaps = PPPOATM_ENCAPS_AUTODETECT;
52 +
53 if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
54 fatal("ioctl(ATM_SETBACKEND): %m");
55 }
56 @@ -175,16 +178,19 @@
57 {
58 int sock;
59 struct ifreq ifr;
60 +
61 if (mtu > pppoatm_max_mtu)
62 error("Couldn't increase MTU to %d", mtu);
63 +
64 sock = socket(AF_INET, SOCK_DGRAM, 0);
65 if (sock < 0)
66 fatal("Couldn't create IP socket: %m");
67 +
68 strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
69 ifr.ifr_mtu = mtu;
70 if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
71 fatal("ioctl(SIOCSIFMTU): %m");
72 - (void) close (sock);
73 + close(sock);
74 }
75
76 static void recv_config_pppoa(int mru,
77 @@ -198,7 +204,7 @@
78
79 void plugin_init(void)
80 {
81 -#if defined(__linux__)
82 +#ifdef linux
83 extern int new_style_driver; /* From sys-linux.c */
84 if (!ppp_available() && !new_style_driver)
85 fatal("Kernel doesn't support ppp_generic - "
86 @@ -206,9 +212,9 @@
87 #else
88 fatal("No PPPoATM support on this OS");
89 #endif
90 - info("PPPoATM plugin_init");
91 add_options(pppoa_options);
92 }
93 +
94 struct channel pppoa_channel = {
95 options: pppoa_options,
96 process_extra_options: NULL,
97 diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
98 --- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
99 +++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
100 @@ -70,18 +70,20 @@
101 {
102 struct sockaddr_atmpvc addr;
103 extern struct stat devstat;
104 +
105 if (device_got_set)
106 return 0;
107 - //info("PPPoATM setdevname_pppoatm: '%s'", cp);
108 +
109 memset(&addr, 0, sizeof addr);
110 if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
111 - T2A_PVC | T2A_NAME) < 0) {
112 - if(doit)
113 - info("atm does not recognize: %s", cp);
114 + T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
115 + if (doit)
116 + info("cannot parse the ATM address: %s", cp);
117 return 0;
118 - }
119 - if (!doit) return 1;
120 - //if (!dev_set_ok()) return -1;
121 + }
122 + if (!doit)
123 + return 1;
124 +
125 memcpy(&pvcaddr, &addr, sizeof pvcaddr);
126 strlcpy(devnam, cp, sizeof devnam);
127 devstat.st_mode = S_IFSOCK;
128 @@ -93,7 +95,6 @@
129 lcp_allowoptions[0].neg_asyncmap = 0;
130 lcp_wantoptions[0].neg_pcompression = 0;
131 }
132 - info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
133 device_got_set = 1;
134 return 1;
135 }
136 @@ -108,6 +109,7 @@
137 static void set_line_discipline_pppoatm(int fd)
138 {
139 struct atm_backend_ppp be;
140 +
141 be.backend_num = ATM_BACKEND_PPP;
142 if (!llc_encaps)
143 be.encaps = PPPOATM_ENCAPS_VC;
144 @@ -115,6 +117,7 @@
145 be.encaps = PPPOATM_ENCAPS_LLC;
146 else
147 be.encaps = PPPOATM_ENCAPS_AUTODETECT;
148 +
149 if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
150 fatal("ioctl(ATM_SETBACKEND): %m");
151 }
152 @@ -175,16 +178,19 @@
153 {
154 int sock;
155 struct ifreq ifr;
156 +
157 if (mtu > pppoatm_max_mtu)
158 error("Couldn't increase MTU to %d", mtu);
159 +
160 sock = socket(AF_INET, SOCK_DGRAM, 0);
161 if (sock < 0)
162 fatal("Couldn't create IP socket: %m");
163 +
164 strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
165 ifr.ifr_mtu = mtu;
166 if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
167 fatal("ioctl(SIOCSIFMTU): %m");
168 - (void) close (sock);
169 + close(sock);
170 }
171
172 static void recv_config_pppoa(int mru,
173 @@ -198,7 +204,7 @@
174
175 void plugin_init(void)
176 {
177 -#if defined(__linux__)
178 +#ifdef linux
179 extern int new_style_driver; /* From sys-linux.c */
180 if (!ppp_available() && !new_style_driver)
181 fatal("Kernel doesn't support ppp_generic - "
182 @@ -206,9 +212,9 @@
183 #else
184 fatal("No PPPoATM support on this OS");
185 #endif
186 - info("PPPoATM plugin_init");
187 add_options(pppoa_options);
188 }
189 +
190 struct channel pppoa_channel = {
191 options: pppoa_options,
192 process_extra_options: NULL,
This page took 0.05226 seconds and 3 git commands to generate.