diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-03-07 02:09:48 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-03-07 02:09:48 +0000 |
commit | 0ca2b7f92cc00ad95420afd46f5e8f70baf93d42 (patch) | |
tree | b0d5a2a400d0f821040308d1ac6f310d3735834d | |
parent | 00d2c4b0481bd9cdeb69b5ac420d46cdf4a5713d (diff) | |
download | upstream-0ca2b7f92cc00ad95420afd46f5e8f70baf93d42.tar.gz upstream-0ca2b7f92cc00ad95420afd46f5e8f70baf93d42.tar.bz2 upstream-0ca2b7f92cc00ad95420afd46f5e8f70baf93d42.zip |
ppp: add a few patches to reduce the package size
SVN-Revision: 25919
-rw-r--r-- | package/ppp/patches/400-simplify_kernel_checks.patch | 92 | ||||
-rw-r--r-- | package/ppp/patches/401-no_record_file.patch | 32 | ||||
-rw-r--r-- | package/ppp/patches/402-use_uclibc_utils.patch | 365 | ||||
-rw-r--r-- | package/ppp/patches/403-no_wtmp.patch | 18 | ||||
-rw-r--r-- | package/ppp/patches/404-remove_obsolete_protocol_names.patch | 144 |
5 files changed, 651 insertions, 0 deletions
diff --git a/package/ppp/patches/400-simplify_kernel_checks.patch b/package/ppp/patches/400-simplify_kernel_checks.patch new file mode 100644 index 0000000000..03591a897c --- /dev/null +++ b/package/ppp/patches/400-simplify_kernel_checks.patch @@ -0,0 +1,92 @@ +--- a/pppd/sys-linux.c ++++ b/pppd/sys-linux.c +@@ -203,7 +203,7 @@ static int driver_is_old = 0; + static int restore_term = 0; /* 1 => we've munged the terminal */ + static struct termios inittermios; /* Initial TTY termios */ + +-int new_style_driver = 0; ++static const int new_style_driver = 1; + + static char loop_name[20]; + static unsigned char inbuf[512]; /* buffer for chars read from loopback */ +@@ -220,8 +220,8 @@ static int looped; /* 1 if using loop + static int link_mtu; /* mtu for the link (not bundle) */ + + static struct utsname utsname; /* for the kernel version */ +-static int kernel_version; + #define KVERSION(j,n,p) ((j)*1000000 + (n)*1000 + (p)) ++static const int kernel_version = KVERSION(2,6,37); + + #define MAX_IFS 100 + +@@ -1414,11 +1414,12 @@ int ccp_fatal_error (int unit) + * + * path_to_procfs - find the path to the proc file system mount point + */ +-static char proc_path[MAXPATHLEN]; +-static int proc_path_len; ++static char proc_path[MAXPATHLEN] = "/proc"; ++static int proc_path_len = 5; + + static char *path_to_procfs(const char *tail) + { ++#if 0 + struct mntent *mntent; + FILE *fp; + +@@ -1440,6 +1441,7 @@ static char *path_to_procfs(const char * + fclose (fp); + } + } ++#endif + + strlcpy(proc_path + proc_path_len, tail, + sizeof(proc_path) - proc_path_len); +@@ -2098,11 +2100,13 @@ int ppp_available(void) + "ppp.o exists in /lib/modules/`uname -r`/net.\n" + "See README.linux file in the ppp distribution for more details.\n"; + ++#if 0 + /* get the kernel version now, since we are called before sys_init */ + uname(&utsname); + osmaj = osmin = ospatch = 0; + sscanf(utsname.release, "%d.%d.%d", &osmaj, &osmin, &ospatch); + kernel_version = KVERSION(osmaj, osmin, ospatch); ++#endif + + fd = open("/dev/ppp", O_RDWR); + #if 0 +@@ -2121,7 +2125,9 @@ int ppp_available(void) + } + #endif /* 0 */ + if (fd >= 0) { ++#if 0 + new_style_driver = 1; ++#endif + + /* XXX should get from driver */ + driver_version = 2; +@@ -2168,6 +2174,7 @@ int ppp_available(void) + + if (ok && ((ifr.ifr_hwaddr.sa_family & ~0xFF) != ARPHRD_PPP)) + ok = 0; ++ return ok; + + /* + * This is the PPP device. Validate the version of the driver at this +@@ -2659,6 +2666,7 @@ get_pty(master_fdp, slave_fdp, slave_nam + } + #endif /* TIOCGPTN */ + ++#if 0 + if (sfd < 0) { + /* the old way - scan through the pty name space */ + for (i = 0; i < 64; ++i) { +@@ -2677,6 +2685,7 @@ get_pty(master_fdp, slave_fdp, slave_nam + } + } + } ++#endif + + if (sfd < 0) + return 0; diff --git a/package/ppp/patches/401-no_record_file.patch b/package/ppp/patches/401-no_record_file.patch new file mode 100644 index 0000000000..431fcac78a --- /dev/null +++ b/package/ppp/patches/401-no_record_file.patch @@ -0,0 +1,32 @@ +--- a/pppd/pppd.h ++++ b/pppd/pppd.h +@@ -308,7 +308,6 @@ extern int holdoff; /* Dead time before + extern bool holdoff_specified; /* true if user gave a holdoff value */ + extern bool notty; /* Stdin/out is not a tty */ + extern char *pty_socket; /* Socket to connect to pty */ +-extern char *record_file; /* File to record chars sent/received */ + extern bool sync_serial; /* Device is synchronous serial device */ + extern int maxfail; /* Max # of unsuccessful connection attempts */ + extern char linkname[MAXPATHLEN]; /* logical name for link */ +--- a/pppd/tty.c ++++ b/pppd/tty.c +@@ -144,7 +144,7 @@ char *disconnect_script = NULL; /* Scrip + char *welcomer = NULL; /* Script to run after phys link estab. */ + char *ptycommand = NULL; /* Command to run on other side of pty */ + bool notty = 0; /* Stdin/out is not a tty */ +-char *record_file = NULL; /* File to record chars sent/received */ ++static char *const record_file = NULL; /* File to record chars sent/received */ + int max_data_rate; /* max bytes/sec through charshunt */ + bool sync_serial = 0; /* Device is synchronous serial device */ + char *pty_socket = NULL; /* Socket to connect to pty */ +@@ -200,8 +200,10 @@ option_t tty_options[] = { + "Send and receive over socket, arg is host:port", + OPT_PRIO | OPT_DEVNAM }, + ++#if 0 + { "record", o_string, &record_file, + "Record characters sent/received to file", OPT_PRIO }, ++#endif + + { "crtscts", o_int, &crtscts, + "Set hardware (RTS/CTS) flow control", diff --git a/package/ppp/patches/402-use_uclibc_utils.patch b/package/ppp/patches/402-use_uclibc_utils.patch new file mode 100644 index 0000000000..6fc8535a54 --- /dev/null +++ b/package/ppp/patches/402-use_uclibc_utils.patch @@ -0,0 +1,365 @@ +--- a/pppd/utils.c ++++ b/pppd/utils.c +@@ -30,6 +30,7 @@ + + #define RCSID "$Id: utils.c,v 1.24 2004/11/04 10:02:26 paulus Exp $" + ++#define _BSD_SOURCE + #include <stdio.h> + #include <ctype.h> + #include <stdlib.h> +@@ -67,15 +68,10 @@ extern char *strerror(); + + static void logit __P((int, char *, va_list)); + static void log_write __P((int, char *)); +-static void vslp_printer __P((void *, char *, ...)); + static void format_packet __P((u_char *, int, void (*) (void *, char *, ...), + void *)); + +-struct buffer_info { +- char *ptr; +- int len; +-}; +- ++#ifndef __UCLIBC__ + /* + * strlcpy - like strcpy/strncpy, doesn't overflow destination buffer, + * always leaves destination null-terminated (for len > 0). +@@ -113,6 +109,7 @@ strlcat(dest, src, len) + + return dlen + strlcpy(dest + dlen, src, (len > dlen? len - dlen: 0)); + } ++#endif + + + /* +@@ -129,17 +126,7 @@ slprintf __V((char *buf, int buflen, cha + va_list args; + int n; + +-#if defined(__STDC__) + va_start(args, fmt); +-#else +- char *buf; +- int buflen; +- char *fmt; +- va_start(args); +- buf = va_arg(args, char *); +- buflen = va_arg(args, int); +- fmt = va_arg(args, char *); +-#endif + n = vslprintf(buf, buflen, fmt, args); + va_end(args); + return n; +@@ -148,7 +135,6 @@ slprintf __V((char *buf, int buflen, cha + /* + * vslprintf - like slprintf, takes a va_list instead of a list of args. + */ +-#define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) + + int + vslprintf(buf, buflen, fmt, args) +@@ -157,298 +143,14 @@ vslprintf(buf, buflen, fmt, args) + char *fmt; + va_list args; + { +- int c, i, n; +- int width, prec, fillch; +- int base, len, neg, quoted; +- unsigned long val = 0; +- char *str, *f, *buf0; +- unsigned char *p; +- char num[32]; +- time_t t; +- u_int32_t ip; +- static char hexchars[] = "0123456789abcdef"; +- struct buffer_info bufinfo; +- +- buf0 = buf; +- --buflen; +- while (buflen > 0) { +- for (f = fmt; *f != '%' && *f != 0; ++f) +- ; +- if (f > fmt) { +- len = f - fmt; +- if (len > buflen) +- len = buflen; +- memcpy(buf, fmt, len); +- buf += len; +- buflen -= len; +- fmt = f; +- } +- if (*fmt == 0) +- break; +- c = *++fmt; +- width = 0; +- prec = -1; +- fillch = ' '; +- if (c == '0') { +- fillch = '0'; +- c = *++fmt; +- } +- if (c == '*') { +- width = va_arg(args, int); +- c = *++fmt; +- } else { +- while (isdigit(c)) { +- width = width * 10 + c - '0'; +- c = *++fmt; +- } +- } +- if (c == '.') { +- c = *++fmt; +- if (c == '*') { +- prec = va_arg(args, int); +- c = *++fmt; +- } else { +- prec = 0; +- while (isdigit(c)) { +- prec = prec * 10 + c - '0'; +- c = *++fmt; +- } +- } +- } +- str = 0; +- base = 0; +- neg = 0; +- ++fmt; +- switch (c) { +- case 'l': +- c = *fmt++; +- switch (c) { +- case 'd': +- val = va_arg(args, long); +- if (val < 0) { +- neg = 1; +- val = -val; +- } +- base = 10; +- break; +- case 'u': +- val = va_arg(args, unsigned long); +- base = 10; +- break; +- default: +- *buf++ = '%'; --buflen; +- *buf++ = 'l'; --buflen; +- --fmt; /* so %lz outputs %lz etc. */ +- continue; +- } +- break; +- case 'd': +- i = va_arg(args, int); +- if (i < 0) { +- neg = 1; +- val = -i; +- } else +- val = i; +- base = 10; +- break; +- case 'u': +- val = va_arg(args, unsigned int); +- base = 10; +- break; +- case 'o': +- val = va_arg(args, unsigned int); +- base = 8; +- break; +- case 'x': +- case 'X': +- val = va_arg(args, unsigned int); +- base = 16; +- break; +- case 'p': +- val = (unsigned long) va_arg(args, void *); +- base = 16; +- neg = 2; +- break; +- case 's': +- str = va_arg(args, char *); +- break; +- case 'c': +- num[0] = va_arg(args, int); +- num[1] = 0; +- str = num; +- break; +- case 'm': +- str = strerror(errno); +- break; +- case 'I': +- ip = va_arg(args, u_int32_t); +- ip = ntohl(ip); +- slprintf(num, sizeof(num), "%d.%d.%d.%d", (ip >> 24) & 0xff, +- (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff); +- str = num; +- break; +-#if 0 /* not used, and breaks on S/390, apparently */ +- case 'r': +- f = va_arg(args, char *); +-#ifndef __powerpc__ +- n = vslprintf(buf, buflen + 1, f, va_arg(args, va_list)); +-#else +- /* On the powerpc, a va_list is an array of 1 structure */ +- n = vslprintf(buf, buflen + 1, f, va_arg(args, void *)); +-#endif +- buf += n; +- buflen -= n; +- continue; +-#endif +- case 't': +- time(&t); +- str = ctime(&t); +- str += 4; /* chop off the day name */ +- str[15] = 0; /* chop off year and newline */ +- break; +- case 'v': /* "visible" string */ +- case 'q': /* quoted string */ +- quoted = c == 'q'; +- p = va_arg(args, unsigned char *); +- if (fillch == '0' && prec >= 0) { +- n = prec; +- } else { +- n = strlen((char *)p); +- if (prec >= 0 && n > prec) +- n = prec; +- } +- while (n > 0 && buflen > 0) { +- c = *p++; +- --n; +- if (!quoted && c >= 0x80) { +- OUTCHAR('M'); +- OUTCHAR('-'); +- c -= 0x80; +- } +- if (quoted && (c == '"' || c == '\\')) +- OUTCHAR('\\'); +- if (c < 0x20 || (0x7f <= c && c < 0xa0)) { +- if (quoted) { +- OUTCHAR('\\'); +- switch (c) { +- case '\t': OUTCHAR('t'); break; +- case '\n': OUTCHAR('n'); break; +- case '\b': OUTCHAR('b'); break; +- case '\f': OUTCHAR('f'); break; +- default: +- OUTCHAR('x'); +- OUTCHAR(hexchars[c >> 4]); +- OUTCHAR(hexchars[c & 0xf]); +- } +- } else { +- if (c == '\t') +- OUTCHAR(c); +- else { +- OUTCHAR('^'); +- OUTCHAR(c ^ 0x40); +- } +- } +- } else +- OUTCHAR(c); +- } +- continue; +- case 'P': /* print PPP packet */ +- bufinfo.ptr = buf; +- bufinfo.len = buflen + 1; +- p = va_arg(args, unsigned char *); +- n = va_arg(args, int); +- format_packet(p, n, vslp_printer, &bufinfo); +- buf = bufinfo.ptr; +- buflen = bufinfo.len - 1; +- continue; +- case 'B': +- p = va_arg(args, unsigned char *); +- for (n = prec; n > 0; --n) { +- c = *p++; +- if (fillch == ' ') +- OUTCHAR(' '); +- OUTCHAR(hexchars[(c >> 4) & 0xf]); +- OUTCHAR(hexchars[c & 0xf]); +- } +- continue; +- default: +- *buf++ = '%'; +- if (c != '%') +- --fmt; /* so %z outputs %z etc. */ +- --buflen; +- continue; +- } +- if (base != 0) { +- str = num + sizeof(num); +- *--str = 0; +- while (str > num + neg) { +- *--str = hexchars[val % base]; +- val = val / base; +- if (--prec <= 0 && val == 0) +- break; +- } +- switch (neg) { +- case 1: +- *--str = '-'; +- break; +- case 2: +- *--str = 'x'; +- *--str = '0'; +- break; +- } +- len = num + sizeof(num) - 1 - str; +- } else { +- len = strlen(str); +- if (prec >= 0 && len > prec) +- len = prec; +- } +- if (width > 0) { +- if (width > buflen) +- width = buflen; +- if ((n = width - len) > 0) { +- buflen -= n; +- for (; n > 0; --n) +- *buf++ = fillch; +- } +- } +- if (len > buflen) +- len = buflen; +- memcpy(buf, str, len); +- buf += len; +- buflen -= len; +- } +- *buf = 0; +- return buf - buf0; +-} ++ int ret; + +-/* +- * vslp_printer - used in processing a %P format +- */ +-static void +-vslp_printer __V((void *arg, char *fmt, ...)) +-{ +- int n; +- va_list pvar; +- struct buffer_info *bi; +- +-#if defined(__STDC__) +- va_start(pvar, fmt); +-#else +- void *arg; +- char *fmt; +- va_start(pvar); +- arg = va_arg(pvar, void *); +- fmt = va_arg(pvar, char *); +-#endif +- +- bi = (struct buffer_info *) arg; +- n = vslprintf(bi->ptr, bi->len, fmt, pvar); +- va_end(pvar); +- +- bi->ptr += n; +- bi->len -= n; ++ ret = vsnprintf(buf, buflen, fmt, args); ++ buf[buflen - 1] = 0; ++ return ret; + } + ++ + #ifdef unused + /* + * log_packet - format a packet and log it. diff --git a/package/ppp/patches/403-no_wtmp.patch b/package/ppp/patches/403-no_wtmp.patch new file mode 100644 index 0000000000..c3e9c7b613 --- /dev/null +++ b/package/ppp/patches/403-no_wtmp.patch @@ -0,0 +1,18 @@ +--- a/pppd/sys-linux.c ++++ b/pppd/sys-linux.c +@@ -2237,6 +2237,7 @@ int ppp_available(void) + + void logwtmp (const char *line, const char *name, const char *host) + { ++#if 0 + struct utmp ut, *utp; + pid_t mypid = getpid(); + #if __GLIBC__ < 2 +@@ -2302,6 +2303,7 @@ void logwtmp (const char *line, const ch + close (wtmp); + } + #endif ++#endif + } + + diff --git a/package/ppp/patches/404-remove_obsolete_protocol_names.patch b/package/ppp/patches/404-remove_obsolete_protocol_names.patch new file mode 100644 index 0000000000..f04d971a22 --- /dev/null +++ b/package/ppp/patches/404-remove_obsolete_protocol_names.patch @@ -0,0 +1,144 @@ +--- a/pppd/main.c ++++ b/pppd/main.c +@@ -879,14 +879,17 @@ struct protocol_list { + const char *name; + } protocol_list[] = { + { 0x21, "IP" }, ++#if 0 + { 0x23, "OSI Network Layer" }, + { 0x25, "Xerox NS IDP" }, + { 0x27, "DECnet Phase IV" }, + { 0x29, "Appletalk" }, + { 0x2b, "Novell IPX" }, ++#endif + { 0x2d, "VJ compressed TCP/IP" }, + { 0x2f, "VJ uncompressed TCP/IP" }, + { 0x31, "Bridging PDU" }, ++#if 0 + { 0x33, "Stream Protocol ST-II" }, + { 0x35, "Banyan Vines" }, + { 0x39, "AppleTalk EDDP" }, +@@ -900,8 +903,11 @@ struct protocol_list { + { 0x49, "Serial Data Transport Protocol (PPP-SDTP)" }, + { 0x4b, "SNA over 802.2" }, + { 0x4d, "SNA" }, ++#endif + { 0x4f, "IP6 Header Compression" }, ++#if 0 + { 0x51, "KNX Bridging Data" }, ++#endif + { 0x53, "Encryption" }, + { 0x55, "Individual Link Encryption" }, + { 0x57, "IPv6" }, +@@ -912,12 +918,15 @@ struct protocol_list { + { 0x65, "RTP IPHC Compressed non-TCP" }, + { 0x67, "RTP IPHC Compressed UDP 8" }, + { 0x69, "RTP IPHC Compressed RTP 8" }, ++#if 0 + { 0x6f, "Stampede Bridging" }, + { 0x73, "MP+" }, + { 0xc1, "NTCITS IPI" }, ++#endif + { 0xfb, "single-link compression" }, + { 0xfd, "Compressed Datagram" }, + { 0x0201, "802.1d Hello Packets" }, ++#if 0 + { 0x0203, "IBM Source Routing BPDU" }, + { 0x0205, "DEC LANBridge100 Spanning Tree" }, + { 0x0207, "Cisco Discovery Protocol" }, +@@ -929,15 +938,19 @@ struct protocol_list { + { 0x0231, "Luxcom" }, + { 0x0233, "Sigma Network Systems" }, + { 0x0235, "Apple Client Server Protocol" }, ++#endif + { 0x0281, "MPLS Unicast" }, + { 0x0283, "MPLS Multicast" }, ++#if 0 + { 0x0285, "IEEE p1284.4 standard - data packets" }, + { 0x0287, "ETSI TETRA Network Protocol Type 1" }, ++#endif + { 0x0289, "Multichannel Flow Treatment Protocol" }, + { 0x2063, "RTP IPHC Compressed TCP No Delta" }, + { 0x2065, "RTP IPHC Context State" }, + { 0x2067, "RTP IPHC Compressed UDP 16" }, + { 0x2069, "RTP IPHC Compressed RTP 16" }, ++#if 0 + { 0x4001, "Cray Communications Control Protocol" }, + { 0x4003, "CDPD Mobile Network Registration Protocol" }, + { 0x4005, "Expand accelerator protocol" }, +@@ -948,8 +961,10 @@ struct protocol_list { + { 0x4023, "RefTek Protocol" }, + { 0x4025, "Fibre Channel" }, + { 0x4027, "EMIT Protocols" }, ++#endif + { 0x405b, "Vendor-Specific Protocol (VSP)" }, + { 0x8021, "Internet Protocol Control Protocol" }, ++#if 0 + { 0x8023, "OSI Network Layer Control Protocol" }, + { 0x8025, "Xerox NS IDP Control Protocol" }, + { 0x8027, "DECnet Phase IV Control Protocol" }, +@@ -958,7 +973,9 @@ struct protocol_list { + { 0x8031, "Bridging NCP" }, + { 0x8033, "Stream Protocol Control Protocol" }, + { 0x8035, "Banyan Vines Control Protocol" }, ++#endif + { 0x803d, "Multi-Link Control Protocol" }, ++#if 0 + { 0x803f, "NETBIOS Framing Control Protocol" }, + { 0x8041, "Cisco Systems Control Protocol" }, + { 0x8043, "Ascom Timeplex" }, +@@ -967,18 +984,24 @@ struct protocol_list { + { 0x8049, "Serial Data Control Protocol (PPP-SDCP)" }, + { 0x804b, "SNA over 802.2 Control Protocol" }, + { 0x804d, "SNA Control Protocol" }, ++#endif + { 0x804f, "IP6 Header Compression Control Protocol" }, ++#if 0 + { 0x8051, "KNX Bridging Control Protocol" }, ++#endif + { 0x8053, "Encryption Control Protocol" }, + { 0x8055, "Individual Link Encryption Control Protocol" }, + { 0x8057, "IPv6 Control Protovol" }, + { 0x8059, "PPP Muxing Control Protocol" }, + { 0x805b, "Vendor-Specific Network Control Protocol (VSNCP)" }, ++#if 0 + { 0x806f, "Stampede Bridging Control Protocol" }, + { 0x8073, "MP+ Control Protocol" }, + { 0x80c1, "NTCITS IPI Control Protocol" }, ++#endif + { 0x80fb, "Single Link Compression Control Protocol" }, + { 0x80fd, "Compression Control Protocol" }, ++#if 0 + { 0x8207, "Cisco Discovery Protocol Control" }, + { 0x8209, "Netcs Twin Routing" }, + { 0x820b, "STP - Control Protocol" }, +@@ -987,24 +1010,29 @@ struct protocol_list { + { 0x8281, "MPLSCP" }, + { 0x8285, "IEEE p1284.4 standard - Protocol Control" }, + { 0x8287, "ETSI TETRA TNP1 Control Protocol" }, ++#endif + { 0x8289, "Multichannel Flow Treatment Protocol" }, + { 0xc021, "Link Control Protocol" }, + { 0xc023, "Password Authentication Protocol" }, + { 0xc025, "Link Quality Report" }, ++#if 0 + { 0xc027, "Shiva Password Authentication Protocol" }, + { 0xc029, "CallBack Control Protocol (CBCP)" }, + { 0xc02b, "BACP Bandwidth Allocation Control Protocol" }, + { 0xc02d, "BAP" }, ++#endif + { 0xc05b, "Vendor-Specific Authentication Protocol (VSAP)" }, + { 0xc081, "Container Control Protocol" }, + { 0xc223, "Challenge Handshake Authentication Protocol" }, + { 0xc225, "RSA Authentication Protocol" }, + { 0xc227, "Extensible Authentication Protocol" }, ++#if 0 + { 0xc229, "Mitsubishi Security Info Exch Ptcl (SIEP)" }, + { 0xc26f, "Stampede Bridging Authorization Protocol" }, + { 0xc281, "Proprietary Authentication Protocol" }, + { 0xc283, "Proprietary Authentication Protocol" }, + { 0xc481, "Proprietary Node ID Authentication Protocol" }, ++#endif + { 0, NULL }, + }; + |