Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/usr.sbin/pppd/pppd Pull up following revision(s) (request...
details: https://anonhg.NetBSD.org/src/rev/ca488aee459e
branches: netbsd-6
changeset: 776388:ca488aee459e
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Jul 29 05:35:41 2013 +0000
description:
Pull up following revision(s) (requested by christos in ticket #908):
usr.sbin/pppd/pppd/sys-bsd.c: revision 1.68
Add a set_queue_size to avoid more code duplication, and set the queue size
of all tty fd's, not just the ones that we create (the ones that we get
passed in too). Fixes my iPhone -> xl2tpd -> pppd VPN from corrupting packets
with MTU > ~650.
diffstat:
usr.sbin/pppd/pppd/sys-bsd.c | 41 ++++++++++++++++++++++++++++++-----------
1 files changed, 30 insertions(+), 11 deletions(-)
diffs (102 lines):
diff -r d24e796f7ec7 -r ca488aee459e usr.sbin/pppd/pppd/sys-bsd.c
--- a/usr.sbin/pppd/pppd/sys-bsd.c Mon Jul 29 02:16:15 2013 +0000
+++ b/usr.sbin/pppd/pppd/sys-bsd.c Mon Jul 29 05:35:41 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys-bsd.c,v 1.65 2011/09/24 20:19:39 christos Exp $ */
+/* $NetBSD: sys-bsd.c,v 1.65.4.1 2013/07/29 05:35:41 msaitoh Exp $ */
/*
* sys-bsd.c - System-dependent procedures for setting up
@@ -79,7 +79,7 @@
#if 0
#define RCSID "Id: sys-bsd.c,v 1.47 2000/04/13 12:04:23 paulus Exp "
#else
-__RCSID("$NetBSD: sys-bsd.c,v 1.65 2011/09/24 20:19:39 christos Exp $");
+__RCSID("$NetBSD: sys-bsd.c,v 1.65.4.1 2013/07/29 05:35:41 msaitoh Exp $");
#endif
#endif
@@ -201,6 +201,27 @@
static void restore_loop(void); /* Transfer ppp unit back to loopback */
+static void
+set_queue_size(const char *fmt, int fd) {
+#ifdef TIOCSQSIZE
+ int oqsize, qsize = 32768;
+
+ /* Only for ptys */
+ if (ioctl(fd, TIOCGQSIZE, &oqsize) == -1)
+ return;
+
+ if (oqsize >= qsize)
+ return;
+
+ if (ioctl(fd, TIOCSQSIZE, &qsize) == -1)
+ warn("%s: Cannot set tty queue size for %d from %d to %d", fmt, fd,
+ oqsize, qsize);
+ else
+ notice("%s: Changed queue size of %d from %d to %d", fmt, fd, oqsize,
+ qsize);
+#endif
+}
+
/********************************************************************
*
* Functions to read and set the flags value in the device driver
@@ -386,6 +407,7 @@
fatal("%s: ioctl(transfer ppp unit): %m", __func__);
}
+ set_queue_size(__func__, fd);
/*
* Save the old line discipline of fd, and set it to PPP.
*/
@@ -443,6 +465,7 @@
{
int x;
+ set_queue_size(__func__, loop_slave);
/*
* Transfer the ppp interface back to the loopback.
*/
@@ -645,6 +668,7 @@
}
}
+
/*
* set_up_tty: Set up the serial port on `fd' for 8 bits, no parity,
* at the requested speed, etc. If `local' is true, set CLOCAL
@@ -665,6 +689,8 @@
ioctl(fd, TIOCGWINSZ, &wsinfo);
}
+ set_queue_size(__func__, fd);
+
tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
if (crtscts > 0 && !local) {
if (crtscts == 2) {
@@ -931,20 +957,13 @@
int
get_pty(int *master_fdp, int *slave_fdp, char *slave_name, int uid)
{
-#ifdef TIOCSQSIZE
- int qsize = 32768;
-#endif
struct termios tios;
if (openpty(master_fdp, slave_fdp, slave_name, NULL, NULL) < 0)
return 0;
-#ifdef TIOCSQSIZE
- if (ioctl(*master_fdp, TIOCSQSIZE, &qsize) == -1)
- warn("%s: couldn't set master queue size: %m", __func__);
- if (ioctl(*slave_fdp, TIOCSQSIZE, &qsize) == -1)
- warn("%s: couldn't set slave queue size: %m", __func__);
-#endif
+ set_queue_size(__func__, *master_fdp);
+ set_queue_size(__func__, *slave_fdp);
fchown(*slave_fdp, uid, -1);
fchmod(*slave_fdp, S_IRUSR | S_IWUSR);
if (tcgetattr(*slave_fdp, &tios) == 0) {
Home |
Main Index |
Thread Index |
Old Index