NetBSD Problem Report #9946
Received: (qmail 3817 invoked from network); 21 Apr 2000 02:46:31 -0000
Message-Id: <200004210246.WAA02722@bauhaus.degler.net>
Date: Thu, 20 Apr 2000 22:46:29 -0400 (EDT)
From: Stephen Degler <sdegler@bauhaus.degler.net>
Reply-To: sdegler@degler.net
To: gnats-bugs@gnats.netbsd.org
Cc: sdegler@degler.net, mouse@rodents.montreal.qc.ca
Subject: fixes for mouse-ppoe pkg
X-Send-Pr-Version: 3.95
>Number: 9946
>Category: pkg
>Synopsis: bug fixes for packet length and added a signal handler
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 21 02:47:00 +0000 2000
>Closed-Date: Mon Feb 26 13:24:36 +0000 2001
>Last-Modified: Mon Feb 26 13:24:36 +0000 2001
>Originator: Stephen Degler
>Release: NetBSD-current Thu Apr 20 22:27:43 2000
>Organization:
very little at best
>Environment:
System: NetBSD bauhaus.degler.net 1.4X NetBSD 1.4X (BAUHAUS) #1: Thu Apr 20 01:10:01 EDT 2000 root@bauhaus.degler.net:/vol2/src/sys/arch/alpha/compile/BAUHAUS alpha
>Description:
1) The output buffer is 1500 bytes, but a raw ethernet frame
is 1514 bytes including mac addresses and ether type. Fixed
the output buffer length and the the length check function to
reflect this.
2) If the pppoe process it signaled, the pppd child dies without
sending an lcp close. Subsequent invocations see frames from the
previous session, and it complans. Also, no PADT is sent. A
signal handler is established to forward the signals to pppd,
which then exits gracefully.
3) The current pppd requires a speed argument. Other options
were changed to suit my environment. Your mileage may vary.
>How-To-Repeat:
1) ping -s 1500 host.at.other.end.of.pppoe (see output packet
overflow messages)
2) ^Cpppoe. ; ./pppoe le0 foo (see complaints about the old session).
3) ./pppoe le0 foo (see pppd usage message output).
>Fix:
--- pppoe.c.orig Fri Apr 14 01:57:21 2000
+++ pppoe.c Thu Apr 20 22:15:44 2000
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
+#include <signal.h>
#include <sys/socket.h>
#include <net/if.h>
#include <termios.h>
@@ -21,6 +22,7 @@
#define UNIQLEN 8
#define MAXPKTLEN 1500 /* forced by Ethernet MTU */
+#define MAXFRMLEN 1514 /* payload + 2 mac addresses + ether type */
#define PPP_FLAG 0x7e
#define PPP_ESC 0x7d
@@ -57,7 +59,7 @@
static int ntags;
static TAG *tags;
static int tagsalloc;
-static unsigned char opkt[MAXPKTLEN];
+static unsigned char opkt[MAXFRMLEN];
static int pktoff;
static char ptymname[11];
static int ptymfd;
@@ -65,6 +67,7 @@
static int ptysfd;
static int devnull;
static int pppdeathpipe;
+static int ppp_pid;
static unsigned char ppp_pty_frame[MAXPKTLEN+2];
static int ppp_pty_flen;
static int ppp_pty_fcs;
@@ -110,6 +113,8 @@
#define P_DEBUG 4
static int pppdebug = 0;
+void sig_handler(int);
+
static void p(int, const char *, ...)
__attribute__((__format__(__printf__,2,3)));
static void p(int level, const char *fmt, ...)
@@ -300,9 +305,9 @@
static int pktlenchk(int len)
{
- if (pktoff+len > MAXPKTLEN)
- { if (pktoff <= MAXPKTLEN) p(P_WARN,"output packet overflow\n");
- pktoff = MAXPKTLEN + 1;
+ if (pktoff+len > MAXFRMLEN)
+ { if (pktoff <= MAXFRMLEN) p(P_WARN,"output packet overflow %d\n",pktoff+len);
+ pktoff = MAXFRMLEN + 1;
return(1);
}
return(0);
@@ -577,6 +582,8 @@
}
if (kid != 0)
{ for (i=getdtablesize()-1;i>2;i--) if (i != deathpipe[1]) close(i);
+ if ( write(deathpipe[1],(char *)&kid,sizeof(kid)) < 0 )
+ _exit(1);
wait(&i);
_exit(0);
}
@@ -590,6 +597,7 @@
const char **ap;
ap = &args[0];
*ap++ = "pppd";
+ *ap++ = "115200";
*ap++ = "connect"; *ap++ = "/usr/bin/true";
*ap++ = "ipcp-accept-local";
*ap++ = "ipcp-accept-remote";
@@ -597,15 +605,16 @@
*ap++ = "mru"; *ap++ = "1492";
*ap++ = "mtu"; *ap++ = "1492";
*ap++ = "name"; *ap++ = pppname;
+ *ap++ = "netmask"; *ap++ = "255.255.255.255";
*ap++ = "noaccomp";
- /* *ap++ = "noauth"; */
+ *ap++ = "noauth";
*ap++ = "nobsdcomp";
*ap++ = "noccp";
*ap++ = "nodefaultroute";
*ap++ = "nodeflate";
*ap++ = "nodetach";
*ap++ = "noipdefault";
- *ap++ = "noipx";
+ /* *ap++ = "noipx"; */
*ap++ = "nopcomp";
*ap++ = "nopersist";
*ap++ = "nopredictor1";
@@ -969,11 +978,32 @@
static void process_ppp_death(void)
{
- while (wait3(0,WNOHANG,0) > 0) ;
- p(P_INFO,"exiting on ppp death\n");
- close(pppdeathpipe);
- send_padt();
- exit(0);
+ int num;
+
+ if (( num = read(pppdeathpipe,&ppp_pid,sizeof(ppp_pid))) == sizeof(ppp_pid))
+ {
+ /* set up signal handlers to for gracefull exit */
+ signal(SIGHUP,(void (*)(int))sig_handler);
+ signal(SIGINT,(void (*)(int))sig_handler);
+ signal(SIGTERM,(void (*)(int))sig_handler);
+ return;
+ }
+ else if ( num == 0 )
+ {
+ while (wait3(0,WNOHANG,0) > 0) ;
+ p(P_INFO,"exiting on ppp death\n");
+ close(pppdeathpipe);
+ send_padt();
+ exit(0);
+ }
+ else
+ {
+ p(P_INFO,"exiting due to pipe problem\n");
+ close(pppdeathpipe);
+ send_padt();
+ exit(1);
+ }
+
/*
state = S_INITIATE;
gettimeofday(&timeout,0);
@@ -1116,4 +1146,17 @@
}
}
}
+}
+
+void sig_handler(int sig)
+{
+ if ( ppp_pid != 0 )
+ {
+ p(P_INFO,"received signal %d, passing it onto pppd (pid %d)\n",sig,ppp_pid);
+ kill(ppp_pid, sig);
+ }
+ else
+ {
+ p(P_INFO,"signal %d, but pppd pid not defined\n",ppp_pid);
+ }
}
>Release-Note:
>Audit-Trail:
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
To: Stephen Degler <sdegler@bauhaus.degler.net>,
hubert.feyrer@informatik.fh-regensburg.de
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: pkg/9946: fixes for mouse-ppoe pkg
Date: Thu, 20 Apr 2000 23:23:34 -0400 (EDT)
[Copies to Hubert Feyrer, who sent me a separate note on the subject,
and gnats-bugs, to record this response with the PR.]
> >Synopsis: bug fixes for packet length and added a signal handler
Thank you. I'll look these over and roll some form of them into my
pppoe source. Updating the package, though, I will have to leave to
someone who knows packages - whoever it was that turned the thing into
a package in the first place, perhaps.
> 1) The output buffer is 1500 bytes, but a raw ethernet frame
> is 1514 bytes
*blush* I get so used to thinking of "ethernet == MTU 1500" that I
tend to forget about the Ethernet header.
> 2) If the pppoe process it signaled, [...]
Hmm. Good point. Did you try just ignoring the signals in question,
letting pppd catch them due to process groups? 'Cause if that works,
it seems to me it'd be cleaner.
On the other hand, it should work to SIGTERM pppoe by PID.
Hmm. *Something* clearly needs to be done.
> 3) The current pppd requires a speed argument.
Requires?? Blech. And I imagine it won't accept 10000000 for the
speed argument? :-)
> 1) ping -s 1500 host.at.other.end.of.pppoe (see output packet
> overflow messages)
You shouldn't be seeing packet overflow messages; pppoe tells pppd to
set the PPP interface MTU to 1400 in order to avoid overflowing
Ethernet packets, or at least that's what my code does and it seems to
work for me. Whoever pkgized it must have in the process broken some
part of this, unless I sent off an old version in which that was
broken...but that's been there practically from the beginning, because
I was aware of the possible problem....
der Mouse
mouse@rodents.montreal.qc.ca
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
State-Changed-From-To: open->feedback
State-Changed-By: wiz
State-Changed-When: Thu Sep 14 15:52:30 PDT 2000
State-Changed-Why:
Der Mouse provided an updated package (version 20000912).
Could you please check that your problem is fixed?
Thanks,
Thomas
State-Changed-From-To: feedback->closed
State-Changed-By: wiz
State-Changed-When: Mon Feb 26 05:24:05 PST 2001
State-Changed-Why:
Feedback timeout. If the problem is still there, please send a new PR.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.