From: Hauke Mehrtens Date: Thu, 21 May 2009 10:48:24 +0000 (+0000) Subject: Make patches apply agagin. The deleted parts were two times in the patches. X-Git-Tag: reboot~23502 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b97b54291da149cf68a6db878aae2f92962e1cad;p=openwrt%2Fstaging%2Flynxis.git Make patches apply agagin. The deleted parts were two times in the patches. SVN-Revision: 15957 --- diff --git a/package/ppp/patches/100-debian_ip-ip_option.patch b/package/ppp/patches/100-debian_ip-ip_option.patch index 2b64ba874e..9b4c4dcbd9 100644 --- a/package/ppp/patches/100-debian_ip-ip_option.patch +++ b/package/ppp/patches/100-debian_ip-ip_option.patch @@ -86,91 +86,3 @@ diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h extern bool multilink; /* enable multilink operation */ extern bool noendpoint; /* don't send or accept endpt. discrim. */ extern char *bundle_name; /* bundle name for multilink */ -diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c ---- ppp-2.4.4.orig/pppd/ipcp.c 2005-08-25 19:59:34.000000000 -0400 -+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 15:47:29.000000000 -0400 -@@ -1850,7 +1850,7 @@ - */ - if (ipcp_script_state == s_down && ipcp_script_pid == 0) { - ipcp_script_state = s_up; -- ipcp_script(_PATH_IPUP, 0); -+ ipcp_script(path_ipup, 0); - } - } - -@@ -1900,7 +1900,7 @@ - /* Execute the ip-down script */ - if (ipcp_script_state == s_up && ipcp_script_pid == 0) { - ipcp_script_state = s_down; -- ipcp_script(_PATH_IPDOWN, 0); -+ ipcp_script(path_ipdown, 0); - } - } - -@@ -1954,13 +1954,13 @@ - case s_up: - if (ipcp_fsm[0].state != OPENED) { - ipcp_script_state = s_down; -- ipcp_script(_PATH_IPDOWN, 0); -+ ipcp_script(path_ipdown, 0); - } - break; - case s_down: - if (ipcp_fsm[0].state == OPENED) { - ipcp_script_state = s_up; -- ipcp_script(_PATH_IPUP, 0); -+ ipcp_script(path_ipup, 0); - } - break; - } -diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c ---- ppp-2.4.4.orig/pppd/main.c 2006-06-03 23:52:50.000000000 -0400 -+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:47:29.000000000 -0400 -@@ -315,6 +315,9 @@ - struct protent *protp; - char numbuf[16]; - -+ strlcpy(path_ipup, _PATH_IPUP, sizeof(path_ipup)); -+ strlcpy(path_ipdown, _PATH_IPDOWN, sizeof(path_ipdown)); -+ - link_stats_valid = 0; - new_phase(PHASE_INITIALIZE); - -diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c ---- ppp-2.4.4.orig/pppd/options.c 2006-06-18 07:26:00.000000000 -0400 -+++ ppp-2.4.4/pppd/options.c 2009-05-07 15:47:29.000000000 -0400 -@@ -113,6 +113,8 @@ - bool tune_kernel; /* may alter kernel settings */ - int connect_delay = 1000; /* wait this many ms after connect script */ - int req_unit = -1; /* requested interface unit */ -+char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ -+char path_ipdown[MAXPATHLEN];/* pathname of ip-down script */ - bool multilink = 0; /* Enable multilink operation */ - char *bundle_name = NULL; /* bundle name for multilink */ - bool dump_options; /* print out option values */ -@@ -281,6 +283,13 @@ - "Number of seconds to wait for child processes at exit", - OPT_PRIO }, - -+ { "ip-up-script", o_string, path_ipup, -+ "Set pathname of ip-up script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ { "ip-down-script", o_string, path_ipdown, -+ "Set pathname of ip-down script", -+ OPT_PRIV|OPT_STATIC, NULL, MAXPATHLEN }, -+ - #ifdef HAVE_MULTILINK - { "multilink", o_bool, &multilink, - "Enable multilink operation", OPT_PRIO | 1 }, -diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h ---- ppp-2.4.4.orig/pppd/pppd.h 2005-08-25 19:59:34.000000000 -0400 -+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 15:47:29.000000000 -0400 -@@ -312,6 +312,8 @@ - extern int connect_delay; /* Time to delay after connect script */ - extern int max_data_rate; /* max bytes/sec through charshunt */ - extern int req_unit; /* interface unit number to use */ -+extern char path_ipup[MAXPATHLEN]; /* pathname of ip-up script */ -+extern char path_ipdown[MAXPATHLEN]; /* pathname of ip-down script */ - extern bool multilink; /* enable multilink operation */ - extern bool noendpoint; /* don't send or accept endpt. discrim. */ - extern char *bundle_name; /* bundle name for multilink */ diff --git a/package/ppp/patches/101-debian_close_dev_ppp.patch b/package/ppp/patches/101-debian_close_dev_ppp.patch index 84f29d4df8..4ec30d6613 100644 --- a/package/ppp/patches/101-debian_close_dev_ppp.patch +++ b/package/ppp/patches/101-debian_close_dev_ppp.patch @@ -15,20 +15,3 @@ diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c /* Open an instance of /dev/ppp and connect the channel to it */ if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) { error("Couldn't get channel number: %m"); -diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c ---- ppp-2.4.4.orig/pppd/sys-linux.c 2005-08-26 18:44:35.000000000 -0400 -+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-07 15:50:00.000000000 -0400 -@@ -453,6 +453,13 @@ - if (new_style_driver) { - int flags; - -+ /* if a ppp_fd is already open, close it first */ -+ if(ppp_fd > 0) { -+ close(ppp_fd); -+ remove_fd(ppp_fd); -+ ppp_fd = -1; -+ } -+ - /* Open an instance of /dev/ppp and connect the channel to it */ - if (ioctl(fd, PPPIOCGCHAN, &chindex) == -1) { - error("Couldn't get channel number: %m"); diff --git a/package/ppp/patches/102-debian_fix_close_fd0.patch b/package/ppp/patches/102-debian_fix_close_fd0.patch index d675df3412..e8183ec54b 100644 --- a/package/ppp/patches/102-debian_fix_close_fd0.patch +++ b/package/ppp/patches/102-debian_fix_close_fd0.patch @@ -18,23 +18,3 @@ diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c if (log_to_fd > 2) close(log_to_fd); if (the_channel->close) -diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c ---- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:49:34.000000000 -0400 -+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:53:42.000000000 -0400 -@@ -1570,6 +1570,8 @@ - if (errfd == 0 || errfd == 1) - errfd = dup(errfd); - -+ closelog(); -+ - /* dup the in, out, err fds to 0, 1, 2 */ - if (infd != 0) - dup2(infd, 0); -@@ -1578,7 +1580,6 @@ - if (errfd != 2) - dup2(errfd, 2); - -- closelog(); - if (log_to_fd > 2) - close(log_to_fd); - if (the_channel->close) diff --git a/package/ppp/patches/103-debian_fix_link_pidfile.patch b/package/ppp/patches/103-debian_fix_link_pidfile.patch index 6b333d9979..69702d0420 100644 --- a/package/ppp/patches/103-debian_fix_link_pidfile.patch +++ b/package/ppp/patches/103-debian_fix_link_pidfile.patch @@ -11,16 +11,3 @@ diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c exit(0); /* parent dies */ } setsid(); -diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c ---- ppp-2.4.4.orig/pppd/main.c 2009-05-07 15:58:00.000000000 -0400 -+++ ppp-2.4.4/pppd/main.c 2009-05-07 15:58:19.000000000 -0400 -@@ -772,8 +772,7 @@ - /* update pid files if they have been written already */ - if (pidfilename[0]) - create_pidfile(pid); -- if (linkpidfile[0]) -- create_linkpidfile(pid); -+ create_linkpidfile(pid); - exit(0); /* parent dies */ - } - setsid(); diff --git a/package/ppp/patches/104-debian_fix_mschapv2_ppp.patch b/package/ppp/patches/104-debian_fix_mschapv2_ppp.patch index 231615708f..5322ef068c 100644 --- a/package/ppp/patches/104-debian_fix_mschapv2_ppp.patch +++ b/package/ppp/patches/104-debian_fix_mschapv2_ppp.patch @@ -10,15 +10,3 @@ diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c /* Generate the Peer-Challenge if requested, or copy it if supplied. */ if (!PeerChallenge) -diff -Naur ppp-2.4.4.orig/pppd/chap_ms.c ppp-2.4.4/pppd/chap_ms.c ---- ppp-2.4.4.orig/pppd/chap_ms.c 2006-05-21 07:56:40.000000000 -0400 -+++ ppp-2.4.4/pppd/chap_ms.c 2009-05-07 16:13:09.000000000 -0400 -@@ -852,7 +852,7 @@ - u_char *p = &response[MS_CHAP2_PEER_CHALLENGE]; - int i; - -- BZERO(response, sizeof(*response)); -+ BZERO(response, MS_CHAP2_RESPONSE_LEN); - - /* Generate the Peer-Challenge if requested, or copy it if supplied. */ - if (!PeerChallenge) diff --git a/package/ppp/patches/105-debian_demand.patch b/package/ppp/patches/105-debian_demand.patch index 6c374174c4..be53c81b93 100644 --- a/package/ppp/patches/105-debian_demand.patch +++ b/package/ppp/patches/105-debian_demand.patch @@ -174,179 +174,3 @@ diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ -diff -Naur ppp-2.4.4.orig/pppd/demand.c ppp-2.4.4/pppd/demand.c ---- ppp-2.4.4.orig/pppd/demand.c 2005-08-25 08:14:18.000000000 -0400 -+++ ppp-2.4.4/pppd/demand.c 2009-05-07 16:16:20.000000000 -0400 -@@ -36,6 +36,8 @@ - #include - #include - #include -+#include -+#include - #include - #include - #include -@@ -43,6 +45,8 @@ - #include - #include - #include -+#include -+#include - #ifdef PPP_FILTER - #include - #endif -@@ -221,6 +225,14 @@ - int c, rv; - - rv = 0; -+ -+/* check for synchronous connection... */ -+ -+ if ( (p[0] == 0xFF) && (p[1] == 0x03) ) { -+ rv = loop_frame(p,n); -+ return rv; -+ } -+ - for (; n > 0; --n) { - c = *p++; - if (c == PPP_FLAG) { -@@ -299,17 +311,102 @@ - * loopback, now that the real serial link is up. - */ - void --demand_rexmit(proto) -+demand_rexmit(proto, newip) - int proto; -+ u_int32_t newip; - { - struct packet *pkt, *prev, *nextpkt; -+ unsigned short checksum; -+ unsigned short pkt_checksum = 0; -+ unsigned iphdr; -+ struct timeval tv; -+ char cv = 0; -+ char ipstr[16]; - - prev = NULL; - pkt = pend_q; - pend_q = NULL; -+ tv.tv_sec = 1; -+ tv.tv_usec = 0; -+ select(0,NULL,NULL,NULL,&tv); /* Sleep for 1 Seconds */ - for (; pkt != NULL; pkt = nextpkt) { - nextpkt = pkt->next; - if (PPP_PROTOCOL(pkt->data) == proto) { -+ if ( (proto == PPP_IP) && newip ) { -+ /* Get old checksum */ -+ -+ iphdr = (pkt->data[4] & 15) << 2; -+ checksum = *((unsigned short *) (pkt->data+14)); -+ if (checksum == 0xFFFF) { -+ checksum = 0; -+ } -+ -+ -+ if (pkt->data[13] == 17) { -+ pkt_checksum = *((unsigned short *) (pkt->data+10+iphdr)); -+ if (pkt_checksum) { -+ cv = 1; -+ if (pkt_checksum == 0xFFFF) { -+ pkt_checksum = 0; -+ } -+ } -+ else { -+ cv = 0; -+ } -+ } -+ -+ if (pkt->data[13] == 6) { -+ pkt_checksum = *((unsigned short *) (pkt->data+20+iphdr)); -+ cv = 1; -+ if (pkt_checksum == 0xFFFF) { -+ pkt_checksum = 0; -+ } -+ } -+ -+ /* Delete old Source-IP-Address */ -+ checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; -+ checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; -+ -+ pkt_checksum -= *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; -+ pkt_checksum -= *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; -+ -+ /* Change Source-IP-Address */ -+ * ((u_int32_t *) (pkt->data + 16)) = newip; -+ -+ /* Add new Source-IP-Address */ -+ checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; -+ checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; -+ -+ pkt_checksum += *((unsigned short *) (pkt->data+16)) ^ 0xFFFF; -+ pkt_checksum += *((unsigned short *) (pkt->data+18)) ^ 0xFFFF; -+ -+ /* Write new checksum */ -+ if (!checksum) { -+ checksum = 0xFFFF; -+ } -+ *((unsigned short *) (pkt->data+14)) = checksum; -+ if (pkt->data[13] == 6) { -+ *((unsigned short *) (pkt->data+20+iphdr)) = pkt_checksum; -+ } -+ if (cv && (pkt->data[13] == 17) ) { -+ *((unsigned short *) (pkt->data+10+iphdr)) = pkt_checksum; -+ } -+ -+ /* Log Packet */ -+ strcpy(ipstr,inet_ntoa(*( (struct in_addr *) (pkt->data+16)))); -+ if (pkt->data[13] == 1) { -+ syslog(LOG_INFO,"Open ICMP %s -> %s\n", -+ ipstr, -+ inet_ntoa(*( (struct in_addr *) (pkt->data+20)))); -+ } else { -+ syslog(LOG_INFO,"Open %s %s:%d -> %s:%d\n", -+ pkt->data[13] == 6 ? "TCP" : "UDP", -+ ipstr, -+ ntohs(*( (short *) (pkt->data+iphdr+4))), -+ inet_ntoa(*( (struct in_addr *) (pkt->data+20))), -+ ntohs(*( (short *) (pkt->data+iphdr+6)))); -+ } -+ } - output(0, pkt->data, pkt->length); - free(pkt); - } else { -diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c ---- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-07 15:49:34.000000000 -0400 -+++ ppp-2.4.4/pppd/ipcp.c 2009-05-07 16:16:20.000000000 -0400 -@@ -1776,7 +1776,7 @@ - proxy_arp_set[f->unit] = 1; - - } -- demand_rexmit(PPP_IP); -+ demand_rexmit(PPP_IP,go->ouraddr); - sifnpmode(f->unit, PPP_IP, NPMODE_PASS); - - } else { -diff -Naur ppp-2.4.4.orig/pppd/ipv6cp.c ppp-2.4.4/pppd/ipv6cp.c ---- ppp-2.4.4.orig/pppd/ipv6cp.c 2005-08-25 19:59:34.000000000 -0400 -+++ ppp-2.4.4/pppd/ipv6cp.c 2009-05-07 16:16:20.000000000 -0400 -@@ -1232,7 +1232,7 @@ - } - - } -- demand_rexmit(PPP_IPV6); -+ demand_rexmit(PPP_IPV6,0); - sifnpmode(f->unit, PPP_IPV6, NPMODE_PASS); - - } else { -diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h ---- ppp-2.4.4.orig/pppd/pppd.h 2009-05-07 15:49:34.000000000 -0400 -+++ ppp-2.4.4/pppd/pppd.h 2009-05-07 16:16:20.000000000 -0400 -@@ -565,7 +565,7 @@ - void demand_block __P((void)); /* set all NPs to queue up packets */ - void demand_unblock __P((void)); /* set all NPs to pass packets */ - void demand_discard __P((void)); /* set all NPs to discard packets */ --void demand_rexmit __P((int)); /* retransmit saved frames for an NP */ -+void demand_rexmit __P((int, u_int32_t)); /* retransmit saved frames for an NP*/ - int loop_chars __P((unsigned char *, int)); /* process chars from loopback */ - int loop_frame __P((unsigned char *, int)); /* should we bring link up? */ - diff --git a/package/ppp/patches/106-debian_stripMSdomain.patch b/package/ppp/patches/106-debian_stripMSdomain.patch index 5dbe254779..37c4529b54 100644 --- a/package/ppp/patches/106-debian_stripMSdomain.patch +++ b/package/ppp/patches/106-debian_stripMSdomain.patch @@ -33,38 +33,3 @@ diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c } if (chap_verify_hook) -diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c ---- ppp-2.4.4.orig/pppd/chap-new.c 2005-07-13 06:41:58.000000000 -0400 -+++ ppp-2.4.4/pppd/chap-new.c 2009-05-07 16:18:37.000000000 -0400 -@@ -57,6 +57,7 @@ - int chap_timeout_time = 3; - int chap_max_transmits = 10; - int chap_rechallenge_time = 0; -+int chapms_strip_domain = 0; - - /* - * Command-line options. -@@ -68,6 +69,8 @@ - "Set max #xmits for challenge", OPT_PRIO }, - { "chap-interval", o_int, &chap_rechallenge_time, - "Set interval for rechallenge", OPT_PRIO }, -+ { "chapms-strip-domain", o_bool, &chapms_strip_domain, -+ "Strip the domain prefix before the Username", 1 }, - { NULL } - }; - -@@ -335,6 +338,14 @@ - /* Null terminate and clean remote name. */ - slprintf(rname, sizeof(rname), "%.*v", len, name); - name = rname; -+ -+ /* strip the MS domain name */ -+ if (chapms_strip_domain && strrchr(rname, '\\')) { -+ char tmp[MAXNAMELEN+1]; -+ -+ strcpy(tmp, strrchr(rname, '\\') + 1); -+ strcpy(rname, tmp); -+ } - } - - if (chap_verify_hook) diff --git a/package/ppp/patches/107-debian_pppatm_cleanup.patch b/package/ppp/patches/107-debian_pppatm_cleanup.patch index b258031d88..56ffa5c6d1 100644 --- a/package/ppp/patches/107-debian_pppatm_cleanup.patch +++ b/package/ppp/patches/107-debian_pppatm_cleanup.patch @@ -94,99 +94,3 @@ diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/ 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, diff --git a/package/ppp/patches/108-debian_pppatm_fix_mtu.patch b/package/ppp/patches/108-debian_pppatm_fix_mtu.patch index 85daa6a903..ecf619a1cb 100644 --- a/package/ppp/patches/108-debian_pppatm_fix_mtu.patch +++ b/package/ppp/patches/108-debian_pppatm_fix_mtu.patch @@ -29,34 +29,3 @@ diff -Naur ppp-2.4.4.orig/pppd/plugins/pppoatm/pppoatm.c ppp-2.4.4/pppd/plugins/ } void plugin_init(void) -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 2009-05-07 16:23:41.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/pppoatm/pppoatm.c 2009-05-07 16:23:57.000000000 -0400 -@@ -179,8 +179,11 @@ - int sock; - struct ifreq ifr; - -- if (mtu > pppoatm_max_mtu) -- error("Couldn't increase MTU to %d", mtu); -+ if (pppoatm_max_mtu && mtu > pppoatm_max_mtu) { -+ warn("Couldn't increase MTU to %d. Using %d", -+ mtu, pppoatm_max_mtu); -+ mtu = pppoatm_max_mtu; -+ } - - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock < 0) -@@ -198,8 +201,11 @@ - int pcomp, - int accomp) - { -- if (mru > pppoatm_max_mru) -- error("Couldn't increase MRU to %d", mru); -+ if (pppoatm_max_mru && mru > pppoatm_max_mru) { -+ warn("Couldn't increase MRU to %d. Using %d", -+ mru, pppoatm_max_mru); -+ mru = pppoatm_max_mru; -+ } - } - - void plugin_init(void) diff --git a/package/ppp/patches/109-debian_pppoe_cleanup.patch b/package/ppp/patches/109-debian_pppoe_cleanup.patch index 9fb0ebe71e..52dd8dbd2e 100644 --- a/package/ppp/patches/109-debian_pppoe_cleanup.patch +++ b/package/ppp/patches/109-debian_pppoe_cleanup.patch @@ -1077,1082 +1077,3 @@ diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/utils.c ppp-2.4.4/pppd/plugins/r + exit(1); +} + -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/common.c ppp-2.4.4/pppd/plugins/rp-pppoe/common.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/common.c 2004-02-01 22:36:46.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/common.c 2009-05-07 17:01:46.000000000 -0400 -@@ -18,10 +18,6 @@ - - #include "pppoe.h" - --#ifdef HAVE_SYSLOG_H --#include --#endif -- - #include - #include - #include -@@ -50,17 +46,17 @@ - UINT16_t tagType, tagLen; - - if (packet->ver != 1) { -- syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); -+ error("Invalid PPPoE version (%u)", packet->ver); - return -1; - } - if (packet->type != 1) { -- syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); -+ error("Invalid PPPoE type (%u)", packet->type); - return -1; - } - - /* Do some sanity checks on packet */ - if (len > ETH_DATA_LEN - 6) { /* 6-byte overhead for PPPoE header */ -- syslog(LOG_ERR, "Invalid PPPoE packet length (%u)", len); -+ error("Invalid PPPoE packet length (%u)", len); - return -1; - } - -@@ -76,7 +72,7 @@ - return 0; - } - if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { -- syslog(LOG_ERR, "Invalid PPPoE tag length (%u)", tagLen); -+ error("Invalid PPPoE tag length (%u)", tagLen); - return -1; - } - func(tagType, tagLen, curTag+TAG_HDR_SIZE, extra); -@@ -105,17 +101,17 @@ - UINT16_t tagType, tagLen; - - if (packet->ver != 1) { -- syslog(LOG_ERR, "Invalid PPPoE version (%d)", (int) packet->ver); -+ error("Invalid PPPoE version (%u)", packet->ver); - return NULL; - } - if (packet->type != 1) { -- syslog(LOG_ERR, "Invalid PPPoE type (%d)", (int) packet->type); -+ error("Invalid PPPoE type (%u)", packet->type); - return NULL; - } - - /* Do some sanity checks on packet */ - if (len > ETH_DATA_LEN - 6) { /* 6-byte overhead for PPPoE header */ -- syslog(LOG_ERR, "Invalid PPPoE packet length (%u)", len); -+ error("Invalid PPPoE packet length (%u)", len); - return NULL; - } - -@@ -131,7 +127,7 @@ - return NULL; - } - if ((curTag - packet->payload) + tagLen + TAG_HDR_SIZE > len) { -- syslog(LOG_ERR, "Invalid PPPoE tag length (%u)", tagLen); -+ error("Invalid PPPoE tag length (%u)", tagLen); - return NULL; - } - if (tagType == type) { -@@ -143,6 +139,7 @@ - return NULL; - } - -+#ifdef unused - /********************************************************************** - *%FUNCTION: printErr - *%ARGUMENTS: -@@ -158,6 +155,7 @@ - fprintf(stderr, "pppoe: %s\n", str); - syslog(LOG_ERR, "%s", str); - } -+#endif - - - /********************************************************************** -@@ -172,7 +170,7 @@ - { - char *copy = malloc(strlen(str)+1); - if (!copy) { -- rp_fatal("strdup failed"); -+ fatal("strdup failed"); - } - strcpy(copy, str); - return copy; -@@ -467,9 +465,10 @@ - fprintf(conn->debugFile, "\n"); - fflush(conn->debugFile); - } -- syslog(LOG_INFO,"Sent PADT"); -+ info("Sent PADT"); - } - -+#ifdef unused - /********************************************************************** - *%FUNCTION: parseLogErrs - *%ARGUMENTS: -@@ -501,4 +500,5 @@ - break; - } - } -+#endif - -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c 2005-03-22 05:22:32.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 17:01:46.000000000 -0400 -@@ -13,10 +13,6 @@ - - #include "pppoe.h" - --#ifdef HAVE_SYSLOG_H --#include --#endif -- - #include - #include - #include -@@ -167,24 +163,21 @@ - if (conn->printACNames) { - printf("Got a Service-Name-Error tag: %.*s\n", (int) len, data); - } else { -- syslog(LOG_ERR, "PADO: Service-Name-Error: %.*s", (int) len, data); -- exit(1); -+ fatal("PADO: Service-Name-Error: %.*s", (int) len, data); - } - break; - case TAG_AC_SYSTEM_ERROR: - if (conn->printACNames) { - printf("Got a System-Error tag: %.*s\n", (int) len, data); - } else { -- syslog(LOG_ERR, "PADO: System-Error: %.*s", (int) len, data); -- exit(1); -+ fatal("PADO: System-Error: %.*s", (int) len, data); - } - break; - case TAG_GENERIC_ERROR: - if (conn->printACNames) { - printf("Got a Generic-Error tag: %.*s\n", (int) len, data); - } else { -- syslog(LOG_ERR, "PADO: Generic-Error: %.*s", (int) len, data); -- exit(1); -+ fatal("PADO: Generic-Error: %.*s", (int) len, data); - } - break; - } -@@ -209,20 +202,14 @@ - PPPoEConnection *conn = (PPPoEConnection *) extra; - switch(type) { - case TAG_SERVICE_NAME: -- syslog(LOG_DEBUG, "PADS: Service-Name: '%.*s'", (int) len, data); -+ dbglog("PADS: Service-Name: '%.*s'", (int) len, data); - break; - case TAG_SERVICE_NAME_ERROR: -- syslog(LOG_ERR, "PADS: Service-Name-Error: %.*s", (int) len, data); -- fprintf(stderr, "PADS: Service-Name-Error: %.*s\n", (int) len, data); -- exit(1); -+ fatal("PADS: Service-Name-Error: %.*s", (int) len, data); - case TAG_AC_SYSTEM_ERROR: -- syslog(LOG_ERR, "PADS: System-Error: %.*s", (int) len, data); -- fprintf(stderr, "PADS: System-Error: %.*s\n", (int) len, data); -- exit(1); -+ fatal("PADS: System-Error: %.*s", (int) len, data); - case TAG_GENERIC_ERROR: -- syslog(LOG_ERR, "PADS: Generic-Error: %.*s", (int) len, data); -- fprintf(stderr, "PADS: Generic-Error: %.*s\n", (int) len, data); -- exit(1); -+ fatal("PADS: Generic-Error: %.*s", (int) len, data); - case TAG_RELAY_SESSION_ID: - conn->relayId.type = htons(type); - conn->relayId.length = htons(len); -@@ -336,7 +323,7 @@ - if (r >= 0 || errno != EINTR) break; - } - if (r < 0) { -- fatalSys("select (waitForPADO)"); -+ fatal("waitForPADO: select: %m"); - } - if (r == 0) return; /* Timed out */ - } -@@ -346,8 +333,7 @@ - - /* Check length */ - if (ntohs(packet.length) + HDR_SIZE > len) { -- syslog(LOG_ERR, "Bogus PPPoE length field (%u)", -- (unsigned int) ntohs(packet.length)); -+ error("Bogus PPPoE length field (%u)", ntohs(packet.length)); - continue; - } - -@@ -366,16 +352,16 @@ - - if (packet.code == CODE_PADO) { - if (BROADCAST(packet.ethHdr.h_source)) { -- printErr("Ignoring PADO packet from broadcast MAC address"); -+ error("Ignoring PADO packet from broadcast MAC address"); - continue; - } - parsePacket(&packet, parsePADOTags, &pc); - if (!pc.seenACName) { -- printErr("Ignoring PADO packet with no AC-Name tag"); -+ error("Ignoring PADO packet with no AC-Name tag"); - continue; - } - if (!pc.seenServiceName) { -- printErr("Ignoring PADO packet with no Service-Name tag"); -+ error("Ignoring PADO packet with no Service-Name tag"); - continue; - } - conn->numPADOs++; -@@ -513,7 +499,7 @@ - if (r >= 0 || errno != EINTR) break; - } - if (r < 0) { -- fatalSys("select (waitForPADS)"); -+ fatal("waitForPADS: select: %m"); - } - if (r == 0) return; - } -@@ -523,8 +509,7 @@ - - /* Check length */ - if (ntohs(packet.length) + HDR_SIZE > len) { -- syslog(LOG_ERR, "Bogus PPPoE length field (%u)", -- (unsigned int) ntohs(packet.length)); -+ error("Bogus PPPoE length field (%u)", ntohs(packet.length)); - continue; - } - -@@ -556,11 +541,12 @@ - /* Don't bother with ntohs; we'll just end up converting it back... */ - conn->session = packet.session; - -- syslog(LOG_INFO, "PPP session is %d", (int) ntohs(conn->session)); -+ info("PPP session is %d", ntohs(conn->session)); - - /* RFC 2516 says session id MUST NOT be zero or 0xFFFF */ - if (ntohs(conn->session) == 0 || ntohs(conn->session) == 0xFFFF) { -- syslog(LOG_ERR, "Access concentrator used a session value of %x -- the AC is violating RFC 2516", (unsigned int) ntohs(conn->session)); -+ error("Access concentrator used a session value of 0x%x" -+ " -- the AC is violating RFC 2516", ntohs(conn->session)); - } - } - -@@ -620,7 +606,7 @@ - - /* If we're only printing access concentrator names, we're done */ - if (conn->printACNames) { -- die(0); -+ exit(0); - } - - timeout = PADI_TIMEOUT; -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/if.c ppp-2.4.4/pppd/plugins/rp-pppoe/if.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/if.c 2001-12-13 21:55:20.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/if.c 2009-05-07 17:01:46.000000000 -0400 -@@ -40,10 +40,6 @@ - #include - #endif - --#ifdef HAVE_SYSLOG_H --#include --#endif -- - #include - #include - #include -@@ -127,7 +123,7 @@ - { - UINT16_t type = (UINT16_t) ntohs(packet->ethHdr.h_proto); - if (type != Eth_PPPOE_Discovery && type != Eth_PPPOE_Session) { -- syslog(LOG_ERR, "Invalid ether type 0x%x", type); -+ error("Invalid ethernet type 0x%x", type); - } - return type; - } -@@ -156,7 +152,7 @@ - ifc.ifc_len = sizeof(inbuf); - ifc.ifc_buf = inbuf; - if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) { -- fatalSys("SIOCGIFCONF"); -+ fatal("SIOCGIFCONF: %m"); - } - ifr = ifc.ifc_req; - ifreq.ifr_name[0] = '\0'; -@@ -172,9 +168,7 @@ - (sdl->sdl_alen == ETH_ALEN) && - !strncmp(ifname, ifr->ifr_name, sizeof(ifr->ifr_name))) { - if (found) { -- char buffer[256]; -- sprintf(buffer, "interface %.16s has more than one ethernet address", ifname); -- rp_fatal(buffer); -+ fatal("interface %s has more than one ethernet address", ifname); - } else { - found = 1; - memcpy(hwaddr, LLADDR(sdl), ETH_ALEN); -@@ -183,9 +177,7 @@ - } - } - if (!found) { -- char buffer[256]; -- sprintf(buffer, "interface %.16s has no ethernet address", ifname); -- rp_fatal(buffer); -+ fatal("interface %s has no ethernet address", ifname); - } - } - -@@ -252,7 +244,7 @@ - - /* Apply the filter */ - if (ioctl(fd, BIOCSETF, &bpfProgram) < 0) { -- fatalSys("ioctl(BIOCSETF)"); -+ fatal("ioctl(BIOCSETF): %m"); - } - } - } -@@ -298,42 +290,36 @@ - if (fd < 0) { - switch (errno) { - case EACCES: /* permission denied */ -- { -- char buffer[256]; -- sprintf(buffer, "Cannot open %.32s -- pppoe must be run as root.", bpfName); -- rp_fatal(buffer); -- } -+ fatal("Cannot open %s -- pppoe must be run as root.", bpfName); - break; - case EBUSY: - case ENOENT: /* no such file */ - if (i == 0) { -- rp_fatal("No /dev/bpf* devices (check your kernel configuration for BPF support)"); -+ fatal("No /dev/bpf* devices (check your kernel configuration for BPF support)"); - } else { -- rp_fatal("All /dev/bpf* devices are in use"); -+ fatal("All /dev/bpf* devices are in use"); - } - break; - } -- fatalSys(bpfName); -+ fatal("%s: %m", bpfName); - } - - if ((sock = socket(AF_LOCAL, SOCK_DGRAM, 0)) < 0) { -- fatalSys("socket"); -+ fatal("socket: %m"); - } - - /* Check that the interface is up */ - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(sock, SIOCGIFFLAGS, &ifr) < 0) { -- fatalSys("ioctl(SIOCGIFFLAGS)"); -+ fatal("ioctl(SIOCGIFFLAGS): %m"); - } - if ((ifr.ifr_flags & IFF_UP) == 0) { -- char buffer[256]; -- sprintf(buffer, "Interface %.16s is not up\n", ifname); -- rp_fatal(buffer); -+ fatal("Interface %s is not up", ifname); - } - - /* Fill in hardware address and initialize the packet filter rules */ - if (hwaddr == NULL) { -- rp_fatal("openInterface: no hwaddr arg."); -+ fatal("openInterface: no hwaddr arg."); - } - getHWaddr(sock, ifname, hwaddr); - initFilter(fd, type, hwaddr); -@@ -342,58 +328,52 @@ - #if !defined(__OpenBSD__) - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(sock, SIOCGIFMTU, &ifr) < 0) { -- fatalSys("ioctl(SIOCGIFMTU)"); -+ fatal("ioctl(SIOCGIFMTU): %m"); - } - if (ifr.ifr_mtu < ETH_DATA_LEN) { -- char buffer[256]; -- sprintf(buffer, "Interface %.16s has MTU of %d -- should be %d. You may have serious connection problems.", -+ error("Interface %s has MTU of %d -- should be %d." -+ " You may have serious connection problems.", - ifname, ifr.ifr_mtu, ETH_DATA_LEN); -- printErr(buffer); - } - #endif - - /* done with the socket */ - if (close(sock) < 0) { -- fatalSys("close"); -+ fatal("close: %m"); - } - - /* Check the BPF version number */ - if (ioctl(fd, BIOCVERSION, &bpf_ver) < 0) { -- fatalSys("ioctl(BIOCVERSION)"); -+ fatal("ioctl(BIOCVERSION): %m"); - } - if ((bpf_ver.bv_major != BPF_MAJOR_VERSION) || - (bpf_ver.bv_minor < BPF_MINOR_VERSION)) { -- char buffer[256]; -- sprintf(buffer, "Unsupported BPF version: %d.%d (kernel: %d.%d)", -+ fatal("Unsupported BPF version: %d.%d (kernel: %d.%d)", - BPF_MAJOR_VERSION, BPF_MINOR_VERSION, - bpf_ver.bv_major, bpf_ver.bv_minor); -- rp_fatal(buffer); - } - - /* allocate a receive packet buffer */ - if (ioctl(fd, BIOCGBLEN, &bpfLength) < 0) { -- fatalSys("ioctl(BIOCGBLEN)"); -+ fatal("ioctl(BIOCGBLEN): %m"); - } - if (!(bpfBuffer = (unsigned char *) malloc(bpfLength))) { -- rp_fatal("malloc"); -+ fatal("malloc"); - } - - /* reads should return as soon as there is a packet available */ - optval = 1; - if (ioctl(fd, BIOCIMMEDIATE, &optval) < 0) { -- fatalSys("ioctl(BIOCIMMEDIATE)"); -+ fatal("ioctl(BIOCIMMEDIATE): %m"); - } - - /* Bind the interface to the filter */ - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(fd, BIOCSETIF, &ifr) < 0) { -- char buffer[256]; -- sprintf(buffer, "ioctl(BIOCSETIF) can't select interface %.16s", -- ifname); -- rp_fatal(buffer); -+ fatal("ioctl(BIOCSETIF) can't select interface %s: %m", ifname); - } - -- syslog(LOG_INFO, "Interface=%.16s HWaddr=%02X:%02X:%02X:%02X:%02X:%02X Device=%.32s Buffer size=%d", -+ info("Interface=%s HWaddr=%02X:%02X:%02X:%02X:%02X:%02X Device=%s Buffer size=%d", - ifname, - hwaddr[0], hwaddr[1], hwaddr[2], - hwaddr[3], hwaddr[4], hwaddr[5], -@@ -442,48 +422,41 @@ - if ((fd = socket(domain, stype, htons(type))) < 0) { - /* Give a more helpful message for the common error case */ - if (errno == EPERM) { -- rp_fatal("Cannot create raw socket -- pppoe must be run as root."); -+ fatal("Cannot create raw socket -- pppoe must be run as root."); - } -- fatalSys("socket"); -+ fatal("cannot create the raw socket: %m"); - } - - if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) < 0) { -- fatalSys("setsockopt"); -+ fatal("setsockopt(SOL_SOCKET, SO_BROADCAST): %m"); - } - - /* Fill in hardware address */ - if (hwaddr) { - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); -- if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) { -- fatalSys("ioctl(SIOCGIFHWADDR)"); -- } -+ if (ioctl(fd, SIOCGIFHWADDR, &ifr) < 0) -+ fatal("ioctl(SIOCGIFHWADDR): %m"); - memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, ETH_ALEN); - #ifdef ARPHRD_ETHER - if (ifr.ifr_hwaddr.sa_family != ARPHRD_ETHER) { -- char buffer[256]; -- sprintf(buffer, "Interface %.16s is not Ethernet", ifname); -- rp_fatal(buffer); -+ fatal("Interface %s is not Ethernet", ifname); - } - #endif - if (NOT_UNICAST(hwaddr)) { -- char buffer[256]; -- sprintf(buffer, -- "Interface %.16s has broadcast/multicast MAC address??", -+ fatal("Interface %s has broadcast/multicast MAC address", - ifname); -- rp_fatal(buffer); - } - } - - /* Sanity check on MTU */ - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(fd, SIOCGIFMTU, &ifr) < 0) { -- fatalSys("ioctl(SIOCGIFMTU)"); -+ fatal("ioctl(SIOCGIFMTU): %m"); - } - if (ifr.ifr_mtu < ETH_DATA_LEN) { -- char buffer[256]; -- sprintf(buffer, "Interface %.16s has MTU of %d -- should be %d. You may have serious connection problems.", -+ error("Interface %s has MTU of %d -- should be %d." -+ " You may have serious connection problems.", - ifname, ifr.ifr_mtu, ETH_DATA_LEN); -- printErr(buffer); - } - - #ifdef HAVE_STRUCT_SOCKADDR_LL -@@ -493,7 +466,7 @@ - - strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); - if (ioctl(fd, SIOCGIFINDEX, &ifr) < 0) { -- fatalSys("ioctl(SIOCFIGINDEX): Could not get interface index"); -+ fatal("ioctl(SIOCFIGINDEX): Could not get interface index: %m"); - } - sa.sll_ifindex = ifr.ifr_ifindex; - -@@ -503,7 +476,7 @@ - - /* We're only interested in packets on specified interface */ - if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { -- fatalSys("bind"); -+ fatal("bind: %m"); - } - - return fd; -@@ -527,13 +500,11 @@ - { - #if defined(USE_BPF) - if (write(sock, pkt, size) < 0) { -- sysErr("write (sendPacket)"); -- return -1; -+ fatal("sendPacket: write: %m"); - } - #elif defined(HAVE_STRUCT_SOCKADDR_LL) - if (send(sock, pkt, size, 0) < 0) { -- sysErr("send (sendPacket)"); -- return -1; -+ fatal("sendPacket: send: %m"); - } - #else - #ifdef USE_DLPI -@@ -577,12 +548,11 @@ - struct sockaddr sa; - - if (!conn) { -- rp_fatal("relay and server not supported on Linux 2.0 kernels"); -+ fatal("relay and server not supported on Linux 2.0 kernels"); - } - strcpy(sa.sa_data, conn->ifName); - if (sendto(sock, pkt, size, 0, &sa, sizeof(sa)) < 0) { -- sysErr("sendto (sendPacket)"); -- return -1; -+ fatal("sendPacket: sendto: %m"); - } - #endif - #endif -@@ -632,26 +602,24 @@ - if (bpfSize <= 0) { - bpfOffset = 0; - if ((bpfSize = read(sock, bpfBuffer, bpfLength)) < 0) { -- sysErr("read (receivePacket)"); -- return -1; -+ fatal("receivePacket: read: %m"); - } - } - if (bpfSize < sizeof(hdr)) { -- syslog(LOG_ERR, "Truncated bpf packet header: len=%d", bpfSize); -+ error("Truncated bpf packet header: len=%d", bpfSize); - clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ - return 0; - } - memcpy(&hdr, bpfBuffer + bpfOffset, sizeof(hdr)); - if (hdr.bh_caplen != hdr.bh_datalen) { -- syslog(LOG_ERR, "Truncated bpf packet: caplen=%d, datalen=%d", -+ error("Truncated bpf packet: caplen=%d, datalen=%d", - hdr.bh_caplen, hdr.bh_datalen); - clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ - return 0; - } - seglen = hdr.bh_hdrlen + hdr.bh_caplen; - if (seglen > bpfSize) { -- syslog(LOG_ERR, "Truncated bpf packet: seglen=%d, bpfSize=%d", -- seglen, bpfSize); -+ error("Truncated bpf packet: seglen=%d, bpfSize=%d", seglen, bpfSize); - clearPacketHeader(pkt); /* resets bpfSize and bpfOffset */ - return 0; - } -@@ -676,16 +644,14 @@ - data.len = 0; - - if ((retval = getmsg(sock, NULL, &data, &flags)) < 0) { -- sysErr("read (receivePacket)"); -- return -1; -+ fatal("receivePacket: getmsg: %m"); - } - - *size = data.len; - - #else - if ((*size = recv(sock, pkt, sizeof(PPPoEPacket), 0)) < 0) { -- sysErr("recv (receivePacket)"); -- return -1; -+ fatal("receivePacket: recv: %m"); - } - #endif - #endif -@@ -716,7 +682,7 @@ - int ppa; - - if(strlen(ifname) > PATH_MAX) { -- rp_fatal("socket: string to long"); -+ fatal("openInterface: interface name too long"); - } - - ppa = atoi(&ifname[strlen(ifname)-1]); -@@ -729,9 +695,9 @@ - if (( fd = open(base_dev, O_RDWR)) < 0) { - /* Give a more helpful message for the common error case */ - if (errno == EPERM) { -- rp_fatal("Cannot create raw socket -- pppoe must be run as root."); -+ fatal("Cannot create raw socket -- pppoe must be run as root."); - } -- fatalSys("socket"); -+ fatal("open(%s): %m", base_dev); - } - - /* rearranged order of DLPI code - delphys 20010803 */ -@@ -747,17 +713,18 @@ - dl_abssaplen = ABS(dlp->info_ack.dl_sap_length); - dl_saplen = dlp->info_ack.dl_sap_length; - if (ETHERADDRL != (dlp->info_ack.dl_addr_length - dl_abssaplen)) -- fatalSys("invalid destination physical address length"); -+ fatal("invalid destination physical address length"); - dl_addrlen = dl_abssaplen + ETHERADDRL; - - /* ethernet address retrieved as part of DL_INFO_ACK - delphys 20010803 */ - memcpy(hwaddr, (u_char*)((char*)(dlp) + (int)(dlp->info_ack.dl_addr_offset)), ETHERADDRL); - - if ( strioctl(fd, DLIOCRAW, -1, 0, NULL) < 0 ) { -- fatalSys("DLIOCRAW"); -+ fatal("DLIOCRAW: %m"); - } - -- if (ioctl(fd, I_FLUSH, FLUSHR) < 0) fatalSys("I_FLUSH"); -+ if (ioctl(fd, I_FLUSH, FLUSHR) < 0) -+ fatal("I_FLUSH: %m"); - - return fd; - } -@@ -780,7 +747,7 @@ - flags = 0; - - if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) -- fatalSys("dlpromiscon: putmsg"); -+ fatal("dlpromiscon: putmsg: %m"); - - } - -@@ -799,7 +766,7 @@ - flags = RS_HIPRI; - - if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) -- fatalSys("dlinforeq: putmsg"); -+ fatal("dlinforeq: putmsg: %m"); - } - - void dlunitdatareq(int fd, u_char *addrp, int addrlen, u_long minpri, u_long maxpri, u_char *datap, int datalen) -@@ -827,7 +794,7 @@ - data.buf = (char *) datap; - - if (putmsg(fd, &ctl, &data, 0) < 0) -- fatalSys("dlunitdatareq: putmsg"); -+ fatal("dlunitdatareq: putmsg: %m"); - } - - void dlinfoack(int fd, char *bufp) -@@ -847,18 +814,14 @@ - expecting(DL_INFO_ACK, dlp); - - if (ctl.len < sizeof (dl_info_ack_t)) { -- char buffer[256]; -- sprintf(buffer, "dlinfoack: response ctl.len too short: %d", ctl.len); -- rp_fatal(buffer); -+ fatal("dlinfoack: response ctl.len too short: %d", ctl.len); - } - - if (flags != RS_HIPRI) -- rp_fatal("dlinfoack: DL_INFO_ACK was not M_PCPROTO"); -+ fatal("dlinfoack: DL_INFO_ACK was not M_PCPROTO"); - - if (ctl.len < sizeof (dl_info_ack_t)) { -- char buffer[256]; -- sprintf(buffer, "dlinfoack: short response ctl.len: %d", ctl.len); -- rp_fatal(buffer); -+ fatal("dlinfoack: short response ctl.len: %d", ctl.len); - } - } - -@@ -882,7 +845,7 @@ - flags = 0; - - if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) -- fatalSys("dlbindreq: putmsg"); -+ fatal("dlbindreq: putmsg: %m"); - } - - void dlattachreq(int fd, u_long ppa) -@@ -901,7 +864,7 @@ - flags = 0; - - if (putmsg(fd, &ctl, (struct strbuf*) NULL, flags) < 0) -- fatalSys("dlattachreq: putmsg"); -+ fatal("dlattachreq: putmsg: %m"); - } - - void dlokack(int fd, char *bufp) -@@ -921,18 +884,14 @@ - expecting(DL_OK_ACK, dlp); - - if (ctl.len < sizeof (dl_ok_ack_t)) { -- char buffer[256]; -- sprintf(buffer, "dlokack: response ctl.len too short: %d", ctl.len); -- rp_fatal(buffer); -+ fatal("dlokack: response ctl.len too short: %d", ctl.len); - } - - if (flags != RS_HIPRI) -- rp_fatal("dlokack: DL_OK_ACK was not M_PCPROTO"); -+ fatal("dlokack: DL_OK_ACK was not M_PCPROTO"); - - if (ctl.len < sizeof (dl_ok_ack_t)) { -- char buffer[256]; -- sprintf(buffer, "dlokack: short response ctl.len: %d", ctl.len); -- rp_fatal(buffer); -+ fatal("dlokack: short response ctl.len: %d", ctl.len); - } - } - -@@ -953,12 +912,10 @@ - expecting(DL_BIND_ACK, dlp); - - if (flags != RS_HIPRI) -- rp_fatal("dlbindack: DL_OK_ACK was not M_PCPROTO"); -+ fatal("dlbindack: DL_OK_ACK was not M_PCPROTO"); - - if (ctl.len < sizeof (dl_bind_ack_t)) { -- char buffer[256]; -- sprintf(buffer, "dlbindack: short response ctl.len: %d", ctl.len); -- rp_fatal(buffer); -+ fatal("dlbindack: short response ctl.len: %d", ctl.len); - } - } - -@@ -989,8 +946,7 @@ - */ - (void) signal(SIGALRM, sigalrm); - if (alarm(MAXWAIT) < 0) { -- (void) sprintf(errmsg, "%s: alarm", caller); -- fatalSys(errmsg); -+ fatal("%s: alarm", caller); - } - - /* -@@ -998,61 +954,48 @@ - */ - *flagsp = 0; - if ((rc = getmsg(fd, ctlp, datap, flagsp)) < 0) { -- (void) sprintf(errmsg, "%s: getmsg", caller); -- fatalSys(errmsg); -+ fatal(errmsg, "%s: getmsg: %m", caller); - } - - /* - * Stop timer. - */ - if (alarm(0) < 0) { -- (void) sprintf(errmsg, "%s: alarm", caller); -- fatalSys(errmsg); -+ fatal("%s: alarm", caller); - } - - /* - * Check for MOREDATA and/or MORECTL. - */ - if ((rc & (MORECTL | MOREDATA)) == (MORECTL | MOREDATA)) { -- char buffer[256]; -- sprintf(buffer, "%s: MORECTL|MOREDATA", caller); -- rp_fatal(buffer); -+ fatal("%s: MORECTL|MOREDATA", caller); - } - - if (rc & MORECTL) { -- char buffer[256]; -- sprintf(buffer, "%s: MORECTL", caller); -- rp_fatal(buffer); -+ fatal("%s: MORECTL", caller); - } - - if (rc & MOREDATA) { -- char buffer[256]; -- sprintf(buffer, "%s: MOREDATA", caller); -- rp_fatal(buffer); -+ fatal("%s: MOREDATA", caller); - } - - /* - * Check for at least sizeof (long) control data portion. - */ - if (ctlp->len < sizeof (long)) { -- char buffer[256]; -- sprintf(buffer, "getmsg: control portion length < sizeof (long): %d", ctlp->len); -- rp_fatal(buffer); -+ fatal("getmsg: control portion length < sizeof (long): %d", ctlp->len); - } - } - - void sigalrm(int sig) - { -- (void) rp_fatal("sigalrm: TIMEOUT"); -+ fatal("sigalrm: TIMEOUT"); - } - - void expecting(int prim, union DL_primitives *dlp) - { - if (dlp->dl_primitive != (u_long)prim) { -- char buffer[256]; -- sprintf(buffer, "expected %s got %s", dlprim(prim), dlprim(dlp->dl_primitive)); -- rp_fatal(buffer); -- exit(1); -+ fatal("expected %s got %s", dlprim(prim), dlprim(dlp->dl_primitive)); - } - } - -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux 2006-06-04 01:07:46.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 17:01:46.000000000 -0400 -@@ -28,8 +28,8 @@ - CFLAGS=$(COPTS) -I../../../include/linux - all: rp-pppoe.so pppoe-discovery - --pppoe-discovery: libplugin.a pppoe-discovery.o -- $(CC) -o pppoe-discovery pppoe-discovery.o libplugin.a -+pppoe-discovery: pppoe-discovery.o utils.o libplugin.a -+ $(CC) -o pppoe-discovery pppoe-discovery.o utils.o libplugin.a - - pppoe-discovery.o: pppoe-discovery.c - $(CC) $(CFLAGS) '-DVERSION="$(VERSION)"' -c -o pppoe-discovery.o pppoe-discovery.c -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/plugin.c ppp-2.4.4/pppd/plugins/rp-pppoe/plugin.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/plugin.c 2006-05-29 19:29:16.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/plugin.c 2009-05-07 17:01:46.000000000 -0400 -@@ -35,7 +35,6 @@ - #include "pppd/pathnames.h" - - #include --#include - #include - #include - #include -@@ -173,10 +172,8 @@ - (unsigned) conn->peerEth[5]); - - if (connect(conn->sessionSocket, (struct sockaddr *) &sp, -- sizeof(struct sockaddr_pppox)) < 0) { -+ sizeof(struct sockaddr_pppox)) < 0) - fatal("Failed to connect PPPoE socket: %d %m", errno); -- return -1; -- } - - return conn->sessionSocket; - } -@@ -320,11 +317,9 @@ - } - - add_options(Options); -- -- info("RP-PPPoE plugin version %s compiled against pppd %s", -- RP_VERSION, VERSION); - } - -+#ifdef unused - /********************************************************************** - *%FUNCTION: fatalSys - *%ARGUMENTS: -@@ -378,6 +373,7 @@ - { - rp_fatal(str); - } -+#endif - - void pppoe_check_options(void) - { -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe-discovery.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe-discovery.c 2004-11-13 07:12:05.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe-discovery.c 2009-05-07 17:01:46.000000000 -0400 -@@ -17,14 +17,8 @@ - - #include "pppoe.h" - --char *xstrdup(const char *s); - void usage(void); - --void die(int status) --{ -- exit(status); --} -- - int main(int argc, char *argv[]) - { - int opt; -@@ -32,17 +26,17 @@ - - conn = malloc(sizeof(PPPoEConnection)); - if (!conn) -- fatalSys("malloc"); -+ fatal("malloc"); - - memset(conn, 0, sizeof(PPPoEConnection)); - - while ((opt = getopt(argc, argv, "I:D:VUAS:C:h")) > 0) { - switch(opt) { - case 'S': -- conn->serviceName = xstrdup(optarg); -+ conn->serviceName = strDup(optarg); - break; - case 'C': -- conn->acName = xstrdup(optarg); -+ conn->acName = strDup(optarg); - break; - case 'U': - conn->useHostUniq = 1; -@@ -57,7 +51,7 @@ - fprintf(conn->debugFile, "pppoe-discovery %s\n", VERSION); - break; - case 'I': -- conn->ifName = xstrdup(optarg); -+ conn->ifName = strDup(optarg); - break; - case 'A': - /* this is the default */ -@@ -74,7 +68,7 @@ - - /* default interface name */ - if (!conn->ifName) -- conn->ifName = strdup("eth0"); -+ conn->ifName = strDup("eth0"); - - conn->discoverySocket = -1; - conn->sessionSocket = -1; -@@ -84,39 +78,6 @@ - exit(0); - } - --void rp_fatal(char const *str) --{ -- char buf[1024]; -- -- printErr(str); -- sprintf(buf, "pppoe-discovery: %.256s", str); -- exit(1); --} -- --void fatalSys(char const *str) --{ -- char buf[1024]; -- int i = errno; -- -- sprintf(buf, "%.256s: %.256s", str, strerror(i)); -- printErr(buf); -- sprintf(buf, "pppoe-discovery: %.256s: %.256s", str, strerror(i)); -- exit(1); --} -- --void sysErr(char const *str) --{ -- rp_fatal(str); --} -- --char *xstrdup(const char *s) --{ -- register char *ret = strdup(s); -- if (!ret) -- sysErr("strdup"); -- return ret; --} -- - void usage(void) - { - fprintf(stderr, "Usage: pppoe-discovery [options]\n"); -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe.h ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe.h ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/pppoe.h 2004-11-04 05:07:37.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/pppoe.h 2009-05-07 17:01:46.000000000 -0400 -@@ -307,12 +307,18 @@ - unsigned char *findTag(PPPoEPacket *packet, UINT16_t tagType, - PPPoETag *tag); - -+void dbglog(char *, ...); /* log a debug message */ -+void info(char *, ...); /* log an informational message */ -+void warn(char *, ...); /* log a warning message */ -+void error(char *, ...); /* log an error message */ -+void fatal(char *, ...); /* log an error message and die(1) */ -+ - #define SET_STRING(var, val) do { if (var) free(var); var = strDup(val); } while(0); - - #define CHECK_ROOM(cursor, start, len) \ - do {\ - if (((cursor)-(start))+(len) > MAX_PPPOE_PAYLOAD) { \ -- syslog(LOG_ERR, "Would create too-long packet"); \ -+ error("Would create too-long packet"); \ - return; \ - } \ - } while(0) -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/utils.c ppp-2.4.4/pppd/plugins/rp-pppoe/utils.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/utils.c 1969-12-31 19:00:00.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/utils.c 2009-05-07 17:01:46.000000000 -0400 -@@ -0,0 +1,62 @@ -+#include -+#include -+#include -+#include -+#include -+ -+void dbglog(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsyslog(LOG_DEBUG, fmt, ap); -+ vfprintf(stderr, fmt, ap); -+ fputs("\n", stderr); -+ va_end(ap); -+} -+ -+void info(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsyslog(LOG_INFO, fmt, ap); -+ vfprintf(stderr, fmt, ap); -+ fputs("\n", stderr); -+ va_end(ap); -+} -+ -+void warn(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsyslog(LOG_WARNING, fmt, ap); -+ vfprintf(stderr, fmt, ap); -+ fputs("\n", stderr); -+ va_end(ap); -+} -+ -+void error(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsyslog(LOG_ERR, fmt, ap); -+ vfprintf(stderr, fmt, ap); -+ fputs("\n", stderr); -+ va_end(ap); -+} -+ -+void fatal(const char *fmt, ...) -+{ -+ va_list ap; -+ -+ va_start(ap, fmt); -+ vsyslog(LOG_ERR, fmt, ap); -+ vfprintf(stderr, fmt, ap); -+ fputs("\n", stderr); -+ va_end(ap); -+ exit(1); -+} -+ diff --git a/package/ppp/patches/110-debian_defaultroute.patch b/package/ppp/patches/110-debian_defaultroute.patch index 29da5b4e5a..167ca5b77b 100644 --- a/package/ppp/patches/110-debian_defaultroute.patch +++ b/package/ppp/patches/110-debian_defaultroute.patch @@ -305,310 +305,3 @@ diff -Naur ppp-2.4.4.orig/pppd/sys-solaris.c ppp-2.4.4/pppd/sys-solaris.c #if defined(__USLC__) g = l; /* use the local address as gateway */ #endif -diff -Naur ppp-2.4.4.orig/pppd/ipcp.c ppp-2.4.4/pppd/ipcp.c ---- ppp-2.4.4.orig/pppd/ipcp.c 2009-05-09 02:55:46.000000000 -0400 -+++ ppp-2.4.4/pppd/ipcp.c 2009-05-09 02:58:31.000000000 -0400 -@@ -197,6 +197,14 @@ - "disable defaultroute option", OPT_ALIAS | OPT_A2CLR, - &ipcp_wantoptions[0].default_route }, - -+ { "replacedefaultroute", o_bool, -+ &ipcp_wantoptions[0].replace_default_route, -+ "Replace default route", 1 -+ }, -+ { "noreplacedefaultroute", o_bool, -+ &ipcp_allowoptions[0].replace_default_route, -+ "Never replace default route", OPT_A2COPY, -+ &ipcp_wantoptions[0].replace_default_route }, - { "proxyarp", o_bool, &ipcp_wantoptions[0].proxy_arp, - "Add proxy ARP entry", OPT_ENABLE|1, &ipcp_allowoptions[0].proxy_arp }, - { "noproxyarp", o_bool, &ipcp_allowoptions[0].proxy_arp, -@@ -263,7 +271,7 @@ - ip_active_pkt - }; - --static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t)); -+static void ipcp_clear_addrs __P((int, u_int32_t, u_int32_t, bool)); - static void ipcp_script __P((char *, int)); /* Run an up/down script */ - static void ipcp_script_done __P((void *)); - -@@ -1660,7 +1668,8 @@ - if (!sifnpmode(u, PPP_IP, NPMODE_QUEUE)) - return 0; - if (wo->default_route) -- if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr)) -+ if (sifdefaultroute(u, wo->ouraddr, wo->hisaddr, -+ wo->replace_default_route)) - default_route_set[u] = 1; - if (wo->proxy_arp) - if (sifproxyarp(u, wo->hisaddr)) -@@ -1742,7 +1751,8 @@ - */ - if (demand) { - if (go->ouraddr != wo->ouraddr || ho->hisaddr != wo->hisaddr) { -- ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr); -+ ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr, -+ wo->replace_default_route); - if (go->ouraddr != wo->ouraddr) { - warn("Local IP address changed to %I", go->ouraddr); - script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); -@@ -1767,7 +1777,8 @@ - - /* assign a default route through the interface if required */ - if (ipcp_wantoptions[f->unit].default_route) -- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) -+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, -+ wo->replace_default_route)) - default_route_set[f->unit] = 1; - - /* Make a proxy ARP entry if requested. */ -@@ -1817,7 +1828,8 @@ - - /* assign a default route through the interface if required */ - if (ipcp_wantoptions[f->unit].default_route) -- if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) -+ if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr, -+ wo->replace_default_route)) - default_route_set[f->unit] = 1; - - /* Make a proxy ARP entry if requested. */ -@@ -1894,7 +1906,7 @@ - sifnpmode(f->unit, PPP_IP, NPMODE_DROP); - sifdown(f->unit); - ipcp_clear_addrs(f->unit, ipcp_gotoptions[f->unit].ouraddr, -- ipcp_hisoptions[f->unit].hisaddr); -+ ipcp_hisoptions[f->unit].hisaddr, 0); - } - - /* Execute the ip-down script */ -@@ -1910,16 +1922,25 @@ - * proxy arp entries, etc. - */ - static void --ipcp_clear_addrs(unit, ouraddr, hisaddr) -+ipcp_clear_addrs(unit, ouraddr, hisaddr, replacedefaultroute) - int unit; - u_int32_t ouraddr; /* local address */ - u_int32_t hisaddr; /* remote address */ -+ bool replacedefaultroute; - { - if (proxy_arp_set[unit]) { - cifproxyarp(unit, hisaddr); - proxy_arp_set[unit] = 0; - } -- if (default_route_set[unit]) { -+ /* If replacedefaultroute, sifdefaultroute will be called soon -+ * with replacedefaultroute set and that will overwrite the current -+ * default route. This is the case only when doing demand, otherwise -+ * during demand, this cifdefaultroute would restore the old default -+ * route which is not what we want in this case. In the non-demand -+ * case, we'll delete the default route and restore the old if there -+ * is one saved by an sifdefaultroute with replacedefaultroute. -+ */ -+ if (!replacedefaultroute && default_route_set[unit]) { - cifdefaultroute(unit, ouraddr, hisaddr); - default_route_set[unit] = 0; - } -diff -Naur ppp-2.4.4.orig/pppd/ipcp.h ppp-2.4.4/pppd/ipcp.h ---- ppp-2.4.4.orig/pppd/ipcp.h 2009-05-09 02:54:59.000000000 -0400 -+++ ppp-2.4.4/pppd/ipcp.h 2009-05-09 02:58:31.000000000 -0400 -@@ -70,6 +70,7 @@ - bool old_addrs; /* Use old (IP-Addresses) option? */ - bool req_addr; /* Ask peer to send IP address? */ - bool default_route; /* Assign default route through interface? */ -+ bool replace_default_route; /* Replace default route through interface? */ - bool proxy_arp; /* Make proxy ARP entry for peer? */ - bool neg_vj; /* Van Jacobson Compression? */ - bool old_vj; /* use old (short) form of VJ option? */ -diff -Naur ppp-2.4.4.orig/pppd/pppd.8 ppp-2.4.4/pppd/pppd.8 ---- ppp-2.4.4.orig/pppd/pppd.8 2009-05-09 02:54:59.000000000 -0400 -+++ ppp-2.4.4/pppd/pppd.8 2009-05-09 02:58:31.000000000 -0400 -@@ -121,6 +121,11 @@ - This entry is removed when the PPP connection is broken. This option - is privileged if the \fInodefaultroute\fR option has been specified. - .TP -+.B replacedefaultroute -+This option is a flag to the defaultroute option. If defaultroute is -+set and this flag is also set, pppd replaces an existing default route -+with the new default route. -+.TP - .B disconnect \fIscript - Execute the command specified by \fIscript\fR, by passing it to a - shell, after -@@ -706,7 +711,12 @@ - .TP - .B nodefaultroute - Disable the \fIdefaultroute\fR option. The system administrator who --wishes to prevent users from creating default routes with pppd -+wishes to prevent users from adding a default route with pppd -+can do so by placing this option in the /etc/ppp/options file. -+.TP -+.B noreplacedefaultroute -+Disable the \fIreplacedefaultroute\fR option. The system administrator who -+wishes to prevent users from replacing a default route with pppd - can do so by placing this option in the /etc/ppp/options file. - .TP - .B nodeflate -diff -Naur ppp-2.4.4.orig/pppd/pppd.h ppp-2.4.4/pppd/pppd.h ---- ppp-2.4.4.orig/pppd/pppd.h 2009-05-09 02:55:46.000000000 -0400 -+++ ppp-2.4.4/pppd/pppd.h 2009-05-09 02:58:31.000000000 -0400 -@@ -644,7 +644,7 @@ - int cif6addr __P((int, eui64_t, eui64_t)); - /* Remove an IPv6 address from i/f */ - #endif --int sifdefaultroute __P((int, u_int32_t, u_int32_t)); -+int sifdefaultroute __P((int, u_int32_t, u_int32_t, bool replace_default_rt)); - /* Create default route through i/f */ - int cifdefaultroute __P((int, u_int32_t, u_int32_t)); - /* Delete default route through i/f */ -diff -Naur ppp-2.4.4.orig/pppd/sys-linux.c ppp-2.4.4/pppd/sys-linux.c ---- ppp-2.4.4.orig/pppd/sys-linux.c 2009-05-09 02:55:46.000000000 -0400 -+++ ppp-2.4.4/pppd/sys-linux.c 2009-05-09 02:58:31.000000000 -0400 -@@ -206,6 +206,8 @@ - - static int if_is_up; /* Interface has been marked up */ - static int have_default_route; /* Gateway for default route added */ -+static struct rtentry old_def_rt; /* Old default route */ -+static int default_rt_repl_rest; /* replace and restore old default rt */ - static u_int32_t proxy_arp_addr; /* Addr for proxy arp entry added */ - static char proxy_arp_dev[16]; /* Device for proxy arp entry */ - static u_int32_t our_old_addr; /* for detecting address changes */ -@@ -1520,6 +1522,9 @@ - p = NULL; - } - -+ SET_SA_FAMILY (rt->rt_dst, AF_INET); -+ SET_SA_FAMILY (rt->rt_gateway, AF_INET); -+ - SIN_ADDR(rt->rt_dst) = strtoul(cols[route_dest_col], NULL, 16); - SIN_ADDR(rt->rt_gateway) = strtoul(cols[route_gw_col], NULL, 16); - SIN_ADDR(rt->rt_genmask) = strtoul(cols[route_mask_col], NULL, 16); -@@ -1589,20 +1594,51 @@ - /******************************************************************** - * - * sifdefaultroute - assign a default route through the address given. -- */ -- --int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway) --{ -- struct rtentry rt; -- -- if (defaultroute_exists(&rt) && strcmp(rt.rt_dev, ifname) != 0) { -- if (rt.rt_flags & RTF_GATEWAY) -- error("not replacing existing default route via %I", -- SIN_ADDR(rt.rt_gateway)); -- else -+ * -+ * If the global default_rt_repl_rest flag is set, then this function -+ * already replaced the original system defaultroute with some other -+ * route and it should just replace the current defaultroute with -+ * another one, without saving the current route. Use: demand mode, -+ * when pppd sets first a defaultroute it it's temporary ppp0 addresses -+ * and then changes the temporary addresses to the addresses for the real -+ * ppp connection when it has come up. -+ */ -+ -+int sifdefaultroute (int unit, u_int32_t ouraddr, u_int32_t gateway, bool replace) -+{ -+ struct rtentry rt, tmp_rt; -+ struct rtentry *del_rt = NULL; -+ -+ if (default_rt_repl_rest) { -+ /* We have already reclaced the original defaultroute, if we -+ are called again, we will delete the current default route -+ and set the new default route in this function. -+ - this is normally only the case the doing demand: */ -+ if (defaultroute_exists(&tmp_rt)) -+ del_rt = &tmp_rt; -+ } else if (defaultroute_exists(&old_def_rt) && -+ strcmp(old_def_rt.rt_dev, ifname) != 0) { -+ /* We did not yet replace an existing default route, let's -+ check if we should save and replace a default route: */ -+ if (old_def_rt.rt_flags & RTF_GATEWAY) { -+ if (!replace) { -+ error("not replacing existing default route via %I", -+ SIN_ADDR(old_def_rt.rt_gateway)); -+ return 0; -+ } else { -+ /* we need to copy rt_dev because we need it permanent too: */ -+ char *tmp_dev = malloc(strlen(old_def_rt.rt_dev) + 1); -+ strcpy(tmp_dev, old_def_rt.rt_dev); -+ old_def_rt.rt_dev = tmp_dev; -+ -+ notice("replacing old default route to %s [%I]", -+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway)); -+ default_rt_repl_rest = 1; -+ del_rt = &old_def_rt; -+ } -+ } else - error("not replacing existing default route through %s", -- rt.rt_dev); -- return 0; -+ old_def_rt.rt_dev); - } - - memset (&rt, 0, sizeof (rt)); -@@ -1617,10 +1653,16 @@ - - rt.rt_flags = RTF_UP; - if (ioctl(sock_fd, SIOCADDRT, &rt) < 0) { -- if ( ! ok_error ( errno )) -+ if (!ok_error(errno)) - error("default route ioctl(SIOCADDRT): %m"); - return 0; - } -+ if (default_rt_repl_rest && del_rt) -+ if (ioctl(sock_fd, SIOCDELRT, del_rt) < 0) { -+ if (!ok_error(errno)) -+ error("del old default route ioctl(SIOCDELRT): %m"); -+ return 0; -+ } - - have_default_route = 1; - return 1; -@@ -1649,11 +1691,21 @@ - rt.rt_flags = RTF_UP; - if (ioctl(sock_fd, SIOCDELRT, &rt) < 0 && errno != ESRCH) { - if (still_ppp()) { -- if ( ! ok_error ( errno )) -+ if (!ok_error(errno)) - error("default route ioctl(SIOCDELRT): %m"); - return 0; - } - } -+ if (default_rt_repl_rest) { -+ notice("restoring old default route to %s [%I]", -+ old_def_rt.rt_dev, SIN_ADDR(old_def_rt.rt_gateway)); -+ if (ioctl(sock_fd, SIOCADDRT, &old_def_rt) < 0) { -+ if (!ok_error(errno)) -+ error("restore default route ioctl(SIOCADDRT): %m"); -+ return 0; -+ } -+ default_rt_repl_rest = 0; -+ } - - return 1; - } -diff -Naur ppp-2.4.4.orig/pppd/sys-solaris.c ppp-2.4.4/pppd/sys-solaris.c ---- ppp-2.4.4.orig/pppd/sys-solaris.c 2009-05-09 02:54:59.000000000 -0400 -+++ ppp-2.4.4/pppd/sys-solaris.c 2009-05-09 02:58:31.000000000 -0400 -@@ -2036,12 +2036,18 @@ - * sifdefaultroute - assign a default route through the address given. - */ - int --sifdefaultroute(u, l, g) -+sifdefaultroute(u, l, g, replace) - int u; - u_int32_t l, g; -+ bool replace; - { - struct rtentry rt; - -+ if (replace) { -+ error("replacedefaultroute not supported on this platform"); -+ return 0; -+ } -+ - #if defined(__USLC__) - g = l; /* use the local address as gateway */ - #endif diff --git a/package/ppp/patches/202-no_strip.patch b/package/ppp/patches/202-no_strip.patch index 2923a4d052..f1fbd53385 100644 --- a/package/ppp/patches/202-no_strip.patch +++ b/package/ppp/patches/202-no_strip.patch @@ -84,89 +84,3 @@ diff -Naur ppp-2.4.4.orig/pppstats/Makefile.linux ppp-2.4.4/pppstats/Makefile.li $(INSTALL) -c -m 444 pppstats.8 $(MANDIR) pppstats: $(PPPSTATSRCS) -diff -Naur ppp-2.4.4.orig/chat/Makefile.linux ppp-2.4.4/chat/Makefile.linux ---- ppp-2.4.4.orig/chat/Makefile.linux 2006-06-04 01:07:46.000000000 -0400 -+++ ppp-2.4.4/chat/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -25,7 +25,7 @@ - - install: chat - mkdir -p $(BINDIR) $(MANDIR) -- $(INSTALL) -s -c chat $(BINDIR) -+ $(INSTALL) -c chat $(BINDIR) - $(INSTALL) -c -m 644 chat.8 $(MANDIR) - - clean: -diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux ---- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 17:04:21.000000000 -0400 -+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -99,7 +99,7 @@ - CFLAGS += -DUSE_SRP -DOPENSSL -I/usr/local/ssl/include - LIBS += -lsrp -L/usr/local/ssl/lib -lcrypto - TARGETS += srp-entry --EXTRAINSTALL = $(INSTALL) -s -c -m 555 srp-entry $(BINDIR)/srp-entry -+EXTRAINSTALL = $(INSTALL) -c -m 555 srp-entry $(BINDIR)/srp-entry - MANPAGES += srp-entry.8 - EXTRACLEAN += srp-entry.o - NEEDDES=y -@@ -200,7 +200,7 @@ - install: pppd - mkdir -p $(BINDIR) $(MANDIR) - $(EXTRAINSTALL) -- $(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd -+ $(INSTALL) -c -m 555 pppd $(BINDIR)/pppd - if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \ - chmod o-rx,u+s $(BINDIR)/pppd; fi - $(INSTALL) -c -m 444 pppd.8 $(MANDIR) -diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux ---- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2006-06-04 01:04:14.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -36,9 +36,9 @@ - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) -- $(INSTALL) -s -c -m 755 radius.so $(LIBDIR) -- $(INSTALL) -s -c -m 755 radattr.so $(LIBDIR) -- $(INSTALL) -s -c -m 755 radrealms.so $(LIBDIR) -+ $(INSTALL) -c -m 755 radius.so $(LIBDIR) -+ $(INSTALL) -c -m 755 radattr.so $(LIBDIR) -+ $(INSTALL) -c -m 755 radrealms.so $(LIBDIR) - $(INSTALL) -c -m 444 pppd-radius.8 $(MANDIR) - $(INSTALL) -c -m 444 pppd-radattr.8 $(MANDIR) - -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 17:02:45.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -39,9 +39,9 @@ - - install: all - $(INSTALL) -d -m 755 $(LIBDIR) -- $(INSTALL) -s -c -m 4550 rp-pppoe.so $(LIBDIR) -+ $(INSTALL) -c -m 4550 rp-pppoe.so $(LIBDIR) - $(INSTALL) -d -m 755 $(BINDIR) -- $(INSTALL) -s -c -m 555 pppoe-discovery $(BINDIR) -+ $(INSTALL) -c -m 555 pppoe-discovery $(BINDIR) - - clean: - rm -f *.o *.so -diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux ---- ppp-2.4.4.orig/pppdump/Makefile.linux 2006-06-04 01:04:14.000000000 -0400 -+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -17,5 +17,5 @@ - - install: - mkdir -p $(BINDIR) $(MANDIR) -- $(INSTALL) -s -c pppdump $(BINDIR) -+ $(INSTALL) -c pppdump $(BINDIR) - $(INSTALL) -c -m 444 pppdump.8 $(MANDIR) -diff -Naur ppp-2.4.4.orig/pppstats/Makefile.linux ppp-2.4.4/pppstats/Makefile.linux ---- ppp-2.4.4.orig/pppstats/Makefile.linux 2006-06-04 01:07:46.000000000 -0400 -+++ ppp-2.4.4/pppstats/Makefile.linux 2009-05-07 18:04:23.000000000 -0400 -@@ -22,7 +22,7 @@ - - install: pppstats - -mkdir -p $(MANDIR) -- $(INSTALL) -s -c pppstats $(BINDIR) -+ $(INSTALL) -c pppstats $(BINDIR) - $(INSTALL) -c -m 444 pppstats.8 $(MANDIR) - - pppstats: $(PPPSTATSRCS) diff --git a/package/ppp/patches/203-opt_flags.patch b/package/ppp/patches/203-opt_flags.patch index abb60fc8c7..efadbd6189 100644 --- a/package/ppp/patches/203-opt_flags.patch +++ b/package/ppp/patches/203-opt_flags.patch @@ -24,29 +24,3 @@ diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linu OBJS = pppdump.o bsd-comp.o deflate.o zlib.o INSTALL= install -diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux ppp-2.4.4/pppd/plugins/radius/Makefile.linux ---- ppp-2.4.4.orig/pppd/plugins/radius/Makefile.linux 2009-05-07 18:05:57.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/radius/Makefile.linux 2009-05-07 18:06:23.000000000 -0400 -@@ -12,7 +12,8 @@ - INSTALL = install - - PLUGIN=radius.so radattr.so radrealms.so --CFLAGS=-I. -I../.. -I../../../include -O2 -fPIC -DRC_LOG_FACILITY=LOG_DAEMON -+COPTS = -O2 -+CFLAGS=-I. -I../.. -I../../../include $(COPTS) -fPIC -DRC_LOG_FACILITY=LOG_DAEMON - - # Uncomment the next line to include support for Microsoft's - # MS-CHAP authentication protocol. -diff -Naur ppp-2.4.4.orig/pppdump/Makefile.linux ppp-2.4.4/pppdump/Makefile.linux ---- ppp-2.4.4.orig/pppdump/Makefile.linux 2009-05-07 18:05:57.000000000 -0400 -+++ ppp-2.4.4/pppdump/Makefile.linux 2009-05-07 18:06:23.000000000 -0400 -@@ -2,7 +2,8 @@ - BINDIR = $(DESTDIR)/sbin - MANDIR = $(DESTDIR)/share/man/man8 - --CFLAGS= -O -I../include/net -+COPTS = -O -+CFLAGS= $(COPTS) -I../include/net - OBJS = pppdump.o bsd-comp.o deflate.o zlib.o - - INSTALL= install diff --git a/package/ppp/patches/204-radius_config.patch b/package/ppp/patches/204-radius_config.patch index 2cb1b19527..e19832b0d3 100644 --- a/package/ppp/patches/204-radius_config.patch +++ b/package/ppp/patches/204-radius_config.patch @@ -72,77 +72,3 @@ diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/options.h ppp-2.4.4/pppd/plugins/r {"seqfile", OT_STR, ST_UNDEF, NULL}, {"mapfile", OT_STR, ST_UNDEF, NULL}, {"default_realm", OT_STR, ST_UNDEF, NULL}, -diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/config.c ppp-2.4.4/pppd/plugins/radius/config.c ---- ppp-2.4.4.orig/pppd/plugins/radius/config.c 2004-11-14 02:26:26.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/radius/config.c 2009-05-07 19:31:14.000000000 -0400 -@@ -369,31 +369,37 @@ - } - #endif - -+#if 0 - if (rc_conf_int("login_tries") <= 0) - { - error("%s: login_tries <= 0 is illegal", filename); - return (-1); - } -+#endif - if (rc_conf_str("seqfile") == NULL) - { - error("%s: seqfile not specified", filename); - return (-1); - } -+#if 0 - if (rc_conf_int("login_timeout") <= 0) - { - error("%s: login_timeout <= 0 is illegal", filename); - return (-1); - } -+#endif - if (rc_conf_str("mapfile") == NULL) - { - error("%s: mapfile not specified", filename); - return (-1); - } -+#if 0 - if (rc_conf_str("nologin") == NULL) - { - error("%s: nologin not specified", filename); - return (-1); - } -+#endif - - return 0; - } -diff -Naur ppp-2.4.4.orig/pppd/plugins/radius/options.h ppp-2.4.4/pppd/plugins/radius/options.h ---- ppp-2.4.4.orig/pppd/plugins/radius/options.h 2004-11-14 02:26:26.000000000 -0500 -+++ ppp-2.4.4/pppd/plugins/radius/options.h 2009-05-07 19:31:14.000000000 -0400 -@@ -31,24 +31,21 @@ - static SERVER acctserver = {0}; - static SERVER authserver = {0}; - --int default_tries = 4; --int default_timeout = 60; -- - static OPTION config_options[] = { - /* internally used options */ - {"config_file", OT_STR, ST_UNDEF, NULL}, - /* General options */ - {"auth_order", OT_AUO, ST_UNDEF, NULL}, --{"login_tries", OT_INT, ST_UNDEF, &default_tries}, --{"login_timeout", OT_INT, ST_UNDEF, &default_timeout}, --{"nologin", OT_STR, ST_UNDEF, "/etc/nologin"}, --{"issue", OT_STR, ST_UNDEF, "/etc/radiusclient/issue"}, -+{"login_tries", OT_INT, ST_UNDEF, NULL}, -+{"login_timeout", OT_INT, ST_UNDEF, NULL}, -+{"nologin", OT_STR, ST_UNDEF, NULL}, -+{"issue", OT_STR, ST_UNDEF, NULL}, - /* RADIUS specific options */ - {"authserver", OT_SRV, ST_UNDEF, &authserver}, - {"acctserver", OT_SRV, ST_UNDEF, &acctserver}, - {"servers", OT_STR, ST_UNDEF, NULL}, - {"dictionary", OT_STR, ST_UNDEF, NULL}, --{"login_radius", OT_STR, ST_UNDEF, "/usr/sbin/login.radius"}, -+{"login_radius", OT_STR, ST_UNDEF, NULL}, - {"seqfile", OT_STR, ST_UNDEF, NULL}, - {"mapfile", OT_STR, ST_UNDEF, NULL}, - {"default_realm", OT_STR, ST_UNDEF, NULL}, diff --git a/package/ppp/patches/205-no_exponential_timeout.patch b/package/ppp/patches/205-no_exponential_timeout.patch index 3a3488b0ca..ca53d3474d 100644 --- a/package/ppp/patches/205-no_exponential_timeout.patch +++ b/package/ppp/patches/205-no_exponential_timeout.patch @@ -26,31 +26,3 @@ diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugi } while (conn->discoveryState == STATE_SENT_PADR); /* We're done. */ -diff -Naur ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c ---- ppp-2.4.4.orig/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 19:47:30.000000000 -0400 -+++ ppp-2.4.4/pppd/plugins/rp-pppoe/discovery.c 2009-05-07 20:23:04.000000000 -0400 -@@ -593,12 +593,14 @@ - conn->discoveryState = STATE_SENT_PADI; - waitForPADO(conn, timeout); - -+#if 0 - /* If we're just probing for access concentrators, don't do - exponential backoff. This reduces the time for an unsuccessful - probe to 15 seconds. */ - if (!conn->printACNames) { - timeout *= 2; - } -+#endif - if (conn->printACNames && conn->numPADOs) { - break; - } -@@ -621,7 +623,9 @@ - sendPADR(conn); - conn->discoveryState = STATE_SENT_PADR; - waitForPADS(conn, timeout); -+#if 0 - timeout *= 2; -+#endif - } while (conn->discoveryState == STATE_SENT_PADR); - - /* We're done. */ diff --git a/package/ppp/patches/206-compensate_time_change.patch b/package/ppp/patches/206-compensate_time_change.patch index 1566b80c9d..316c855743 100644 --- a/package/ppp/patches/206-compensate_time_change.patch +++ b/package/ppp/patches/206-compensate_time_change.patch @@ -80,85 +80,3 @@ diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c gettimeofday(&timenow, NULL); tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec; -diff -Naur ppp-2.4.4.orig/pppd/main.c ppp-2.4.4/pppd/main.c ---- ppp-2.4.4.orig/pppd/main.c 2009-05-07 22:25:24.000000000 -0400 -+++ ppp-2.4.4/pppd/main.c 2009-05-07 22:22:40.000000000 -0400 -@@ -90,6 +90,7 @@ - #include - #include - #include -+#include - - #include "pppd.h" - #include "magic.h" -@@ -227,6 +228,7 @@ - - /* Prototypes for procedures local to this file. */ - -+static void check_time(void); - static void setup_signals __P((void)); - static void create_pidfile __P((int pid)); - static void create_linkpidfile __P((int pid)); -@@ -532,6 +534,7 @@ - info("Starting link"); - } - -+ check_time(); - gettimeofday(&start_time, NULL); - script_unsetenv("CONNECT_TIME"); - script_unsetenv("BYTES_SENT"); -@@ -1264,6 +1267,36 @@ - - static struct callout *callout = NULL; /* Callout list */ - static struct timeval timenow; /* Current time */ -+static long uptime_diff = 0; -+static int uptime_diff_set = 0; -+ -+static void check_time(void) -+{ -+ long new_diff; -+ struct timeval t; -+ struct sysinfo i; -+ struct callout *p; -+ -+ gettimeofday(&t, NULL); -+ sysinfo(&i); -+ new_diff = t.tv_sec - i.uptime; -+ -+ if (!uptime_diff_set) { -+ uptime_diff = new_diff; -+ uptime_diff_set = 1; -+ return; -+ } -+ -+ if ((new_diff - 5 > uptime_diff) || (new_diff + 5 < uptime_diff)) { -+ /* system time has changed, update counters and timeouts */ -+ info("System time change detected."); -+ start_time.tv_sec += new_diff - uptime_diff; -+ -+ for (p = callout; p != NULL; p = p->c_next) -+ p->c_time.tv_sec += new_diff - uptime_diff; -+ } -+ uptime_diff = new_diff; -+} - - /* - * timeout - Schedule a timeout. -@@ -1334,6 +1367,8 @@ - { - struct callout *p; - -+ check_time(); -+ - while (callout != NULL) { - p = callout; - -@@ -1361,6 +1396,8 @@ - { - if (callout == NULL) - return NULL; -+ -+ check_time(); - - gettimeofday(&timenow, NULL); - tvp->tv_sec = callout->c_time.tv_sec - timenow.tv_sec; diff --git a/package/ppp/patches/207-lcp_mtu_max.patch b/package/ppp/patches/207-lcp_mtu_max.patch index 9977f0193d..b57284f28c 100644 --- a/package/ppp/patches/207-lcp_mtu_max.patch +++ b/package/ppp/patches/207-lcp_mtu_max.patch @@ -16,21 +16,3 @@ diff -Naur ppp-2.4.4.orig/pppd/lcp.c ppp-2.4.4/pppd/lcp.c ppp_send_config(f->unit, mtu, (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), ho->neg_pcompression, ho->neg_accompression); -diff -Naur ppp-2.4.4.orig/pppd/lcp.c ppp-2.4.4/pppd/lcp.c ---- ppp-2.4.4.orig/pppd/lcp.c 2009-05-07 22:24:09.000000000 -0400 -+++ ppp-2.4.4/pppd/lcp.c 2009-05-07 22:26:57.000000000 -0400 -@@ -1904,12 +1904,12 @@ - * the interface MTU is set to the lowest of that, the - * MTU we want to use, and our link MRU. - */ -- mtu = ho->neg_mru? ho->mru: PPP_MRU; -+ mtu = MIN(ho->neg_mru? ho->mru: PPP_MRU, ao->mru); - mru = go->neg_mru? MAX(wo->mru, go->mru): PPP_MRU; - #ifdef HAVE_MULTILINK - if (!(multilink && go->neg_mrru && ho->neg_mrru)) - #endif /* HAVE_MULTILINK */ -- netif_set_mtu(f->unit, MIN(MIN(mtu, mru), ao->mru)); -+ netif_set_mtu(f->unit, MIN(mtu, mru)); - ppp_send_config(f->unit, mtu, - (ho->neg_asyncmap? ho->asyncmap: 0xffffffff), - ho->neg_pcompression, ho->neg_accompression); diff --git a/package/ppp/patches/310-precompile_filter.patch b/package/ppp/patches/310-precompile_filter.patch index f392e430ab..ca4b6c2f95 100644 --- a/package/ppp/patches/310-precompile_filter.patch +++ b/package/ppp/patches/310-precompile_filter.patch @@ -185,190 +185,3 @@ diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.h ppp-2.4.4/pppd/pcap_pcc.h + +int pcap_pre_compiled (char * fname, struct bpf_program *p); +#endif /* PCAP_PCC_H */ -diff -Naur ppp-2.4.4.orig/pppd/Makefile.linux ppp-2.4.4/pppd/Makefile.linux ---- ppp-2.4.4.orig/pppd/Makefile.linux 2009-05-07 22:31:54.000000000 -0400 -+++ ppp-2.4.4/pppd/Makefile.linux 2009-05-07 22:33:12.000000000 -0400 -@@ -50,6 +50,9 @@ - # and that the kernel driver support PPP packet filtering. - #FILTER=y - -+# Support for precompiled filters -+PRECOMPILED_FILTER=y -+ - # Uncomment the next line to enable multilink PPP (enabled by default) - # Linux distributions: Please leave multilink ENABLED in your builds - # of pppd! -@@ -175,6 +178,14 @@ - endif - endif - -+ifdef PRECOMPILED_FILTER -+PPPDSRCS += pcap_pcc.c -+HEADERS += pcap_pcc.h -+PPPDOBJS += pcap_pcc.o -+LIBS += $(STAGING_DIR)/usr/lib/libpcap.a -+CFLAGS += -DPPP_FILTER -DPPP_PRECOMPILED_FILTER -I$(STAGING_DIR)/usr/include -+endif -+ - ifdef HAVE_INET6 - PPPDSRCS += ipv6cp.c eui64.c - HEADERS += ipv6cp.h eui64.h -diff -Naur ppp-2.4.4.orig/pppd/options.c ppp-2.4.4/pppd/options.c ---- ppp-2.4.4.orig/pppd/options.c 2009-05-07 22:25:24.000000000 -0400 -+++ ppp-2.4.4/pppd/options.c 2009-05-07 22:38:28.000000000 -0400 -@@ -57,6 +57,7 @@ - - #ifdef PPP_FILTER - #include -+#include - /* - * There have been 3 or 4 different names for this in libpcap CVS, but - * this seems to be what they have settled on... -@@ -160,6 +161,13 @@ - static int loadplugin __P((char **)); - #endif - -+#ifdef PPP_PRECOMPILED_FILTER -+#include "pcap_pcc.h" -+static int setprecompiledpassfilter __P((char **)); -+static int setprecompiledactivefilter __P((char **)); -+#undef PPP_FILTER -+#endif -+ - #ifdef PPP_FILTER - static int setpassfilter __P((char **)); - static int setactivefilter __P((char **)); -@@ -317,6 +325,14 @@ - "set filter for active pkts", OPT_PRIO }, - #endif - -+#ifdef PPP_PRECOMPILED_FILTER -+ { "precompiled-pass-filter", 1, setprecompiledpassfilter, -+ "set precompiled filter for packets to pass", OPT_PRIO }, -+ -+ { "precompiled-active-filter", 1, setprecompiledactivefilter, -+ "set precompiled filter for active pkts", OPT_PRIO }, -+#endif -+ - #ifdef MAXOCTETS - { "maxoctets", o_int, &maxoctets, - "Set connection traffic limit", -@@ -1456,6 +1472,29 @@ - return ok; - } - -+#ifdef PPP_PRECOMPILED_FILTER -+/* -+ * setprecompiledpassfilter - Set the pass filter for packets using a -+ * precompiled expression -+ */ -+static int -+setprecompiledpassfilter(argv) -+ char **argv; -+{ -+ return pcap_pre_compiled (*argv, &pass_filter); -+} -+ -+/* -+ * setactivefilter - Set the active filter for packets -+ */ -+static int -+setprecompiledactivefilter(argv) -+ char **argv; -+{ -+ return pcap_pre_compiled (*argv, &active_filter); -+} -+#endif -+ - #ifdef PPP_FILTER - /* - * setpassfilter - Set the pass filter for packets -diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.c ppp-2.4.4/pppd/pcap_pcc.c ---- ppp-2.4.4.orig/pppd/pcap_pcc.c 1969-12-31 19:00:00.000000000 -0500 -+++ ppp-2.4.4/pppd/pcap_pcc.c 2009-05-07 22:33:12.000000000 -0400 -@@ -0,0 +1,74 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include "pppd.h" -+ -+int pcap_pre_compiled (char * fname, struct bpf_program *p) -+{ -+ char buf[128]; -+ int line = 0, size = 0, index=0, ret=1; -+ FILE *f = fopen (fname, "r"); -+ if (!f) -+ { -+ option_error("error opening precompiled active-filter '%s': %s", -+ fname, strerror (errno)); -+ return 0; -+ } -+ while (fgets (buf, 127, f)) -+ { -+ line++; -+ if (*buf == '#') -+ continue; -+ if (size) -+ { -+ /* -+ struct bpf_insn { -+ u_short code; -+ u_char jt; -+ u_char jf; -+ bpf_int32 k; -+ } -+ */ -+ struct bpf_insn * insn = & p->bf_insns[index]; -+ unsigned code, jt, jf, k; -+ if (sscanf (buf, "%u %u %u %u", &code, &jt, &jf, &k) != 4) -+ { -+ goto err; -+ } -+ insn->code = code; -+ insn->jt = jt; -+ insn->jf = jf; -+ insn->k = k; -+ index++; -+ } -+ else -+ { -+ if (sscanf (buf, "%u", &size) != 1) -+ { -+ goto err; -+ } -+ p->bf_len = size; -+ p->bf_insns = (struct bpf_insn *) -+ malloc (size * sizeof (struct bpf_insn)); -+ } -+ } -+ if (size != index) -+ { -+ option_error("error in precompiled active-filter," -+ " expected %d expressions, got %dn", -+ size, index); -+ ret = 0; -+ } -+ fclose(f); -+ return ret; -+ -+err: -+ option_error("error in precompiled active-filter" -+ " expression line %s:%d (wrong size)\n", -+ fname, line); -+ fclose (f); -+ return 0; -+} -diff -Naur ppp-2.4.4.orig/pppd/pcap_pcc.h ppp-2.4.4/pppd/pcap_pcc.h ---- ppp-2.4.4.orig/pppd/pcap_pcc.h 1969-12-31 19:00:00.000000000 -0500 -+++ ppp-2.4.4/pppd/pcap_pcc.h 2009-05-07 22:33:12.000000000 -0400 -@@ -0,0 +1,7 @@ -+#ifndef PCAP_PCC_H -+#define PCAP_PCC_H -+ -+#include -+ -+int pcap_pre_compiled (char * fname, struct bpf_program *p); -+#endif /* PCAP_PCC_H */