Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net avoid unneeded call to m_pullup



details:   https://anonhg.NetBSD.org/src/rev/d0bb1c855d71
branches:  trunk
changeset: 533135:d0bb1c855d71
user:      itojun <itojun%NetBSD.org@localhost>
date:      Sat Jun 22 11:46:16 2002 +0000

description:
avoid unneeded call to m_pullup

diffstat:

 sys/net/if_pppoe.c |  18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r ffe697a590e1 -r d0bb1c855d71 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Sat Jun 22 11:37:48 2002 +0000
+++ b/sys/net/if_pppoe.c        Sat Jun 22 11:46:16 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.29 2002/06/22 11:37:48 itojun Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.30 2002/06/22 11:46:16 itojun Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.29 2002/06/22 11:37:48 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.30 2002/06/22 11:46:16 itojun Exp $");
 
 #include "pppoe.h"
 #include "bpfilter.h"
@@ -528,7 +528,7 @@
                sc->sc_state = PPPOE_STATE_PADR_SENT;
                if (pppoe_send_padr(sc) == 0) 
                        callout_reset(&sc->sc_timeout,
-                           PPPOE_DISC_TIMEOUT*(1+sc->sc_padr_retried),
+                           PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried),
                            pppoe_timeout, sc);
                else
                        pppoe_abort_connect(sc);
@@ -604,10 +604,12 @@
                goto drop;
        }
 
-       m = m_pullup(m, sizeof(*ph));
-       if (!m) {
-               printf("pppoe: could not get PPPoE header\n");
-               return;
+       if (m->m_len < sizeof(*ph)) {
+               m = m_pullup(m, sizeof(*ph));
+               if (!m) {
+                       printf("pppoe: could not get PPPoE header\n");
+                       return;
+               }
        }
        ph = mtod(m, struct pppoehdr *);
 
@@ -892,7 +894,7 @@
                 */
 
                /* initialize for quick retry mode */
-               retry_wait = PPPOE_DISC_TIMEOUT*(1+sc->sc_padi_retried);
+               retry_wait = PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried);
 
                x = splnet();
                sc->sc_padi_retried++;



Home | Main Index | Thread Index | Old Index