summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c
diff options
context:
space:
mode:
authorJames Carlson <james.d.carlson@sun.com>2009-05-29 08:53:34 -0400
committerJames Carlson <james.d.carlson@sun.com>2009-05-29 08:53:34 -0400
commitf53eecf557986dac6ededb388fedd6ca63be0350 (patch)
treefc7a51aa1700243330df3d0b104adb4d5a5097a1 /usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c
parent00ba712d889cedd6eb0c7de606f61b180572b600 (diff)
downloadillumos-joyent-f53eecf557986dac6ededb388fedd6ca63be0350.tar.gz
PSARC 2009/317 Solaris PPP/PPPoE Updates
4695172 3COM has its own incompatible dialect of PPPoE 4704518 security checks on chap peer name cause interoperability problems 4711045 pppd should not be discarding debug information on fatal signals 4711046 pppoec should provide a way to limit match against wildcard service 4714306 sppptun should not use M_ERROR to signal protocol problems 4743677 pppd can trigger latent access server bug 4750809 pppd needs lint cleanup 4947676 spppcomp_wput() allows an unprivileged process to "hang" the system. 5058886 PPPD misses first LCP configuration request 5060749 need a way to log demand-dial action at higher priority 5093264 PPPoE server can omit Service-Name tag in PADS response 6291911 ugly preremove script in SUNWpppdt causes messages on pkgrm from zone 6589814 pppd disavows bad echo-reply count 6636684 PPP should work in non-global exclusive-stack zones 6637245 sppp driver has half-baked _mi_driver_info function 6704096 SUNWpppdu and SUNWpppdr package dependency and content issues 6753945 sppptun doesn't honor clearview vanity naming feature.
Diffstat (limited to 'usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c')
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c67
1 files changed, 56 insertions, 11 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c b/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c
index a0d76768e5..d728fef890 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/pppd/sys-solaris.c
@@ -78,6 +78,7 @@
#include <sys/ethernet.h>
#include <sys/ser_sync.h>
#include <libdlpi.h>
+#include <arpa/inet.h>
#include "pppd.h"
#include "fsm.h"
@@ -1553,9 +1554,12 @@ dump_packet(uchar_t *buf, int len)
char sbuf[32];
uint32_t src, dst;
struct protoent *pep;
+ struct in6_addr addr;
+ char fromstr[INET6_ADDRSTRLEN];
+ char tostr[INET6_ADDRSTRLEN];
if (len < 4) {
- dbglog("strange link activity: %.*B", len, buf);
+ notice("strange link activity: %.*B", len, buf);
return;
}
bp = buf;
@@ -1565,9 +1569,10 @@ dump_packet(uchar_t *buf, int len)
if (!(proto & 1))
proto = (proto << 8) + *bp++;
len -= bp-buf;
- if (proto == PPP_IP) {
- if (len < 20 || get_ipv(bp) != 4 || get_iphl(bp) < 5) {
- dbglog("strange IP packet activity: %16.*B", len, buf);
+ switch (proto) {
+ case PPP_IP:
+ if (len < IP_HDRLEN || get_ipv(bp) != 4 || get_iphl(bp) < 5) {
+ notice("strange IP packet activity: %16.*B", len, buf);
return;
}
src = get_ipsrc(bp);
@@ -1583,7 +1588,7 @@ dump_packet(uchar_t *buf, int len)
if ((get_ipoff(bp) & IP_OFFMASK) != 0) {
len -= get_iphl(bp) * 4;
bp += get_iphl(bp) * 4;
- dbglog("%s fragment from %I->%I: %8.*B", cp, src, dst,
+ notice("%s fragment from %I->%I: %8.*B", cp, src, dst,
len, bp);
} else {
if (len > get_iplen(bp))
@@ -1592,20 +1597,60 @@ dump_packet(uchar_t *buf, int len)
bp += get_iphl(bp) * 4;
offs = proto == IPPROTO_TCP ? (get_tcpoff(bp)*4) : 8;
if (proto == IPPROTO_TCP || proto == IPPROTO_UDP)
- dbglog("%s data:%d %I:%d->%I:%d: %8.*B", cp,
- len-offs, src, get_sport(bp), dst,
- get_dport(bp), len-offs, bp+offs);
+ notice("%s data:%d %s%I:%d->%I:%d: %8.*B", cp,
+ len-offs,
+ proto == IPPROTO_TCP ?
+ tcp_flag_decode(get_tcpflags(bp)) : "",
+ src, get_sport(bp), dst, get_dport(bp),
+ len-offs, bp+offs);
else
- dbglog("%s %d bytes %I->%I: %8.*B", cp, len,
+ notice("%s %d bytes %I->%I: %8.*B", cp, len,
src, dst, len, bp);
}
return;
+
+ case PPP_IPV6:
+ if (len < IP6_HDRLEN) {
+ notice("strange IPv6 activity: %16.*B", len, buf);
+ return;
+ }
+ (void) BCOPY(get_ip6src(bp), &addr, sizeof (addr));
+ (void) inet_ntop(AF_INET6, &addr, fromstr, sizeof (fromstr));
+ (void) BCOPY(get_ip6dst(bp), &addr, sizeof (addr));
+ (void) inet_ntop(AF_INET6, &addr, tostr, sizeof (tostr));
+ proto = get_ip6nh(bp);
+ if (proto == IPPROTO_FRAGMENT) {
+ notice("IPv6 fragment from %s->%s", fromstr,
+ tostr);
+ return;
+ }
+ if ((pep = getprotobynumber(proto)) != NULL) {
+ cp = pep->p_name;
+ } else {
+ (void) slprintf(sbuf, sizeof (sbuf), "IPv6 proto %d",
+ proto);
+ cp = sbuf;
+ }
+ len -= IP6_HDRLEN;
+ bp += IP6_HDRLEN;
+ offs = proto == IPPROTO_TCP ? (get_tcpoff(bp)*4) : 8;
+ if (proto == IPPROTO_TCP || proto == IPPROTO_UDP)
+ notice("%s data:%d %s[%s]%d->[%s]%d: %8.*B", cp,
+ len-offs,
+ proto == IPPROTO_TCP ?
+ tcp_flag_decode(get_tcpflags(bp)) : "",
+ fromstr, get_sport(bp), tostr, get_dport(bp),
+ len-offs, bp+offs);
+ else
+ notice("%s %d bytes %s->%s: %8.*B", cp, len,
+ fromstr, tostr, len, bp);
+ return;
}
if ((cp = protocol_name(proto)) == NULL) {
(void) slprintf(sbuf, sizeof (sbuf), "0x#X", proto);
cp = (const char *)sbuf;
}
- dbglog("link activity: %s %16.*B", cp, len, bp);
+ notice("link activity: %s %16.*B", cp, len, bp);
}
/*
@@ -1785,7 +1830,7 @@ read_packet(buf)
lcp_lowerup(0);
return (0);
case PPP_LINKSTAT_NEEDUP:
- if (data.len > 0 && debug)
+ if (data.len > 0)
dump_packet(buf, data.len);
return (-1); /* Demand dial */
case PPP_LINKSTAT_IPV4_UNBOUND: