Remove all the OtherBSD ifdefs.  They are very out of date at this
point.  OtherBSD doesn't use this file verbatim, and they don't have
FreeBSD ifdefs in their code.

Reviewed by:	bms@, joerg@
This commit is contained in:
Warner Losh 2008-08-24 20:40:00 +00:00
parent e451733718
commit de8bfff6c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182121

View File

@ -23,19 +23,9 @@
#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>
@ -43,18 +33,12 @@
#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_T u_long
#define MAXALIVECNT 3 /* max. alive packets */
/*
@ -261,13 +232,8 @@ struct cp {
void (*scr)(struct sppp *sp);
};
#if defined(__FreeBSD__) && __FreeBSD__ >= 3 && __FreeBSD_version < 501113
#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
#define SPPP_LOCK(sp) \
do { \
@ -1422,11 +1388,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m)
++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 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
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 @@ sppp_lcp_scr(struct sppp *sp)
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 @@ sppp_chap_scr(struct sppp *sp)
/* 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 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
* 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 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
* 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)
{
@ -4972,17 +4898,6 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
if (ifa && si)
{
int error;
#if defined(__NetBSD__) && __NetBSD_Version__ >= 103080000
struct sockaddr_in new_sin = *si;
new_sin.sin_addr.s_addr = htonl(src);
error = in_ifinit(ifp, ifatoia(ifa), &new_sin, 1);
if(debug && error)
{
log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: in_ifinit "
" failed, error=%d\n", SPP_ARGS(ifp), error);
}
#else
/* delete old route */
error = rtinit(ifa, (int)RTM_DELETE, RTF_HOST);
if(debug && error)
@ -5004,7 +4919,6 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit ADD failed, error=%d",
SPP_ARGS(ifp), error);
}
#endif
}
}
@ -5029,17 +4943,7 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
* 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 = ifp->if_addrlist.tqh_first;
ifa;
ifa = ifa->ifa_list.tqe_next)
#else
for (ifa = ifp->if_addrlist;
ifa;
ifa = ifa->ifa_next)
#endif
if (ifa->ifa_addr->sa_family == AF_INET6) {
si = (struct sockaddr_in6 *)ifa->ifa_addr;
sm = (struct sockaddr_in6 *)ifa->ifa_netmask;
@ -5092,15 +4996,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)
*/
sin6 = NULL;
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link)
#elif defined(__NetBSD__) || defined (__OpenBSD__)
for (ifa = ifp->if_addrlist.tqh_first;
ifa;
ifa = ifa->ifa_list.tqe_next)
#else
for (ifa = ifp->if_addrlist; ifa; ifa = ifa->ifa_next)
#endif
{
if (ifa->ifa_addr->sa_family == AF_INET6)
{