[package] pppd: use "atmdev" option to select the DSL adapter, this aligns it with...
[openwrt.git] / package / ppp / patches / 107-debian_pppatm_cleanup.patch
1 --- a/pppd/plugins/pppoatm/pppoatm.c
2 +++ b/pppd/plugins/pppoatm/pppoatm.c
3 @@ -70,18 +70,20 @@ static int setdevname_pppoatm(const char
4 {
5 struct sockaddr_atmpvc addr;
6 extern struct stat devstat;
7 +
8 if (device_got_set)
9 return 0;
10 - //info("PPPoATM setdevname_pppoatm: '%s'", cp);
11 +
12 memset(&addr, 0, sizeof addr);
13 if (text2atm(cp, (struct sockaddr *) &addr, sizeof(addr),
14 - T2A_PVC | T2A_NAME) < 0) {
15 - if(doit)
16 - info("atm does not recognize: %s", cp);
17 + T2A_PVC | T2A_NAME | T2A_WILDCARD) < 0) {
18 + if (doit)
19 + info("cannot parse the ATM address: %s", cp);
20 return 0;
21 - }
22 - if (!doit) return 1;
23 - //if (!dev_set_ok()) return -1;
24 + }
25 + if (!doit)
26 + return 1;
27 +
28 memcpy(&pvcaddr, &addr, sizeof pvcaddr);
29 strlcpy(devnam, cp, sizeof devnam);
30 devstat.st_mode = S_IFSOCK;
31 @@ -93,7 +95,6 @@ static int setdevname_pppoatm(const char
32 lcp_allowoptions[0].neg_asyncmap = 0;
33 lcp_wantoptions[0].neg_pcompression = 0;
34 }
35 - info("PPPoATM setdevname_pppoatm - SUCCESS:%s", cp);
36 device_got_set = 1;
37 return 1;
38 }
39 @@ -108,6 +109,7 @@ static void no_device_given_pppoatm(void
40 static void set_line_discipline_pppoatm(int fd)
41 {
42 struct atm_backend_ppp be;
43 +
44 be.backend_num = ATM_BACKEND_PPP;
45 if (!llc_encaps)
46 be.encaps = PPPOATM_ENCAPS_VC;
47 @@ -115,6 +117,7 @@ static void set_line_discipline_pppoatm(
48 be.encaps = PPPOATM_ENCAPS_LLC;
49 else
50 be.encaps = PPPOATM_ENCAPS_AUTODETECT;
51 +
52 if (ioctl(fd, ATM_SETBACKEND, &be) < 0)
53 fatal("ioctl(ATM_SETBACKEND): %m");
54 }
55 @@ -175,16 +178,19 @@ static void send_config_pppoa(int mtu,
56 {
57 int sock;
58 struct ifreq ifr;
59 +
60 if (mtu > pppoatm_max_mtu)
61 error("Couldn't increase MTU to %d", mtu);
62 +
63 sock = socket(AF_INET, SOCK_DGRAM, 0);
64 if (sock < 0)
65 fatal("Couldn't create IP socket: %m");
66 +
67 strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
68 ifr.ifr_mtu = mtu;
69 if (ioctl(sock, SIOCSIFMTU, (caddr_t) &ifr) < 0)
70 fatal("ioctl(SIOCSIFMTU): %m");
71 - (void) close (sock);
72 + close(sock);
73 }
74
75 static void recv_config_pppoa(int mru,
76 @@ -198,7 +204,7 @@ static void recv_config_pppoa(int mru,
77
78 void plugin_init(void)
79 {
80 -#if defined(__linux__)
81 +#ifdef linux
82 extern int new_style_driver; /* From sys-linux.c */
83 if (!ppp_available() && !new_style_driver)
84 fatal("Kernel doesn't support ppp_generic - "
85 @@ -206,9 +212,9 @@ void plugin_init(void)
86 #else
87 fatal("No PPPoATM support on this OS");
88 #endif
89 - info("PPPoATM plugin_init");
90 add_options(pppoa_options);
91 }
92 +
93 struct channel pppoa_channel = {
94 options: pppoa_options,
95 process_extra_options: NULL,
This page took 0.042762 seconds and 5 git commands to generate.