From f0218cabd1d4093af43af5cf1f1b2e05344db7a7 Mon Sep 17 00:00:00 2001 From: Can Erkin Acar Date: Fri, 12 Aug 2005 21:29:11 +0000 Subject: Use actual packet contents when sending protocol rejects. Fixes PR 4305. Different fix tested by the submitter, xiangbo3 at gmail com. ok claudio@ --- sys/net/if_spppsubr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/net/if_spppsubr.c') diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 62437471ab5..774f94f4a89 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.35 2005/08/03 21:50:21 canacar Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.36 2005/08/12 21:29:10 canacar Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. * Keepalive protocol implemented in both Cisco and PPP modes. @@ -458,6 +458,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) struct ifqueue *inq = 0; struct sppp *sp = (struct sppp *)ifp; struct timeval tv; + void *prej; int debug = ifp->if_flags & IFF_DEBUG; int s; @@ -483,7 +484,8 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) } if (sp->pp_flags & PP_NOFRAMING) { - memcpy(&ht.protocol, mtod(m, void *), 2); + prej = mtod(m, void *); + memcpy(&ht.protocol, prej, sizeof(ht.protocol)); m_adj(m, 2); ht.control = PPP_UI; ht.address = PPP_ALLSTATIONS; @@ -491,6 +493,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) } else { /* Get PPP header. */ h = mtod (m, struct ppp_header*); + prej = &h->protocol; m_adj (m, PPP_HEADER_LEN); } @@ -511,8 +514,7 @@ sppp_input(struct ifnet *ifp, struct mbuf *m) default: if (sp->state[IDX_LCP] == STATE_OPENED) sppp_cp_send (sp, PPP_LCP, PROTO_REJ, - ++sp->pp_seq, m->m_pkthdr.len + 2, - &h->protocol); + ++sp->pp_seq, m->m_pkthdr.len + 2, prej); if (debug) log(LOG_DEBUG, SPP_FMT "invalid input protocol " -- cgit v1.2.3