Source-Changes-HG archive

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

[src/trunk]: src/sys/net remove #ifdef __FreeBSD__ (code already diverged eno...



details:   https://anonhg.NetBSD.org/src/rev/b9cfd8cd2ca1
branches:  trunk
changeset: 547190:b9cfd8cd2ca1
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed May 14 22:41:40 2003 +0000

description:
remove #ifdef __FreeBSD__ (code already diverged enough)

diffstat:

 sys/net/if_spppsubr.c |  410 ++++++++++++++++++++++++-------------------------
 1 files changed, 201 insertions(+), 209 deletions(-)

diffs (truncated from 1150 to 300 lines):

diff -r 11f8e4bf1648 -r b9cfd8cd2ca1 sys/net/if_spppsubr.c
--- a/sys/net/if_spppsubr.c     Wed May 14 22:11:42 2003 +0000
+++ b/sys/net/if_spppsubr.c     Wed May 14 22:41:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_spppsubr.c,v 1.63 2003/01/28 15:36:38 tron Exp $     */
+/*     $NetBSD: if_spppsubr.c,v 1.64 2003/05/14 22:41:40 itojun Exp $   */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.63 2003/01/28 15:36:38 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.64 2003/05/14 22:41:40 itojun Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipx.h"
@@ -245,14 +245,6 @@
 static struct sppp *spppq;
 static struct callout keepalive_ch;
 
-#ifdef __FreeBSD__
-#define        SPP_FMT         "%s%d: "
-#define        SPP_ARGS(ifp)   (ifp)->if_name, (ifp)->if_unit
-#else
-#define        SPP_FMT         "%s: "
-#define        SPP_ARGS(ifp)   (ifp)->if_xname
-#endif
-
 #ifdef INET
 /*
  * The following disgusting hack gets around the problem that IP TOS
@@ -482,8 +474,8 @@
                /* Too small packet, drop it. */
                if (debug)
                        log(LOG_DEBUG,
-                           SPP_FMT "input packet is too small, %d bytes\n",
-                           SPP_ARGS(ifp), m->m_pkthdr.len);
+                           "%s: input packet is too small, %d bytes\n",
+                           ifp->if_xname, m->m_pkthdr.len);
          drop:
                ++ifp->if_ierrors;
                ++ifp->if_iqdrops;
@@ -508,9 +500,9 @@
                        if (sp->pp_flags & PP_CISCO) {
                                if (debug)
                                        log(LOG_DEBUG,
-                                           SPP_FMT "PPP packet in Cisco mode "
+                                           "%s: PPP packet in Cisco mode "
                                            "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
-                                           SPP_ARGS(ifp),
+                                           ifp->if_xname,
                                            h->address, h->control, ntohs(h->protocol));
                                goto drop;
                        }
@@ -521,9 +513,9 @@
                        if (! (sp->pp_flags & PP_CISCO)) {
                                if (debug)
                                        log(LOG_DEBUG,
-                                           SPP_FMT "Cisco packet in PPP mode "
+                                           "%s: Cisco packet in PPP mode "
                                            "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
-                                           SPP_ARGS(ifp),
+                                           ifp->if_xname,
                                            h->address, h->control, ntohs(h->protocol));
                                goto drop;
                        }
@@ -565,9 +557,9 @@
                  invalid:
                        if (debug)
                                log(LOG_DEBUG,
-                                   SPP_FMT "invalid input packet "
+                                   "%s: invalid input packet "
                                    "<addr=0x%x ctrl=0x%x proto=0x%x>\n",
-                                   SPP_ARGS(ifp),
+                                   ifp->if_xname,
                                    h->address, h->control, ntohs(h->protocol));
                        goto drop;
                }
@@ -584,8 +576,8 @@
                }
                if (debug)
                        log(LOG_DEBUG,
-                           SPP_FMT "invalid input protocol "
-                           "<proto=0x%x>\n", SPP_ARGS(ifp), ntohs(protocol));
+                           "%s: invalid input protocol "
+                           "<proto=0x%x>\n", ifp->if_xname, ntohs(protocol));
                ++ifp->if_noproto;
                goto drop;
        case PPP_LCP:
@@ -671,8 +663,8 @@
                IF_DROP(inq);
                splx(s);
                if (debug)
-                       log(LOG_DEBUG, SPP_FMT "protocol queue overflow\n",
-                               SPP_ARGS(ifp));
+                       log(LOG_DEBUG, "%s: protocol queue overflow\n",
+                               ifp->if_xname);
                goto drop;
        }
        IF_ENQUEUE(inq, m);
@@ -784,8 +776,8 @@
                M_PREPEND(m, PPP_HEADER_LEN, M_DONTWAIT);
                if (! m) {
                        if (ifp->if_flags & IFF_DEBUG)
-                               log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
-                                       SPP_ARGS(ifp));
+                               log(LOG_DEBUG, "%s: no memory for transmit header\n",
+                                       ifp->if_xname);
                        ++ifp->if_oerrors;
                        splx(s);
                        return (ENOBUFS);
@@ -876,8 +868,8 @@
                M_PREPEND(m, 2, M_DONTWAIT);
                if (m == NULL) {
                        if (ifp->if_flags & IFF_DEBUG)
-                               log(LOG_DEBUG, SPP_FMT "no memory for transmit header\n",
-                                       SPP_ARGS(ifp));
+                               log(LOG_DEBUG, "%s: no memory for transmit header\n",
+                                       ifp->if_xname);
                        ++ifp->if_oerrors;
                        splx(s);
                        return (ENOBUFS);
@@ -1210,23 +1202,23 @@
        if (m->m_pkthdr.len < CISCO_PACKET_LEN) {
                if (debug)
                        log(LOG_DEBUG,
-                           SPP_FMT "cisco invalid packet length: %d bytes\n",
-                           SPP_ARGS(ifp), m->m_pkthdr.len);
+                           "%s: cisco invalid packet length: %d bytes\n",
+                           ifp->if_xname, m->m_pkthdr.len);
                return;
        }
        h = mtod(m, struct cisco_packet *);
        if (debug)
                log(LOG_DEBUG,
-                   SPP_FMT "cisco input: %d bytes "
+                   "%s: cisco input: %d bytes "
                    "<0x%x 0x%x 0x%x 0x%x 0x%x-0x%x>\n",
-                   SPP_ARGS(ifp), m->m_pkthdr.len,
+                   ifp->if_xname, m->m_pkthdr.len,
                    ntohl (h->type), h->par1, h->par2, (u_int)h->rel,
                    (u_int)h->time0, (u_int)h->time1);
        switch (ntohl (h->type)) {
        default:
                if (debug)
-                       addlog(SPP_FMT "cisco unknown packet type: 0x%x\n",
-                              SPP_ARGS(ifp), ntohl (h->type));
+                       addlog("%s: cisco unknown packet type: 0x%x\n",
+                              ifp->if_xname, ntohl (h->type));
                break;
        case CISCO_ADDR_REPLY:
                /* Reply on address request, ignore */
@@ -1238,8 +1230,8 @@
                        /* Local and remote sequence numbers are equal.
                         * Probably, the line is in loopback mode. */
                        if (sp->pp_loopcnt >= MAXALIVECNT) {
-                               printf (SPP_FMT "loopback\n",
-                                       SPP_ARGS(ifp));
+                               printf ("%s: loopback\n",
+                                       ifp->if_xname);
                                sp->pp_loopcnt = 0;
                                if (ifp->if_flags & IFF_UP) {
                                        if_down(ifp);
@@ -1300,8 +1292,8 @@
 
        if (debug)
                log(LOG_DEBUG,
-                   SPP_FMT "cisco output: <0x%x 0x%x 0x%x 0x%x 0x%x-0x%x>\n",
-                       SPP_ARGS(ifp), ntohl (ch->type), ch->par1,
+                   "%s: cisco output: <0x%x 0x%x 0x%x 0x%x 0x%x-0x%x>\n",
+                       ifp->if_xname, ntohl (ch->type), ch->par1,
                        ch->par2, (u_int)ch->rel, (u_int)ch->time0,
                        (u_int)ch->time1);
 
@@ -1362,8 +1354,8 @@
                bcopy (data, lh + 1, len);
 
        if (debug) {
-               log(LOG_DEBUG, SPP_FMT "%s output <%s id=0x%x len=%d",
-                   SPP_ARGS(ifp),
+               log(LOG_DEBUG, "%s: %s output <%s id=0x%x len=%d",
+                   ifp->if_xname,
                    sppp_proto_name(proto),
                    sppp_cp_type_name(lh->type), lh->ident, ntohs(lh->len));
                if (len)
@@ -1399,15 +1391,15 @@
        if (len < 4) {
                if (debug)
                        log(LOG_DEBUG,
-                           SPP_FMT "%s invalid packet length: %d bytes\n",
-                           SPP_ARGS(ifp), cp->name, len);
+                           "%s: %s invalid packet length: %d bytes\n",
+                           ifp->if_xname, cp->name, len);
                return;
        }
        h = mtod(m, struct lcp_header *);
        if (debug) {
                log(LOG_DEBUG,
-                   SPP_FMT "%s input(%s): <%s id=0x%x len=%d",
-                   SPP_ARGS(ifp), cp->name,
+                   "%s: %s input(%s): <%s id=0x%x len=%d",
+                   ifp->if_xname, cp->name,
                    sppp_state_name(sp->state[cp->protoidx]),
                    sppp_cp_type_name(h->type), h->ident, ntohs(h->len));
                if (len > 4)
@@ -1421,8 +1413,8 @@
        case CONF_REQ:
                if (len < 4) {
                        if (debug)
-                               addlog(SPP_FMT "%s invalid conf-req length %d\n",
-                                      SPP_ARGS(ifp), cp->name,
+                               addlog("%s: %s invalid conf-req length %d\n",
+                                      ifp->if_xname, cp->name,
                                       len);
                        ++ifp->if_ierrors;
                        break;
@@ -1458,16 +1450,16 @@
                        if (rv) {
                                sppp_cp_change_state(cp, sp, STATE_OPENED);
                                if (debug)
-                                       log(LOG_DEBUG, SPP_FMT "%s tlu\n",
-                                           SPP_ARGS(ifp),
+                                       log(LOG_DEBUG, "%s: %s tlu\n",
+                                           ifp->if_xname,
                                            cp->name);
                                (cp->tlu)(sp);
                        } else
                                sppp_cp_change_state(cp, sp, STATE_ACK_RCVD);
                        break;
                default:
-                       printf(SPP_FMT "%s illegal %s in state %s\n",
-                              SPP_ARGS(ifp), cp->name,
+                       printf("%s: %s illegal %s in state %s\n",
+                              ifp->if_xname, cp->name,
                               sppp_cp_type_name(h->type),
                               sppp_state_name(sp->state[cp->protoidx]));
                        ++ifp->if_ierrors;
@@ -1476,8 +1468,8 @@
        case CONF_ACK:
                if (h->ident != sp->confid[cp->protoidx]) {
                        if (debug)
-                               addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n",
-                                      SPP_ARGS(ifp), cp->name,
+                               addlog("%s: %s id mismatch 0x%x != 0x%x\n",
+                                      ifp->if_xname, cp->name,
                                       h->ident, sp->confid[cp->protoidx]);
                        ++ifp->if_ierrors;
                        break;
@@ -1505,13 +1497,13 @@
                        sp->rst_counter[cp->protoidx] = sp->lcp.max_configure;
                        sppp_cp_change_state(cp, sp, STATE_OPENED);
                        if (debug)
-                               log(LOG_DEBUG, SPP_FMT "%s tlu\n",
-                                      SPP_ARGS(ifp), cp->name);
+                               log(LOG_DEBUG, "%s: %s tlu\n",
+                                      ifp->if_xname, cp->name);
                        (cp->tlu)(sp);
                        break;
                default:
-                       printf(SPP_FMT "%s illegal %s in state %s\n",
-                              SPP_ARGS(ifp), cp->name,
+                       printf("%s: %s illegal %s in state %s\n",
+                              ifp->if_xname, cp->name,
                               sppp_cp_type_name(h->type),
                               sppp_state_name(sp->state[cp->protoidx]));
                        ++ifp->if_ierrors;
@@ -1521,8 +1513,8 @@
        case CONF_REJ:
                if (h->ident != sp->confid[cp->protoidx]) {
                        if (debug)
-                               addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n",
-                                      SPP_ARGS(ifp), cp->name,
+                               addlog("%s: %s id mismatch 0x%x != 0x%x\n",
+                                      ifp->if_xname, cp->name,
                                       h->ident, sp->confid[cp->protoidx]);
                        ++ifp->if_ierrors;
                        break;
@@ -1553,8 +1545,8 @@
                case STATE_STOPPING:
                        break;
                default:
-                       printf(SPP_FMT "%s illegal %s in state %s\n",
-                              SPP_ARGS(ifp), cp->name,
+                       printf("%s: %s illegal %s in state %s\n",
+                              ifp->if_xname, cp->name,
                               sppp_cp_type_name(h->type),
                               sppp_state_name(sp->state[cp->protoidx]));
                        ++ifp->if_ierrors;
@@ -1575,8 +1567,8 @@
                  sta:
                        /* Send Terminate-Ack packet. */
                        if (debug)
-                               log(LOG_DEBUG, SPP_FMT "%s send terminate-ack\n",
-                                   SPP_ARGS(ifp), cp->name);
+                               log(LOG_DEBUG, "%s: %s send terminate-ack\n",
+                                   ifp->if_xname, cp->name);
                        sppp_cp_send(sp, cp->proto, TERM_ACK, h->ident, 0, 0);
                        break;



Home | Main Index | Thread Index | Old Index