Code review request

2008-08-24 Thread M. Warner Losh
I've been shepherding this patch in my p4 tree for a long time.  It
removes the obsolete support for other systems in if_spppsubr.c.  Is
there a reason I shouldn't commit this?

Warner
Index: if_spppsubr.c
===
--- if_spppsubr.c   (revision 182085)
+++ if_spppsubr.c   (working copy)
@@ -23,38 +23,22 @@
 
 #include sys/param.h
 
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
 #include opt_inet.h
 #include opt_inet6.h
 #include opt_ipx.h
-#endif
 
-#ifdef NetBSD1_3
-#  if NetBSD1_3  6
-#  include opt_inet.h
-#  include opt_inet6.h
-#  include opt_iso.h
-#  endif
-#endif
-
 #include sys/systm.h
 #include sys/kernel.h
 #include sys/module.h
 #include sys/sockio.h
 #include sys/socket.h
 #include sys/syslog.h
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
 #include sys/random.h
-#endif
 #include sys/malloc.h
 #include sys/mbuf.h
 #include sys/vimage.h
 
-#if defined (__OpenBSD__)
-#include sys/md5k.h
-#else
 #include sys/md5.h
-#endif
 
 #include net/if.h
 #include net/netisr.h
@@ -65,10 +49,6 @@
 #include netinet/ip.h
 #include net/slcompress.h
 
-#if defined (__NetBSD__) || defined (__OpenBSD__)
-#include machine/cpu.h /* XXX for softnet */
-#endif
-
 #include machine/stdarg.h
 
 #include netinet/in_var.h
@@ -82,11 +62,7 @@
 #include netinet6/scope6_var.h
 #endif
 
-#if defined (__FreeBSD__) || defined (__OpenBSD__)
-# include netinet/if_ether.h
-#else
-# include net/ethertypes.h
-#endif
+#include netinet/if_ether.h
 
 #ifdef IPX
 #include netipx/ipx.h
@@ -95,12 +71,7 @@
 
 #include net/if_sppp.h
 
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
-# define IOCTL_CMD_T   u_long
-#else
-# define IOCTL_CMD_T   int
-#endif
-
+#define IOCTL_CMD_Tu_long
 #define MAXALIVECNT 3   /* max. alive packets */
 
 /*
@@ -261,13 +232,8 @@
void(*scr)(struct sppp *sp);
 };
 
-#if defined(__FreeBSD__)  __FreeBSD__ = 3  __FreeBSD_version  501113
-#defineSPP_FMT %s%d: 
-#defineSPP_ARGS(ifp)   (ifp)-if_name, (ifp)-if_unit
-#else
 #defineSPP_FMT %s: 
 #defineSPP_ARGS(ifp)   (ifp)-if_xname
-#endif
 
 #define SPPP_LOCK(sp) \
do { \
@@ -1422,11 +1388,7 @@
++sp-pp_loopcnt;
 
/* Generate new local sequence number */
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
sp-pp_seq[IDX_LCP] = random();
-#else
-   sp-pp_seq[IDX_LCP] ^= time.tv_sec ^ time.tv_usec;
-#endif
break;
}
sp-pp_loopcnt = 0;
@@ -2671,11 +2633,7 @@
if (magic == ~sp-lcp.magic) {
if (debug)
log(-1, magic glitch );
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
sp-lcp.magic = random();
-#else
-   sp-lcp.magic = time.tv_sec + 
time.tv_usec;
-#endif
} else {
sp-lcp.magic = magic;
if (debug)
@@ -2856,11 +2814,7 @@
 
if (sp-lcp.opts  (1  LCP_OPT_MAGIC)) {
if (! sp-lcp.magic)
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
sp-lcp.magic = random();
-#else
-   sp-lcp.magic = time.tv_sec + time.tv_usec;
-#endif
opt[i++] = LCP_OPT_MAGIC;
opt[i++] = 6;
opt[i++] = sp-lcp.magic  24;
@@ -4383,15 +4337,7 @@
 
/* Compute random challenge. */
ch = (u_long *)sp-myauth.challenge;
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
read_random(seed, sizeof seed);
-#else
-   {
-   struct timeval tv;
-   microtime(tv);
-   seed = tv.tv_sec ^ tv.tv_usec;
-   }
-#endif
ch[0] = seed ^ random();
ch[1] = seed ^ random();
ch[2] = seed ^ random();
@@ -4900,17 +4846,7 @@
 * aliases don't make any sense on a p2p link anyway.
 */
si = 0;
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link)
-#elif defined(__NetBSD__) || defined (__OpenBSD__)
-   for (ifa = TAILQ_FIRST(ifp-if_addrlist);
-ifa;
-ifa = TAILQ_NEXT(ifa, ifa_list))
-#else
-   for (ifa = ifp-if_addrlist;
-ifa;
-ifa = ifa-ifa_next)
-#endif
if (ifa-ifa_addr-sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa-ifa_addr;
sm = (struct sockaddr_in *)ifa-ifa_netmask;
@@ -4949,17 +4885,7 @@
 * aliases don't make any sense on a p2p link anyway.
 */
si = 0;
-#if defined(__FreeBSD__)  __FreeBSD__ = 3
TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link)
-#elif defined(__NetBSD__) || defined (__OpenBSD__)
-   for (ifa = TAILQ_FIRST(ifp-if_addrlist);
-ifa;
-

Re: Code review request

2008-08-24 Thread Bruce M. Simpson

M. Warner Losh wrote:

I've been shepherding this patch in my p4 tree for a long time.  It
removes the obsolete support for other systems in if_spppsubr.c.  Is
there a reason I shouldn't commit this?
  


Looks fine to me.
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Code review request

2008-08-24 Thread Roman Kurakin

M. Warner Losh wrote:

I've been shepherding this patch in my p4 tree for a long time.  It
removes the obsolete support for other systems in if_spppsubr.c.  Is
there a reason I shouldn't commit this?
  

It was there to ease the keeping code in sync with other systems.
Please ask Joerg Wunsch before removal.

rik

Warner
  



___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to [EMAIL PROTECTED]


___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Code review request

2008-08-24 Thread M. Warner Losh
In message: [EMAIL PROTECTED]
Roman Kurakin [EMAIL PROTECTED] writes:
: M. Warner Losh wrote:
:  I've been shepherding this patch in my p4 tree for a long time.  It
:  removes the obsolete support for other systems in if_spppsubr.c.  Is
:  there a reason I shouldn't commit this?
:
: It was there to ease the keeping code in sync with other systems.
: Please ask Joerg Wunsch before removal.

Yea, I knew that history.  But there's been a lot of hacking on this
file, and the ifdef's are for other systems that were contemporaneous
with FreeBSD 3.0, but nothing newer.  Plus the FreeBSDisms that are
newer haven't been ifdef'd.

Warner
___
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to [EMAIL PROTECTED]