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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
@@ -70,18 +70,20 @@
{
struct sockaddr_atmpvc addr;
extern struct stat devstat;
+
if (device_got_set)
return 0;
- //info("PPPoATM setdevname_pppoatm: '%s'", cp);
+
memset(&addr, 0, sizeof addr);
if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
- T2A_PVC | T2A_NAME) < 0) {
- if(doit)
- info("atm does not recognize: %s", cp);
+ T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
+ if (doit)
+ info("cannot parse the ATM address: %s", cp);
return 0;
- }
- if (!doit) return 1;
- //if (!dev_set_ok()) return -1;
+ }
+ if (!doit)
+ return 1;
+
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
strlcpy(devnam, cp, sizeof devnam);
devstat.st_mode = S_IFSOCK;
@@ -93,7 +95,6 @@
lcp_allowoptions[0].neg_asyncmap = 0;
lcp_wantoptions[0].neg_pcompression = 0;
}
- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
device_got_set = 1;
return 1;
}
@@ -108,6 +109,7 @@
static void set_line_discipline_pppoatm(int fd)
{
struct atm_backend_ppp be;
+
be.backend_num = ATM_BACKEND_PPP;
if (!llc_encaps)
be.encaps = PPPOATM_ENCAPS_VC;
@@ -115,6 +117,7 @@
be.encaps = PPPOATM_ENCAPS_LLC;
else
be.encaps = PPPOATM_ENCAPS_AUTODETECT;
+
if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
fatal("ioctl(ATM_SETBACKEND): %m");
}
@@ -175,16 +178,19 @@
{
int sock;
struct ifreq ifr;
+
if (mtu > pppoatm_max_mtu)
error("Couldn't increase MTU to %d", mtu);
+
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
fatal("Couldn't create IP socket: %m");
+
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_mtu = mtu;
if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
fatal("ioctl(SIOCSIFMTU): %m");
- (void) close (sock);
+ close(sock);
}
static void recv_config_pppoa(int mru,
@@ -198,7 +204,7 @@
void plugin_init(void)
{
-#if defined(__linux__)
+#ifdef linux
extern int new_style_driver; /* From sys-linux.c */
if (!ppp_available() && !new_style_driver)
fatal("Kernel doesn't support ppp_generic - "
@@ -206,9 +212,9 @@
#else
fatal("No PPPoATM support on this OS");
#endif
- info("PPPoATM plugin_init");
add_options(pppoa_options);
}
+
struct channel pppoa_channel = {
options: pppoa_options,
process_extra_options: NULL,
diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c
--- ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c 2006-05-21 08:44:41.000000000 -0400
+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:22:22.000000000 -0400
@@ -70,18 +70,20 @@
{
struct sockaddr_atmpvc addr;
extern struct stat devstat;
+
if (device_got_set)
return 0;
- //info("PPPoATM setdevname_pppoatm: '%s'", cp);
+
memset(&addr, 0, sizeof addr);
if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
- T2A_PVC | T2A_NAME) < 0) {
- if(doit)
- info("atm does not recognize: %s", cp);
+ T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
+ if (doit)
+ info("cannot parse the ATM address: %s", cp);
return 0;
- }
- if (!doit) return 1;
- //if (!dev_set_ok()) return -1;
+ }
+ if (!doit)
+ return 1;
+
memcpy(&pvcaddr, &addr, sizeof pvcaddr);
strlcpy(devnam, cp, sizeof devnam);
devstat.st_mode = S_IFSOCK;
@@ -93,7 +95,6 @@
lcp_allowoptions[0].neg_asyncmap = 0;
lcp_wantoptions[0].neg_pcompression = 0;
}
- info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
device_got_set = 1;
return 1;
}
@@ -108,6 +109,7 @@
static void set_line_discipline_pppoatm(int fd)
{
struct atm_backend_ppp be;
+
be.backend_num = ATM_BACKEND_PPP;
if (!llc_encaps)
be.encaps = PPPOATM_ENCAPS_VC;
@@ -115,6 +117,7 @@
be.encaps = PPPOATM_ENCAPS_LLC;
else
be.encaps = PPPOATM_ENCAPS_AUTODETECT;
+
if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
fatal("ioctl(ATM_SETBACKEND): %m");
}
@@ -175,16 +178,19 @@
{
int sock;
struct ifreq ifr;
+
if (mtu > pppoatm_max_mtu)
error("Couldn't increase MTU to %d", mtu);
+
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0)
fatal("Couldn't create IP socket: %m");
+
strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
ifr.ifr_mtu = mtu;
if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
fatal("ioctl(SIOCSIFMTU): %m");
- (void) close (sock);
+ close(sock);
}
static void recv_config_pppoa(int mru,
@@ -198,7 +204,7 @@
void plugin_init(void)
{
-#if defined(__linux__)
+#ifdef linux
extern int new_style_driver; /* From sys-linux.c */
if (!ppp_available() && !new_style_driver)
fatal("Kernel doesn't support ppp_generic - "
@@ -206,9 +212,9 @@
#else
fatal("No PPPoATM support on this OS");
#endif
- info("PPPoATM plugin_init");
add_options(pppoa_options);
}
+
struct channel pppoa_channel = {
options: pppoa_options,
process_extra_options: NULL,
|