MFH @ 186335

This commit is contained in:
Sam Leffler 2008-12-20 01:29:19 +00:00
commit 41fe50f5de
412 changed files with 15296 additions and 6286 deletions

View File

@ -22,6 +22,23 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8.x IS SLOW:
to maximize performance. (To disable malloc debugging, run to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.) ln -s aj /etc/malloc.conf.)
20081219:
With __FreeBSD_version 800060 the makefs tool is part of
the base system (it was a port).
20081216:
The afdata and ifnet locks have been changed from mutexes to
rwlocks, network modules will need to be re-compiled.
20081214:
__FreeBSD_version 800059 incorporates the new arp-v2 rewrite.
RTF_CLONING, RTF_LLINFO and RTF_WASCLONED flags are eliminated.
The new code reduced struct rtentry{} by 16 bytes on 32-bit
architecture and 40 bytes on 64-bit architecture. The userland
applications "arp" and "ndp" have been updated accordingly.
The output from "netstat -r" shows only routing entries and
none of the L2 information.
20081130: 20081130:
__FreeBSD_version 800057 marks the switchover from the __FreeBSD_version 800057 marks the switchover from the
binary ath hal to source code. Users must add the line: binary ath hal to source code. Users must add the line:

View File

@ -48,8 +48,7 @@ static void *route_fd;
/* if-index allocator */ /* if-index allocator */
static uint32_t next_if_index = 1; static uint32_t next_if_index = 1;
/* re-fetch arp table */ /* currently fetching the arp table */
static int update_arp;
static int in_update_arp; static int in_update_arp;
/* OR registrations */ /* OR registrations */
@ -910,36 +909,6 @@ mib_find_ifa(struct in_addr addr)
return (NULL); return (NULL);
} }
/*
* Process a new ARP entry
*/
static void
process_arp(const struct rt_msghdr *rtm, const struct sockaddr_dl *sdl,
const struct sockaddr_in *sa)
{
struct mibif *ifp;
struct mibarp *at;
/* IP arp table entry */
if (sdl->sdl_alen == 0) {
update_arp = 1;
return;
}
if ((ifp = mib_find_if_sys(sdl->sdl_index)) == NULL)
return;
/* have a valid entry */
if ((at = mib_find_arp(ifp, sa->sin_addr)) == NULL &&
(at = mib_arp_create(ifp, sa->sin_addr,
sdl->sdl_data + sdl->sdl_nlen, sdl->sdl_alen)) == NULL)
return;
if (rtm->rtm_rmx.rmx_expire == 0)
at->flags |= MIBARP_PERM;
else
at->flags &= ~MIBARP_PERM;
at->flags |= MIBARP_FOUND;
}
/* /*
* Handle a routing socket message. * Handle a routing socket message.
*/ */
@ -1080,46 +1049,12 @@ handle_rtmsg(struct rt_msghdr *rtm)
} }
break; break;
#endif #endif
case RTM_GET: case RTM_GET:
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
if (rtm->rtm_flags & RTF_LLINFO) {
if (addrs[RTAX_DST] == NULL ||
addrs[RTAX_GATEWAY] == NULL ||
addrs[RTAX_DST]->sa_family != AF_INET ||
addrs[RTAX_GATEWAY]->sa_family != AF_LINK)
break;
process_arp(rtm,
(struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY],
(struct sockaddr_in *)(void *)addrs[RTAX_DST]);
} else {
if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP))
mib_sroute_process(rtm, addrs[RTAX_GATEWAY],
addrs[RTAX_DST], addrs[RTAX_NETMASK]);
}
break;
case RTM_ADD: case RTM_ADD:
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
if (rtm->rtm_flags & RTF_LLINFO) {
if (addrs[RTAX_DST] == NULL ||
addrs[RTAX_GATEWAY] == NULL ||
addrs[RTAX_DST]->sa_family != AF_INET ||
addrs[RTAX_GATEWAY]->sa_family != AF_LINK)
break;
process_arp(rtm,
(struct sockaddr_dl *)(void *)addrs[RTAX_GATEWAY],
(struct sockaddr_in *)(void *)addrs[RTAX_DST]);
} else {
if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP))
mib_sroute_process(rtm, addrs[RTAX_GATEWAY],
addrs[RTAX_DST], addrs[RTAX_NETMASK]);
}
break;
case RTM_DELETE: case RTM_DELETE:
mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs); mib_extract_addrs(rtm->rtm_addrs, (u_char *)(rtm + 1), addrs);
if (rtm->rtm_errno == 0 && !(rtm->rtm_flags & RTF_LLINFO))
if (rtm->rtm_errno == 0 && (rtm->rtm_flags & RTF_UP))
mib_sroute_process(rtm, addrs[RTAX_GATEWAY], mib_sroute_process(rtm, addrs[RTAX_GATEWAY],
addrs[RTAX_DST], addrs[RTAX_NETMASK]); addrs[RTAX_DST], addrs[RTAX_NETMASK]);
break; break;
@ -1289,7 +1224,8 @@ update_ifa_info(void)
/* /*
* Update arp table * Update arp table
*/ *
*/
void void
mib_arp_update(void) mib_arp_update(void)
{ {
@ -1305,11 +1241,11 @@ mib_arp_update(void)
TAILQ_FOREACH(at, &mibarp_list, link) TAILQ_FOREACH(at, &mibarp_list, link)
at->flags &= ~MIBARP_FOUND; at->flags &= ~MIBARP_FOUND;
if ((buf = mib_fetch_rtab(AF_INET, NET_RT_FLAGS, RTF_LLINFO, &needed)) == NULL) { if ((buf = mib_fetch_rtab(AF_INET, NET_RT_FLAGS, 0, &needed)) == NULL) {
in_update_arp = 0; in_update_arp = 0;
return; return;
} }
next = buf; next = buf;
while (next < buf + needed) { while (next < buf + needed) {
rtm = (struct rt_msghdr *)(void *)next; rtm = (struct rt_msghdr *)(void *)next;
@ -1326,7 +1262,6 @@ mib_arp_update(void)
at = at1; at = at1;
} }
mibarpticks = get_ticks(); mibarpticks = get_ticks();
update_arp = 0;
in_update_arp = 0; in_update_arp = 0;
} }
@ -1634,8 +1569,8 @@ mibII_idle(void)
mib_arp_update(); mib_arp_update();
mib_iflist_bad = 0; mib_iflist_bad = 0;
} }
if (update_arp)
mib_arp_update(); mib_arp_update();
} }

View File

@ -186,8 +186,7 @@ mib_sroute_process(struct rt_msghdr *rtm, struct sockaddr *gw,
memcpy(r->index, key.index, sizeof(r->index)); memcpy(r->index, key.index, sizeof(r->index));
r->ifindex = (ifp == NULL) ? 0 : ifp->index; r->ifindex = (ifp == NULL) ? 0 : ifp->index;
r->type = (rtm->rtm_flags & RTF_LLINFO) ? 3 : r->type = (rtm->rtm_flags & RTF_REJECT) ? 2 : 4;
(rtm->rtm_flags & RTF_REJECT) ? 2 : 4;
/* cannot really know, what protocol it runs */ /* cannot really know, what protocol it runs */
r->proto = (rtm->rtm_flags & RTF_LOCAL) ? 2 : r->proto = (rtm->rtm_flags & RTF_LOCAL) ? 2 :

View File

@ -88,7 +88,12 @@ char *addr, *eaddr;
mib[2] = 0; mib[2] = 0;
mib[3] = AF_INET; mib[3] = AF_INET;
mib[4] = NET_RT_FLAGS; mib[4] = NET_RT_FLAGS;
#ifdef RTF_LLINFO
mib[5] = RTF_LLINFO; mib[5] = RTF_LLINFO;
#else
mib[5] = 0;
#endif
if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1) if (sysctl(mib, 6, NULL, &needed, NULL, 0) == -1)
{ {
perror("route-sysctl-estimate"); perror("route-sysctl-estimate");

View File

@ -1,7 +1,7 @@
# $FreeBSD$ # $FreeBSD$
Project: netcat (aka src/usr.bin/nc in OpenBSD) Project: netcat (aka src/usr.bin/nc in OpenBSD)
ProjectURL: http://www.openbsd.org/ ProjectURL: http://www.openbsd.org/
Version: 4.3 Version: 4.4
VendorTag: OPENBSD VendorTag: OPENBSD
VersionTag: OPENBSD_4_3 VersionTag: OPENBSD_4_4
License: BSD License: BSD

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: nc.1,v 1.45 2007/05/31 19:20:13 jmc Exp $ .\" $OpenBSD: nc.1,v 1.47 2008/05/06 16:21:03 jmc Exp $
.\" .\"
.\" Copyright (c) 1996 David Sacerdote .\" Copyright (c) 1996 David Sacerdote
.\" All rights reserved. .\" All rights reserved.
@ -27,7 +27,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd $Mdocdate$ .Dd $Mdocdate: May 6 2008 $
.Dt NC 1 .Dt NC 1
.Os .Os
.Sh NAME .Sh NAME
@ -36,9 +36,12 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm nc .Nm nc
.Bk -words .Bk -words
.Op Fl 46DdEhklnOorStUuvz .Op Fl 46DdEhklnorStUuvz
.Op Fl e Ar IPsec_policy .Op Fl e Ar IPsec_policy
.Op Fl I Ar length
.Op Fl i Ar interval .Op Fl i Ar interval
.Op Fl -no-tcpopt
.Op Fl O Ar length
.Op Fl P Ar proxy_username .Op Fl P Ar proxy_username
.Op Fl p Ar source_port .Op Fl p Ar source_port
.Op Fl s Ar source_ip_address .Op Fl s Ar source_ip_address
@ -118,6 +121,8 @@ each direction is needed.
Prints out Prints out
.Nm .Nm
help. help.
.It Fl I Ar length
Specifies the size of the TCP receive buffer.
.It Fl i Ar interval .It Fl i Ar interval
Specifies a delay time interval between lines of text sent and received. Specifies a delay time interval between lines of text sent and received.
Also causes a delay time between connections to multiple ports. Also causes a delay time between connections to multiple ports.
@ -146,10 +151,13 @@ option are ignored.
.It Fl n .It Fl n
Do not do any DNS or service lookups on any specified addresses, Do not do any DNS or service lookups on any specified addresses,
hostnames or ports. hostnames or ports.
.It Fl O .It Fl -no-tcpopt
Disables the use of TCP options on the socket, by setting the boolean Disables the use of TCP options on the socket, by setting the boolean
TCP_NOOPT TCP_NOOPT
socket option. socket option.
.It Fl O Ar length
Specifies the size of the TCP send buffer.
When
.It Fl o .It Fl o
.Dq Once-only mode . .Dq Once-only mode .
By default, By default,

View File

@ -1,4 +1,4 @@
/* $OpenBSD: netcat.c,v 1.89 2007/02/20 14:11:17 jmc Exp $ */ /* $OpenBSD: netcat.c,v 1.91 2008/05/09 09:00:11 markus Exp $ */
/* /*
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org> * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
* *
@ -50,6 +50,7 @@
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <getopt.h>
#include <netdb.h> #include <netdb.h>
#include <poll.h> #include <poll.h>
#include <stdarg.h> #include <stdarg.h>
@ -78,7 +79,7 @@ int kflag; /* More than one connect */
int lflag; /* Bind to local port */ int lflag; /* Bind to local port */
int nflag; /* Don't do name look up */ int nflag; /* Don't do name look up */
int oflag; /* Once only: stop on EOF */ int oflag; /* Once only: stop on EOF */
int Oflag; /* Do not use TCP options */ int FreeBSD_Oflag; /* Do not use TCP options */
char *Pflag; /* Proxy username */ char *Pflag; /* Proxy username */
char *pflag; /* Localport flag */ char *pflag; /* Localport flag */
int rflag; /* Random ports flag */ int rflag; /* Random ports flag */
@ -89,6 +90,8 @@ int vflag; /* Verbosity */
int xflag; /* Socks proxy */ int xflag; /* Socks proxy */
int zflag; /* Port Scan Flag */ int zflag; /* Port Scan Flag */
int Dflag; /* sodebug */ int Dflag; /* sodebug */
int Iflag; /* TCP receive buffer size */
int Oflag; /* TCP send buffer size */
int Sflag; /* TCP MD5 signature option */ int Sflag; /* TCP MD5 signature option */
int Tflag = -1; /* IP Type of Service */ int Tflag = -1; /* IP Type of Service */
@ -129,6 +132,10 @@ main(int argc, char *argv[])
char *proxy; char *proxy;
const char *errstr, *proxyhost = "", *proxyport = NULL; const char *errstr, *proxyhost = "", *proxyport = NULL;
struct addrinfo proxyhints; struct addrinfo proxyhints;
struct option longopts[] = {
{ "no-tcpopt", no_argument, &FreeBSD_Oflag, 1 },
{ NULL, 0, NULL, 0 }
};
ret = 1; ret = 1;
ipsec_count = 0; ipsec_count = 0;
@ -138,8 +145,9 @@ main(int argc, char *argv[])
uport = NULL; uport = NULL;
sv = NULL; sv = NULL;
while ((ch = getopt(argc, argv, while ((ch = getopt_long(argc, argv,
"46e:DEdhi:jklnoOP:p:rSs:tT:Uuvw:X:x:z")) != -1) { "46e:DEdhi:jklnoI:O:P:p:rSs:tT:Uuvw:X:x:z",
longopts, NULL)) != -1) {
switch (ch) { switch (ch) {
case '4': case '4':
family = AF_INET; family = AF_INET;
@ -203,9 +211,6 @@ main(int argc, char *argv[])
case 'o': case 'o':
oflag = 1; oflag = 1;
break; break;
case 'O':
Oflag = 1;
break;
case 'P': case 'P':
Pflag = optarg; Pflag = optarg;
break; break;
@ -244,12 +249,28 @@ main(int argc, char *argv[])
case 'D': case 'D':
Dflag = 1; Dflag = 1;
break; break;
case 'I':
Iflag = strtonum(optarg, 1, 65536 << 14, &errstr);
if (errstr != NULL)
errx(1, "TCP receive window %s: %s",
errstr, optarg);
break;
case 'O':
Oflag = strtonum(optarg, 1, 65536 << 14, &errstr);
if (errstr != NULL) {
if (strcmp(errstr, "invalid") != 0)
errx(1, "TCP send window %s: %s",
errstr, optarg);
}
break;
case 'S': case 'S':
Sflag = 1; Sflag = 1;
break; break;
case 'T': case 'T':
Tflag = parse_iptos(optarg); Tflag = parse_iptos(optarg);
break; break;
case 0:
break;
default: default:
usage(1); usage(1);
} }
@ -512,7 +533,7 @@ int
remote_connect(const char *host, const char *port, struct addrinfo hints) remote_connect(const char *host, const char *port, struct addrinfo hints)
{ {
struct addrinfo *res, *res0; struct addrinfo *res, *res0;
int s, error; int s, error, on = 1;
if ((error = getaddrinfo(host, port, &hints, &res))) if ((error = getaddrinfo(host, port, &hints, &res)))
errx(1, "getaddrinfo: %s", gai_strerror(error)); errx(1, "getaddrinfo: %s", gai_strerror(error));
@ -533,6 +554,10 @@ remote_connect(const char *host, const char *port, struct addrinfo hints)
if (sflag || pflag) { if (sflag || pflag) {
struct addrinfo ahints, *ares; struct addrinfo ahints, *ares;
#ifdef SO_BINDANY
/* try SO_BINDANY, but don't insist */
setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
#endif
memset(&ahints, 0, sizeof(struct addrinfo)); memset(&ahints, 0, sizeof(struct addrinfo));
ahints.ai_family = res0->ai_family; ahints.ai_family = res0->ai_family;
ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
@ -604,9 +629,9 @@ local_listen(char *host, char *port, struct addrinfo hints)
if (ipsec_policy[1] != NULL) if (ipsec_policy[1] != NULL)
add_ipsec_policy(s, ipsec_policy[1]); add_ipsec_policy(s, ipsec_policy[1]);
#endif #endif
if (Oflag) { if (FreeBSD_Oflag) {
if (setsockopt(s, IPPROTO_TCP, TCP_NOOPT, if (setsockopt(s, IPPROTO_TCP, TCP_NOOPT,
&Oflag, sizeof(Oflag)) == -1) &FreeBSD_Oflag, sizeof(FreeBSD_Oflag)) == -1)
err(1, "disable TCP options"); err(1, "disable TCP options");
} }
@ -838,9 +863,19 @@ set_common_sockopts(int s)
&Tflag, sizeof(Tflag)) == -1) &Tflag, sizeof(Tflag)) == -1)
err(1, "set IP ToS"); err(1, "set IP ToS");
} }
if (Iflag) {
if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
&Iflag, sizeof(Iflag)) == -1)
err(1, "set TCP receive buffer size");
}
if (Oflag) { if (Oflag) {
if (setsockopt(s, IPPROTO_TCP, TCP_NOOPT, if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
&Oflag, sizeof(Oflag)) == -1) &Oflag, sizeof(Oflag)) == -1)
err(1, "set TCP send buffer size");
}
if (FreeBSD_Oflag) {
if (setsockopt(s, IPPROTO_TCP, TCP_NOOPT,
&FreeBSD_Oflag, sizeof(FreeBSD_Oflag)) == -1)
err(1, "disable TCP options"); err(1, "disable TCP options");
} }
} }
@ -878,11 +913,13 @@ help(void)
#endif #endif
fprintf(stderr, "\ fprintf(stderr, "\
\t-h This help text\n\ \t-h This help text\n\
\t-I length TCP receive buffer length\n\
\t-i secs\t Delay interval for lines sent, ports scanned\n\ \t-i secs\t Delay interval for lines sent, ports scanned\n\
\t-k Keep inbound sockets open for multiple connects\n\ \t-k Keep inbound sockets open for multiple connects\n\
\t-l Listen mode, for inbound connects\n\ \t-l Listen mode, for inbound connects\n\
\t-n Suppress name/port resolutions\n\ \t-n Suppress name/port resolutions\n\
\t-O Disable TCP options\n\ \t--no-tcpopt Disable TCP options\n\
\t-O length TCP send buffer length\n\
\t-o Terminate on EOF on input\n\ \t-o Terminate on EOF on input\n\
\t-P proxyuser\tUsername for proxy authentication\n\ \t-P proxyuser\tUsername for proxy authentication\n\
\t-p port\t Specify local port for remote connects\n\ \t-p port\t Specify local port for remote connects\n\
@ -931,10 +968,11 @@ void
usage(int ret) usage(int ret)
{ {
#ifdef IPSEC #ifdef IPSEC
fprintf(stderr, "usage: nc [-46DdEhklnOorStUuvz] [-e policy] [-i interval] [-P proxy_username] [-p source_port]\n"); fprintf(stderr, "usage: nc [-46DdEhklnorStUuvz] [-e policy] [-I receive_buffer_len] [-i interval]\n");
#else #else
fprintf(stderr, "usage: nc [-46DdhklnOorStUuvz] [-i interval] [-P proxy_username] [-p source_port]\n"); fprintf(stderr, "usage: nc [-46DdhklnorStUuvz] [-I receive_buffer_len] [-i interval]\n");
#endif #endif
fprintf(stderr, "\t [-O send_buffer_len] [-P proxy_username] [-p source_port]\n");
fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n"); fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n");
fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n"); fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n");
if (ret) if (ret)

View File

@ -162,6 +162,7 @@ distribution:
${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install ${_+_}cd ${.CURDIR}/bluetooth; ${MAKE} install
.endif .endif
${_+_}cd ${.CURDIR}/defaults; ${MAKE} install ${_+_}cd ${.CURDIR}/defaults; ${MAKE} install
${_+_}cd ${.CURDIR}/devd; ${MAKE} install
${_+_}cd ${.CURDIR}/gss; ${MAKE} install ${_+_}cd ${.CURDIR}/gss; ${MAKE} install
${_+_}cd ${.CURDIR}/periodic; ${MAKE} install ${_+_}cd ${.CURDIR}/periodic; ${MAKE} install
${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install ${_+_}cd ${.CURDIR}/rc.d; ${MAKE} install

View File

@ -277,29 +277,6 @@ notify 0 {
action "mixer vol +10"; action "mixer vol +10";
}; };
# The next blocks enable volume hotkeys that can be found on the Asus EeePC
# The four keys above the keyboard notify 0x1a through to 0x1d respectively
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x13";
action "mixer 0";
};
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x14";
action "mixer vol -10";
};
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x15";
action "mixer vol +10";
};
/* EXAMPLES TO END OF FILE /* EXAMPLES TO END OF FILE
# The following might be an example of something that a vendor might # The following might be an example of something that a vendor might

9
etc/devd/Makefile Normal file
View File

@ -0,0 +1,9 @@
# $FreeBSD$
FILES= asus.conf
NO_OBJ=
FILESDIR= /etc/devd
FILESMODE= 644
.include <bsd.prog.mk>

52
etc/devd/asus.conf Normal file
View File

@ -0,0 +1,52 @@
# $FreeBSD$
#
# ASUS specific devd events
# The next blocks enable volume hotkeys that can be found on the Asus EeePC
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x13";
action "mixer 0";
};
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x14";
action "mixer vol -10";
};
notify 0 {
match "system" "ACPI";
match "subsystem" "ASUS-Eee";
match "notify" "0x15";
action "mixer vol +10";
};
# Enable user hotkeys that can be found on the Asus EeePC
# The four keys above the keyboard notify 0x1a through to 0x1d respectively
#notify 0 {
# match "system" "ACPI";
# match "subsystem" "ASUS-Eee";
# match "notify" "0x1a";
# action "";
#};
#notify 0 {
# match "system" "ACPI";
# match "subsystem" "ASUS-Eee";
# match "notify" "0x1b";
# action "";
#};
#notify 0 {
# match "system" "ACPI";
# match "subsystem" "ASUS-Eee";
# match "notify" "0x1c";
# action "";
#};
#notify 0 {
# match "system" "ACPI";
# match "subsystem" "ASUS-Eee";
# match "notify" "0x1d";
# action "";
#};

View File

@ -28,6 +28,8 @@
.. ..
defaults defaults
.. ..
devd
..
gnats gnats
.. ..
gss gss

View File

@ -30,7 +30,7 @@ defaultroute_start()
defif=`get_default_if -inet` defif=`get_default_if -inet`
if [ -n "${defif}" ]; then if [ -n "${defif}" ]; then
if [ ${delay} -ne ${if_up_delay} ]; then if [ ${delay} -ne ${if_up_delay} ]; then
echo "($defif)" echo -n "($defif)"
fi fi
break break
fi fi
@ -42,6 +42,8 @@ defaultroute_start()
sleep 1 sleep 1
delay=`expr $delay - 1` delay=`expr $delay - 1`
done done
echo
} }
load_rc_config $name load_rc_config $name

View File

@ -39,7 +39,7 @@
--> -->
<rd id="debug"> <rd id="debug">
<name>DEBUG</name> <name>DEBUG</name>
<sku>0</sku> <sku>0x1ff</sku>
</rd> </rd>
<rd id="fcc"> <rd id="fcc">
@ -1080,6 +1080,75 @@
</band> </band>
</netband> </netband>
</rd> </rd>
<rd id="sr9">
<name>SR9</name>
<sku>0x0298</sku>
<defcc ref="SR9"/>
<netband mode="11g">
<band>
<freqband ref="S1_907_922_5"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S1_907_922_10"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S1_912_917"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
</netband>
</rd>
<rd id="xr9">
<name>XR9</name>
<sku>0x299</sku>
<defcc ref="XR9"/>
<netband mode="11g">
<band>
<freqband ref="S2_907_922_5"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S2_907_922_10"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S2_912_917"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
</netband>
</rd>
<rd id="gz901">
<name>GZ901</name>
<sku>0x29a</sku>
<defcc ref="GZ901"/>
<netband mode="11g">
<band>
<freqband ref="S1_908_923_5"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S1_913_918_10"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
<band>
<freqband ref="S1_913_918"/>
<maxpower>30</maxpower>
<flags>IEEE80211_CHAN_G</flags>
</band>
</netband>
</rd>
</regulatory-domains> </regulatory-domains>
<country-codes> <country-codes>
@ -1201,6 +1270,9 @@
<country id="GT"> <country id="GT">
<isocc>320</isocc> <name>Guatemala</name> <rd ref="none"/> <isocc>320</isocc> <name>Guatemala</name> <rd ref="none"/>
</country> </country>
<country id="GZ901">
<isocc>5002</isocc> <name>ZComax GZ-901</name> <rd ref="gz901"/>
</country>
<country id="HN"> <country id="HN">
<isocc>340</isocc> <name>Honduras</name> <rd ref="none"/> <isocc>340</isocc> <name>Honduras</name> <rd ref="none"/>
</country> </country>
@ -1396,6 +1468,12 @@
<country id="TR"> <country id="TR">
<isocc>792</isocc> <name>Turkey</name> <rd ref="etsi"/> <isocc>792</isocc> <name>Turkey</name> <rd ref="etsi"/>
</country> </country>
<country id="SR9">
<isocc>5000</isocc> <name>Ubiquiti SR9</name> <rd ref="sr9"/>
</country>
<country id="XR9">
<isocc>5001</isocc> <name>Ubiquiti XR9</name> <rd ref="xr9"/>
</country>
<country id="UA"> <country id="UA">
<isocc>804</isocc> <name>Ukraine</name> <rd ref="none"/> <isocc>804</isocc> <name>Ukraine</name> <rd ref="none"/>
</country> </country>
@ -1426,6 +1504,10 @@
<country id="ZW"> <country id="ZW">
<isocc>716</isocc> <name>Zimbabwe</name> <rd ref="none"/> <isocc>716</isocc> <name>Zimbabwe</name> <rd ref="none"/>
</country> </country>
<country id="DEBUG">
<isocc>0</isocc> <name>Debug</name> <rd ref="debug"/>
</country>
</country-codes> </country-codes>
<!-- <!--
@ -1575,6 +1657,61 @@
<freqstart>2512</freqstart> <freqend>2732</freqend> <freqstart>2512</freqstart> <freqend>2732</freqend>
<chanwidth>20</chanwidth> <chansep>5</chansep> <chanwidth>20</chanwidth> <chansep>5</chansep>
</freqband> </freqband>
<freqband id="S1_907_922_5">
<freqstart>2422</freqstart> <freqend>2437</freqend>
<chanwidth>5</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_QUARTER</flags>
</freqband>
<freqband id="S1_907_922_10">
<freqstart>2422</freqstart> <freqend>2437</freqend>
<chanwidth>10</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_HALF</flags>
</freqband>
<freqband id="S1_912_917">
<freqstart>2427</freqstart> <freqend>2432</freqend>
<chanwidth>20</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
</freqband>
<freqband id="S2_907_922_5">
<freqstart>2427</freqstart> <freqend>2442</freqend>
<chanwidth>5</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_QUARTER</flags>
</freqband>
<freqband id="S2_907_922_10">
<freqstart>2427</freqstart> <freqend>2442</freqend>
<chanwidth>10</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_HALF</flags>
</freqband>
<freqband id="S2_912_917">
<freqstart>2432</freqstart> <freqend>2437</freqend>
<chanwidth>20</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
</freqband>
<freqband id="S1_908_923_5">
<freqstart>2447</freqstart> <freqend>2467</freqend>
<chanwidth>5</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_QUARTER</flags>
</freqband>
<freqband id="S1_913_918_10">
<freqstart>2457</freqstart> <freqend>2462</freqend>
<chanwidth>10</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
<flags>IEEE80211_CHAN_HALF</flags>
</freqband>
<freqband id="S1_913_918">
<freqstart>2457</freqstart> <freqend>2462</freqend>
<chanwidth>20</chanwidth> <chansep>5</chansep>
<flags>IEEE80211_CHAN_GSM</flags>
</freqband>
</shared-frequency-bands> </shared-frequency-bands>
</regulatory-data> </regulatory-data>

View File

@ -69,6 +69,8 @@
. .
.\" FreeBSD releases not found in doc-common .\" FreeBSD releases not found in doc-common
.ds doc-operating-system-FreeBSD-6.3 6.3 .ds doc-operating-system-FreeBSD-6.3 6.3
.ds doc-operating-system-FreeBSD-6.4 6.4
.ds doc-operating-system-FreeBSD-7.1 7.1
.ds doc-operating-system-FreeBSD-8.0 8.0 .ds doc-operating-system-FreeBSD-8.0 8.0
. .
.ec .ec

View File

@ -49,7 +49,7 @@
*/ */
/* /*
* $Id: nameser.h,v 1.7.18.1 2005/04/27 05:00:50 sra Exp $ * $Id: nameser.h,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $
* $FreeBSD$ * $FreeBSD$
*/ */
@ -424,9 +424,10 @@ typedef enum __ns_cert_types {
#define NS_NXT_MAX 127 #define NS_NXT_MAX 127
/*% /*%
* EDNS0 extended flags, host order. * EDNS0 extended flags and option codes, host order.
*/ */
#define NS_OPT_DNSSEC_OK 0x8000U #define NS_OPT_DNSSEC_OK 0x8000U
#define NS_OPT_NSID 3
/*% /*%
* Inline versions of get/put short/long. Pointer is advanced. * Inline versions of get/put short/long. Pointer is advanced.

View File

@ -50,7 +50,7 @@
/*% /*%
* @(#)resolv.h 8.1 (Berkeley) 6/2/93 * @(#)resolv.h 8.1 (Berkeley) 6/2/93
* $Id: resolv.h,v 1.19.18.3 2005/08/25 04:43:51 marka Exp $ * $Id: resolv.h,v 1.19.18.4 2008/04/03 23:15:15 marka Exp $
* $FreeBSD$ * $FreeBSD$
*/ */
@ -245,6 +245,7 @@ union res_sockaddr_union {
#define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */ #define RES_NOCHECKNAME 0x00008000 /*%< do not check names for sanity. */
#define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */ #define RES_KEEPTSIG 0x00010000 /*%< do not strip TSIG records */
#define RES_BLAST 0x00020000 /*%< blast all recursive servers */ #define RES_BLAST 0x00020000 /*%< blast all recursive servers */
#define RES_NSID 0x00040000 /*%< request name server ID */
#define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */ #define RES_NOTLDQUERY 0x00100000 /*%< don't unqualified name as a tld */
#define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */ #define RES_USE_DNSSEC 0x00200000 /*%< use DNSSEC using OK bit in OPT */
/* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */ /* #define RES_DEBUG2 0x00400000 */ /* nslookup internal */
@ -386,6 +387,7 @@ extern const struct res_sym __p_rcode_syms[];
#define sym_ntos __sym_ntos #define sym_ntos __sym_ntos
#define sym_ston __sym_ston #define sym_ston __sym_ston
#define res_nopt __res_nopt #define res_nopt __res_nopt
#define res_nopt_rdata __res_nopt_rdata
#define res_ndestroy __res_ndestroy #define res_ndestroy __res_ndestroy
#define res_nametoclass __res_nametoclass #define res_nametoclass __res_nametoclass
#define res_nametotype __res_nametotype #define res_nametotype __res_nametotype
@ -474,6 +476,8 @@ int res_findzonecut2(res_state, const char *, ns_class, int,
union res_sockaddr_union *, int); union res_sockaddr_union *, int);
void res_nclose(res_state); void res_nclose(res_state);
int res_nopt(res_state, int, u_char *, int, int); int res_nopt(res_state, int, u_char *, int, int);
int res_nopt_rdata(res_state, int, u_char *, int, u_char *,
u_short, u_short, u_char *);
void res_send_setqhook(res_send_qhook); void res_send_setqhook(res_send_qhook);
void res_send_setrhook(res_send_rhook); void res_send_setrhook(res_send_rhook);
int __res_vinit(res_state, int); int __res_vinit(res_state, int);

View File

@ -192,7 +192,7 @@ archive_read_format_ar_read_header(struct archive_read *a,
/* Verify the magic signature on the file header. */ /* Verify the magic signature on the file header. */
if (strncmp(h + AR_fmag_offset, "`\n", 2) != 0) { if (strncmp(h + AR_fmag_offset, "`\n", 2) != 0) {
archive_set_error(&a->archive, EINVAL, archive_set_error(&a->archive, EINVAL,
"Consistency check failed"); "Incorrect file header signature");
return (ARCHIVE_WARN); return (ARCHIVE_WARN);
} }

View File

@ -897,7 +897,7 @@ int main(int argc, char **argv)
time_t now; time_t now;
char *refdir_alloc = NULL; char *refdir_alloc = NULL;
char *progname, *p; char *progname, *p;
char *tmp; const char *tmp;
char tmpdir[256]; char tmpdir[256];
char tmpdir_timestamp[256]; char tmpdir_timestamp[256];

View File

@ -43,6 +43,7 @@ test_compat_gtar_1(void)
char name[] = "test_compat_gtar_1.tgz"; char name[] = "test_compat_gtar_1.tgz";
struct archive_entry *ae; struct archive_entry *ae;
struct archive *a; struct archive *a;
int r;
assert((a = archive_read_new()) != NULL); assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
@ -51,7 +52,11 @@ test_compat_gtar_1(void)
assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
/* Read first entry. */ /* Read first entry. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
if (r != ARCHIVE_OK) {
archive_read_finish(a);
return;
}
assertEqualString( assertEqualString(
"12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890"
"12345678901234567890123456789012345678901234567890" "12345678901234567890123456789012345678901234567890"
@ -66,7 +71,11 @@ test_compat_gtar_1(void)
assertEqualInt(0100644, archive_entry_mode(ae)); assertEqualInt(0100644, archive_entry_mode(ae));
/* Read second entry. */ /* Read second entry. */
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
if (r != ARCHIVE_OK) {
archive_read_finish(a);
return;
}
assertEqualString( assertEqualString(
"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij" "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
"abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij" "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"

View File

@ -85,11 +85,11 @@ DEFINE_TEST(test_write_compress)
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
sprintf(path, "file%03d", i); sprintf(path, "file%03d", i);
assertEqualInt(0, archive_read_next_header(a, &ae)); if (!assertEqualInt(0, archive_read_next_header(a, &ae)))
break;
assertEqualString(path, archive_entry_pathname(ae)); assertEqualString(path, archive_entry_pathname(ae));
assertEqualInt(datasize, archive_entry_size(ae)); assertEqualInt(datasize, archive_entry_size(ae));
} }
assert(0 == archive_read_close(a)); assert(0 == archive_read_close(a));
#if ARCHIVE_VERSION_NUMBER < 2000000 #if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a); archive_read_finish(a);

View File

@ -73,8 +73,8 @@ DEFINE_TEST(test_write_format_ar)
archive_entry_copy_pathname(ae, "ggghhhjjjrrrttt.o"); archive_entry_copy_pathname(ae, "ggghhhjjjrrrttt.o");
archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_filetype(ae, AE_IFREG);
archive_entry_set_size(ae, 7); archive_entry_set_size(ae, 7);
assertA(0 == archive_write_header(a, ae)); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
assertA(7 == archive_write_data(a, "7777777", 7)); assertEqualIntA(a, 7, archive_write_data(a, "7777777", 7));
archive_entry_free(ae); archive_entry_free(ae);
/* test full pathname */ /* test full pathname */
@ -82,8 +82,8 @@ DEFINE_TEST(test_write_format_ar)
archive_entry_copy_pathname(ae, "/usr/home/xx/iiijjjdddsssppp.o"); archive_entry_copy_pathname(ae, "/usr/home/xx/iiijjjdddsssppp.o");
archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_mode(ae, S_IFREG | 0755);
archive_entry_set_size(ae, 8); archive_entry_set_size(ae, 8);
assertA(0 == archive_write_header(a, ae)); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
assertA(8 == archive_write_data(a, "88877766", 8)); assertEqualIntA(a, 8, archive_write_data(a, "88877766", 8));
archive_entry_free(ae); archive_entry_free(ae);
/* trailing "/" should be rejected */ /* trailing "/" should be rejected */
@ -105,46 +105,46 @@ DEFINE_TEST(test_write_format_ar)
#if ARCHIVE_VERSION_NUMBER < 2000000 #if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a); archive_write_finish(a);
#else #else
assert(0 == archive_write_finish(a)); assertEqualInt(0, archive_write_finish(a));
#endif #endif
/* /*
* Now, read the data back. * Now, read the data back.
*/ */
assert((a = archive_read_new()) != NULL); assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
assertA(0 == archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
assertA(0 == archive_read_open_memory(a, buff, used)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
assertA(0 == archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualInt(0, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_mtime(ae));
assertEqualString("//", archive_entry_pathname(ae)); assertEqualString("//", archive_entry_pathname(ae));
assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(0, archive_entry_size(ae));
assertA(0 == archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
assert(1 == archive_entry_mtime(ae)); assertEqualInt(1, archive_entry_mtime(ae));
assertEqualString("abcdefghijklmn.o", archive_entry_pathname(ae)); assertEqualString("abcdefghijklmn.o", archive_entry_pathname(ae));
assert(8 == archive_entry_size(ae)); assertEqualInt(8, archive_entry_size(ae));
assertA(8 == archive_read_data(a, buff2, 10)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
assert(0 == memcmp(buff2, "87654321", 8)); assertEqualMem(buff2, "87654321", 8);
assert(0 == archive_read_next_header(a, &ae)); assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
assertEqualString("ggghhhjjjrrrttt.o", archive_entry_pathname(ae)); assertEqualString("ggghhhjjjrrrttt.o", archive_entry_pathname(ae));
assert(7 == archive_entry_size(ae)); assertEqualInt(7, archive_entry_size(ae));
assertA(7 == archive_read_data(a, buff2, 11)); assertEqualIntA(a, 7, archive_read_data(a, buff2, 11));
assert(0 == memcmp(buff2, "7777777", 7)); assertEqualMem(buff2, "7777777", 7);
assert(0 == archive_read_next_header(a, &ae)); assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
assertEqualString("iiijjjdddsssppp.o", archive_entry_pathname(ae)); assertEqualString("iiijjjdddsssppp.o", archive_entry_pathname(ae));
assert(8 == archive_entry_size(ae)); assertEqualInt(8, archive_entry_size(ae));
assertA(8 == archive_read_data(a, buff2, 17)); assertEqualIntA(a, 8, archive_read_data(a, buff2, 17));
assert(0 == memcmp(buff2, "88877766", 8)); assertEqualMem(buff2, "88877766", 8);
assert(0 == archive_read_close(a)); assertEqualIntA(a, 0, archive_read_close(a));
#if ARCHIVE_VERSION_NUMBER < 2000000 #if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a); archive_read_finish(a);
#else #else
assert(0 == archive_read_finish(a)); assertEqualInt(0, archive_read_finish(a));
#endif #endif
/* /*
@ -152,18 +152,18 @@ DEFINE_TEST(test_write_format_ar)
*/ */
memset(buff, 0, sizeof(buff)); memset(buff, 0, sizeof(buff));
assert((a = archive_write_new()) != NULL); assert((a = archive_write_new()) != NULL);
assertA(0 == archive_write_set_format_ar_bsd(a)); assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ar_bsd(a));
assertA(0 == archive_write_set_compression_bzip2(a)); assertEqualIntA(a, ARCHIVE_OK, archive_write_set_compression_bzip2(a));
assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used));
/* write a entry need long name extension */ /* write a entry need long name extension */
assert((ae = archive_entry_new()) != NULL); assert((ae = archive_entry_new()) != NULL);
archive_entry_copy_pathname(ae, "ttttyyyyuuuuiiii.o"); archive_entry_copy_pathname(ae, "ttttyyyyuuuuiiii.o");
archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_filetype(ae, AE_IFREG);
archive_entry_set_size(ae, 5); archive_entry_set_size(ae, 5);
assertA(0 == archive_write_header(a, ae)); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
assertA(5 == archive_entry_size(ae)); assertEqualInt(5, archive_entry_size(ae));
assertA(5 == archive_write_data(a, "12345", 7)); assertEqualIntA(a, 5, archive_write_data(a, "12345", 7));
archive_entry_free(ae); archive_entry_free(ae);
/* write a entry with a short name */ /* write a entry with a short name */
@ -171,41 +171,41 @@ DEFINE_TEST(test_write_format_ar)
archive_entry_copy_pathname(ae, "ttyy.o"); archive_entry_copy_pathname(ae, "ttyy.o");
archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_filetype(ae, AE_IFREG);
archive_entry_set_size(ae, 6); archive_entry_set_size(ae, 6);
assertA(0 == archive_write_header(a, ae)); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
assertA(6 == archive_write_data(a, "555555", 7)); assertEqualIntA(a, 6, archive_write_data(a, "555555", 7));
archive_entry_free(ae); archive_entry_free(ae);
archive_write_close(a); archive_write_close(a);
#if ARCHIVE_VERSION_NUMBER < 2000000 #if ARCHIVE_VERSION_NUMBER < 2000000
archive_write_finish(a); archive_write_finish(a);
#else #else
assert(0 == archive_write_finish(a)); assertEqualInt(0, archive_write_finish(a));
#endif #endif
/* Now, Read the data back */ /* Now, Read the data back */
assert((a = archive_read_new()) != NULL); assert((a = archive_read_new()) != NULL);
assertA(0 == archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
assertA(0 == archive_read_support_compression_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
assertA(0 == archive_read_open_memory(a, buff, used)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
assertEqualString("ttttyyyyuuuuiiii.o", archive_entry_pathname(ae)); assertEqualString("ttttyyyyuuuuiiii.o", archive_entry_pathname(ae));
assertEqualInt(5, archive_entry_size(ae)); assertEqualInt(5, archive_entry_size(ae));
assertA(5 == archive_read_data(a, buff2, 10)); assertEqualIntA(a, 5, archive_read_data(a, buff2, 10));
assert(0 == memcmp(buff2, "12345", 5)); assertEqualMem(buff2, "12345", 5);
assert(0 == archive_read_next_header(a, &ae)); assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
assertEqualString("ttyy.o", archive_entry_pathname(ae)); assertEqualString("ttyy.o", archive_entry_pathname(ae));
assert(6 == archive_entry_size(ae)); assertEqualInt(6, archive_entry_size(ae));
assertA(6 == archive_read_data(a, buff2, 10)); assertEqualIntA(a, 6, archive_read_data(a, buff2, 10));
assert(0 == memcmp(buff2, "555555", 6)); assertEqualMem(buff2, "555555", 6);
/* Test EOF */ /* Test EOF */
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
assert(0 == archive_read_close(a)); assertEqualIntA(a, 0, archive_read_close(a));
#if ARCHIVE_VERSION_NUMBER < 2000000 #if ARCHIVE_VERSION_NUMBER < 2000000
archive_read_finish(a); archive_read_finish(a);
#else #else
assert(0 == archive_read_finish(a)); assertEqualInt(0, archive_read_finish(a));
#endif #endif
#endif #endif
} }

View File

@ -18,7 +18,7 @@
/* eventlib.h - exported interfaces for eventlib /* eventlib.h - exported interfaces for eventlib
* vix 09sep95 [initial] * vix 09sep95 [initial]
* *
* $Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $ * $Id: eventlib.h,v 1.3.18.3 2008/01/23 02:12:01 marka Exp $
*/ */
#ifndef _EVENTLIB_H #ifndef _EVENTLIB_H
@ -29,6 +29,8 @@
#include <sys/time.h> #include <sys/time.h>
#include <stdio.h> #include <stdio.h>
#include <isc/platform.h>
#ifndef __P #ifndef __P
# define __EVENTLIB_P_DEFINED # define __EVENTLIB_P_DEFINED
# ifdef __STDC__ # ifdef __STDC__

View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2008 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: platform.h.in,v 1.2.6.2 2008/01/23 02:15:02 tbox Exp $ */
/* $FreeBSD$ */
/*! \file */
#ifndef ISC_PLATFORM_H
#define ISC_PLATFORM_H
/*
* Define if the OS does not define struct timespec.
*/
#undef ISC_PLATFORM_NEEDTIMESPEC
#ifdef ISC_PLATFORM_NEEDTIMESPEC
#include <time.h> /* For time_t */
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
#endif
#endif

View File

@ -16,7 +16,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $"; static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $";
#endif #endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -135,11 +135,11 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
assert(n >= 0 && n <= 9); assert(n >= 0 && n <= 9);
bits *= 10; bits *= 10;
bits += n; bits += n;
if (bits > 32)
goto enoent;
} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch)); } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
if (ch != '\0') if (ch != '\0')
goto enoent; goto enoent;
if (bits > 32)
goto emsgsize;
} }
/* Firey death and destruction unless we prefetched EOS. */ /* Firey death and destruction unless we prefetched EOS. */

View File

@ -238,6 +238,13 @@ For
.Fn rcmd_af , .Fn rcmd_af ,
.Dv PF_UNSPEC .Dv PF_UNSPEC
is also allowed. is also allowed.
.Sh ENVIRONMENT
.Bl -tag -width RSH
.It Ev RSH
When using the
.Fn rcmd
function, this variable is used as the program to run instead of
.Xr rsh 1 .
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
The The
.Fn rcmd .Fn rcmd

View File

@ -91,7 +91,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $"; static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.6 2008/04/03 23:15:15 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -187,10 +187,56 @@ do_section(const res_state statp,
p_type(ns_rr_type(rr)), p_type(ns_rr_type(rr)),
p_class(ns_rr_class(rr))); p_class(ns_rr_class(rr)));
else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) { else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) {
u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr);
u_int32_t ttl = ns_rr_ttl(rr); u_int32_t ttl = ns_rr_ttl(rr);
fprintf(file, fprintf(file,
"; EDNS: version: %u, udp=%u, flags=%04x\n", "; EDNS: version: %u, udp=%u, flags=%04x\n",
(ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff); (ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff);
while (rdatalen >= 4) {
const u_char *cp = ns_rr_rdata(rr);
int i;
GETSHORT(optcode, cp);
GETSHORT(optlen, cp);
if (optcode == NS_OPT_NSID) {
fputs("; NSID: ", file);
if (optlen == 0) {
fputs("; NSID\n", file);
} else {
fputs("; NSID: ", file);
for (i = 0; i < optlen; i++)
fprintf(file, "%02x ",
cp[i]);
fputs(" (",file);
for (i = 0; i < optlen; i++)
fprintf(file, "%c",
isprint(cp[i])?
cp[i] : '.');
fputs(")\n", file);
}
} else {
if (optlen == 0) {
fprintf(file, "; OPT=%u\n",
optcode);
} else {
fprintf(file, "; OPT=%u: ",
optcode);
for (i = 0; i < optlen; i++)
fprintf(file, "%02x ",
cp[i]);
fputs(" (",file);
for (i = 0; i < optlen; i++)
fprintf(file, "%c",
isprint(cp[i]) ?
cp[i] : '.');
fputs(")\n", file);
}
}
rdatalen -= 4 + optlen;
}
} else { } else {
n = ns_sprintrr(handle, &rr, NULL, NULL, n = ns_sprintrr(handle, &rr, NULL, NULL,
buf, buflen); buf, buflen);
@ -202,7 +248,7 @@ do_section(const res_state statp,
buf = malloc(buflen += 1024); buf = malloc(buflen += 1024);
if (buf == NULL) { if (buf == NULL) {
fprintf(file, fprintf(file,
";; memory allocation failure\n"); ";; memory allocation failure\n");
return; return;
} }
continue; continue;
@ -379,7 +425,7 @@ static const struct res_sym __p_default_section_syms[] = {
{ns_s_an, "ANSWER", (char *)0}, {ns_s_an, "ANSWER", (char *)0},
{ns_s_ns, "AUTHORITY", (char *)0}, {ns_s_ns, "AUTHORITY", (char *)0},
{ns_s_ar, "ADDITIONAL", (char *)0}, {ns_s_ar, "ADDITIONAL", (char *)0},
{0, (char *)0, (char *)0} {0, (char *)0, (char *)0}
}; };
static const struct res_sym __p_update_section_syms[] = { static const struct res_sym __p_update_section_syms[] = {
@ -387,7 +433,7 @@ static const struct res_sym __p_update_section_syms[] = {
{S_PREREQ, "PREREQUISITE", (char *)0}, {S_PREREQ, "PREREQUISITE", (char *)0},
{S_UPDATE, "UPDATE", (char *)0}, {S_UPDATE, "UPDATE", (char *)0},
{S_ADDT, "ADDITIONAL", (char *)0}, {S_ADDT, "ADDITIONAL", (char *)0},
{0, (char *)0, (char *)0} {0, (char *)0, (char *)0}
}; };
const struct res_sym __p_key_syms[] = { const struct res_sym __p_key_syms[] = {
@ -615,6 +661,7 @@ p_option(u_long option) {
case RES_USE_INET6: return "inet6"; case RES_USE_INET6: return "inet6";
#ifdef RES_USE_EDNS0 /*%< KAME extension */ #ifdef RES_USE_EDNS0 /*%< KAME extension */
case RES_USE_EDNS0: return "edns0"; case RES_USE_EDNS0: return "edns0";
case RES_NSID: return "nsid";
#endif #endif
#ifdef RES_USE_DNAME #ifdef RES_USE_DNAME
case RES_USE_DNAME: return "dname"; case RES_USE_DNAME: return "dname";

View File

@ -66,7 +66,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp $"; static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.2 2008/04/03 23:15:15 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -201,9 +201,6 @@ res_nmkquery(res_state statp,
#ifdef RES_USE_EDNS0 #ifdef RES_USE_EDNS0
/* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */ /* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */
#ifndef T_OPT
#define T_OPT 41
#endif
int int
res_nopt(res_state statp, res_nopt(res_state statp,
@ -228,15 +225,16 @@ res_nopt(res_state statp,
if ((ep - cp) < 1 + RRFIXEDSZ) if ((ep - cp) < 1 + RRFIXEDSZ)
return (-1); return (-1);
*cp++ = 0; /*%< "." */ *cp++ = 0; /*%< "." */
ns_put16(T_OPT, cp); /*%< TYPE */ ns_put16(ns_t_opt, cp); /*%< TYPE */
cp += INT16SZ; cp += INT16SZ;
if (anslen > 0xffff) if (anslen > 0xffff)
anslen = 0xffff; /* limit to 16bit value */ anslen = 0xffff; /* limit to 16bit value */
ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */ ns_put16(anslen & 0xffff, cp); /*%< CLASS = UDP payload size */
cp += INT16SZ; cp += INT16SZ;
*cp++ = NOERROR; /*%< extended RCODE */ *cp++ = NOERROR; /*%< extended RCODE */
*cp++ = 0; /*%< EDNS version */ *cp++ = 0; /*%< EDNS version */
if (statp->options & RES_USE_DNSSEC) { if (statp->options & RES_USE_DNSSEC) {
#ifdef DEBUG #ifdef DEBUG
if (statp->options & RES_DEBUG) if (statp->options & RES_DEBUG)
@ -246,12 +244,60 @@ res_nopt(res_state statp,
} }
ns_put16(flags, cp); ns_put16(flags, cp);
cp += INT16SZ; cp += INT16SZ;
ns_put16(0, cp); /*%< RDLEN */
ns_put16(0U, cp); /*%< RDLEN */
cp += INT16SZ; cp += INT16SZ;
hp->arcount = htons(ntohs(hp->arcount) + 1); hp->arcount = htons(ntohs(hp->arcount) + 1);
return (cp - buf); return (cp - buf);
} }
/*
* Construct variable data (RDATA) block for OPT psuedo-RR, append it
* to the buffer, then update the RDLEN field (previously set to zero by
* res_nopt()) with the new RDATA length.
*/
int
res_nopt_rdata(res_state statp,
int n0, /*%< current offset in buffer */
u_char *buf, /*%< buffer to put query */
int buflen, /*%< size of buffer */
u_char *rdata, /*%< ptr to start of opt rdata */
u_short code, /*%< OPTION-CODE */
u_short len, /*%< OPTION-LENGTH */
u_char *data) /*%< OPTION_DATA */
{
register u_char *cp, *ep;
#ifdef DEBUG
if ((statp->options & RES_DEBUG) != 0U)
printf(";; res_nopt_rdata()\n");
#endif
cp = buf + n0;
ep = buf + buflen;
if ((ep - cp) < (4 + len))
return (-1);
if (rdata < (buf + 2) || rdata >= ep)
return (-1);
ns_put16(code, cp);
cp += INT16SZ;
ns_put16(len, cp);
cp += INT16SZ;
memcpy(cp, data, len);
cp += len;
len = cp - rdata;
ns_put16(len, rdata - 2); /* Update RDLEN field */
return (cp - buf);
}
#endif #endif
/*! \file */ /*! \file */

View File

@ -66,7 +66,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_query.c,v 1.7.18.1 2005/04/27 05:01:11 sra Exp $"; static const char rcsid[] = "$Id: res_query.c,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -115,8 +115,9 @@ res_nquery(res_state statp,
{ {
u_char buf[MAXPACKET]; u_char buf[MAXPACKET];
HEADER *hp = (HEADER *) answer; HEADER *hp = (HEADER *) answer;
int n;
u_int oflags; u_int oflags;
u_char *rdata;
int n;
oflags = statp->_flags; oflags = statp->_flags;
@ -131,8 +132,14 @@ res_nquery(res_state statp,
buf, sizeof(buf)); buf, sizeof(buf));
#ifdef RES_USE_EDNS0 #ifdef RES_USE_EDNS0
if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 && if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
(statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U) (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
n = res_nopt(statp, n, buf, sizeof(buf), anslen); n = res_nopt(statp, n, buf, sizeof(buf), anslen);
rdata = &buf[n];
if (n > 0 && (statp->options & RES_NSID) != 0U) {
n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
NS_OPT_NSID, 0, NULL);
}
}
#endif #endif
if (n <= 0) { if (n <= 0) {
#ifdef DEBUG #ifdef DEBUG
@ -142,6 +149,7 @@ res_nquery(res_state statp,
RES_SET_H_ERRNO(statp, NO_RECOVERY); RES_SET_H_ERRNO(statp, NO_RECOVERY);
return (n); return (n);
} }
n = res_nsend(statp, buf, n, answer, anslen); n = res_nsend(statp, buf, n, answer, anslen);
if (n < 0) { if (n < 0) {
#ifdef RES_USE_EDNS0 #ifdef RES_USE_EDNS0

View File

@ -66,7 +66,7 @@
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
static const char rcsid[] = "$Id: res_send.c,v 1.9.18.8 2006/10/16 23:00:58 marka Exp $"; static const char rcsid[] = "$Id: res_send.c,v 1.9.18.10 2008/01/27 02:06:26 marka Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -302,7 +302,7 @@ int
res_nsend(res_state statp, res_nsend(res_state statp,
const u_char *buf, int buflen, u_char *ans, int anssiz) const u_char *buf, int buflen, u_char *ans, int anssiz)
{ {
int gotsomewhere, terrno, try, v_circuit, resplen, ns, n; int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
#ifdef USE_KQUEUE #ifdef USE_KQUEUE
int kq; int kq;
#endif #endif
@ -420,7 +420,7 @@ res_nsend(res_state statp,
/* /*
* Send request, RETRY times, or until successful. * Send request, RETRY times, or until successful.
*/ */
for (try = 0; try < statp->retry; try++) { for (tries = 0; tries < statp->retry; tries++) {
for (ns = 0; ns < statp->nscount; ns++) { for (ns = 0; ns < statp->nscount; ns++) {
struct sockaddr *nsap; struct sockaddr *nsap;
int nsaplen; int nsaplen;
@ -471,7 +471,7 @@ res_nsend(res_state statp,
if (v_circuit) { if (v_circuit) {
/* Use VC; at most one attempt per server. */ /* Use VC; at most one attempt per server. */
try = statp->retry; tries = statp->retry;
n = send_vc(statp, buf, buflen, ans, anssiz, &terrno, n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
ns); ns);
if (n < 0) if (n < 0)
@ -486,7 +486,7 @@ res_nsend(res_state statp,
kq, kq,
#endif #endif
buf, buflen, ans, anssiz, &terrno, buf, buflen, ans, anssiz, &terrno,
ns, try, &v_circuit, &gotsomewhere); ns, tries, &v_circuit, &gotsomewhere);
if (n < 0) if (n < 0)
goto fail; goto fail;
if (n == 0) if (n == 0)
@ -632,6 +632,9 @@ send_vc(res_state statp,
u_short len; u_short len;
u_char *cp; u_char *cp;
void *tmp; void *tmp;
#ifdef SO_NOSIGPIPE
int on = 1;
#endif
nsap = get_nsaddr(statp, ns); nsap = get_nsaddr(statp, ns);
nsaplen = get_salen(nsap); nsaplen = get_salen(nsap);
@ -679,6 +682,17 @@ send_vc(res_state statp,
return (-1); return (-1);
} }
} }
#ifdef SO_NOSIGPIPE
/*
* Disable generation of SIGPIPE when writing to a closed
* socket. Write should return -1 and set errno to EPIPE
* instead.
*
* Push on even if setsockopt(SO_NOSIGPIPE) fails.
*/
(void)_setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,
sizeof(on));
#endif
errno = 0; errno = 0;
if (_connect(statp->_vcsock, nsap, nsaplen) < 0) { if (_connect(statp->_vcsock, nsap, nsaplen) < 0) {
*terrno = errno; *terrno = errno;
@ -811,7 +825,7 @@ send_dg(res_state statp,
int kq, int kq,
#endif #endif
const u_char *buf, int buflen, u_char *ans, const u_char *buf, int buflen, u_char *ans,
int anssiz, int *terrno, int ns, int try, int *v_circuit, int anssiz, int *terrno, int ns, int tries, int *v_circuit,
int *gotsomewhere) int *gotsomewhere)
{ {
const HEADER *hp = (const HEADER *) buf; const HEADER *hp = (const HEADER *) buf;
@ -915,7 +929,7 @@ send_dg(res_state statp,
/* /*
* Wait for reply. * Wait for reply.
*/ */
seconds = (statp->retrans << try); seconds = (statp->retrans << tries);
if (ns > 0) if (ns > 0)
seconds /= statp->nscount; seconds /= statp->nscount;
if (seconds <= 0) if (seconds <= 0)

View File

@ -25,7 +25,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd December 18, 2007 .Dd December 14, 2008
.Dt FETCH 3 .Dt FETCH 3
.Os .Os
.Sh NAME .Sh NAME
@ -165,9 +165,16 @@ struct url {
char *doc; char *doc;
off_t offset; off_t offset;
size_t length; size_t length;
time_t ims_time;
}; };
.Ed .Ed
.Pp .Pp
The
.Va ims_time
field stores the time value for
.Li If-Modified-Since
HTTP requests.
.Pp
The pointer returned by The pointer returned by
.Fn fetchMakeURL .Fn fetchMakeURL
or or
@ -353,6 +360,22 @@ and
.Fn fetchPutHTTP .Fn fetchPutHTTP
will use a direct connection even if a proxy server is defined. will use a direct connection even if a proxy server is defined.
.Pp .Pp
If the
.Ql i
(if-modified-since) flag is specified, and
the
.Va ims_time
field is set in
.Vt "struct url" ,
then
.Fn fetchXGetHTTP
and
.Fn fetchGetHTTP
will send a conditional
.Li If-Modified-Since
HTTP header to only fetch the content if it is newer than
.Va ims_time .
.Pp
Since there seems to be no good way of implementing the HTTP PUT Since there seems to be no good way of implementing the HTTP PUT
method in a manner consistent with the rest of the method in a manner consistent with the rest of the
.Nm fetch .Nm fetch

View File

@ -74,9 +74,7 @@ static struct fetcherr url_errlist[] = {
FILE * FILE *
fetchXGet(struct url *URL, struct url_stat *us, const char *flags) fetchXGet(struct url *URL, struct url_stat *us, const char *flags)
{ {
int direct;
direct = CHECK_FLAG('d');
if (us != NULL) { if (us != NULL) {
us->size = -1; us->size = -1;
us->atime = us->mtime = 0; us->atime = us->mtime = 0;
@ -110,9 +108,7 @@ fetchGet(struct url *URL, const char *flags)
FILE * FILE *
fetchPut(struct url *URL, const char *flags) fetchPut(struct url *URL, const char *flags)
{ {
int direct;
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return (fetchPutFile(URL, flags)); return (fetchPutFile(URL, flags));
else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
@ -132,9 +128,7 @@ fetchPut(struct url *URL, const char *flags)
int int
fetchStat(struct url *URL, struct url_stat *us, const char *flags) fetchStat(struct url *URL, struct url_stat *us, const char *flags)
{ {
int direct;
direct = CHECK_FLAG('d');
if (us != NULL) { if (us != NULL) {
us->size = -1; us->size = -1;
us->atime = us->mtime = 0; us->atime = us->mtime = 0;
@ -158,9 +152,7 @@ fetchStat(struct url *URL, struct url_stat *us, const char *flags)
struct url_ent * struct url_ent *
fetchList(struct url *URL, const char *flags) fetchList(struct url *URL, const char *flags)
{ {
int direct;
direct = CHECK_FLAG('d');
if (strcasecmp(URL->scheme, SCHEME_FILE) == 0) if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
return (fetchListFile(URL, flags)); return (fetchListFile(URL, flags));
else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0) else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)

View File

@ -46,6 +46,7 @@ struct url {
char *doc; char *doc;
off_t offset; off_t offset;
size_t length; size_t length;
time_t ims_time;
}; };
struct url_stat { struct url_stat {

View File

@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h> #include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h>
#include <ctype.h> #include <ctype.h>
#include <err.h> #include <err.h>
@ -92,6 +93,7 @@ __FBSDID("$FreeBSD$");
#define HTTP_MOVED_PERM 301 #define HTTP_MOVED_PERM 301
#define HTTP_MOVED_TEMP 302 #define HTTP_MOVED_TEMP 302
#define HTTP_SEE_OTHER 303 #define HTTP_SEE_OTHER 303
#define HTTP_NOT_MODIFIED 304
#define HTTP_TEMP_REDIRECT 307 #define HTTP_TEMP_REDIRECT 307
#define HTTP_NEED_AUTH 401 #define HTTP_NEED_AUTH 401
#define HTTP_NEED_PROXY_AUTH 407 #define HTTP_NEED_PROXY_AUTH 407
@ -797,20 +799,23 @@ FILE *
http_request(struct url *URL, const char *op, struct url_stat *us, http_request(struct url *URL, const char *op, struct url_stat *us,
struct url *purl, const char *flags) struct url *purl, const char *flags)
{ {
char timebuf[80];
char hbuf[MAXHOSTNAMELEN + 7], *host;
conn_t *conn; conn_t *conn;
struct url *url, *new; struct url *url, *new;
int chunked, direct, need_auth, noredirect, verbose; int chunked, direct, ims, need_auth, noredirect, verbose;
int e, i, n, val; int e, i, n, val;
off_t offset, clength, length, size; off_t offset, clength, length, size;
time_t mtime; time_t mtime;
const char *p; const char *p;
FILE *f; FILE *f;
hdr_t h; hdr_t h;
char hbuf[MAXHOSTNAMELEN + 7], *host; struct tm *timestruct;
direct = CHECK_FLAG('d'); direct = CHECK_FLAG('d');
noredirect = CHECK_FLAG('A'); noredirect = CHECK_FLAG('A');
verbose = CHECK_FLAG('v'); verbose = CHECK_FLAG('v');
ims = CHECK_FLAG('i');
if (direct && purl) { if (direct && purl) {
fetchFreeURL(purl); fetchFreeURL(purl);
@ -879,6 +884,14 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
op, url->doc); op, url->doc);
} }
if (ims && url->ims_time) {
timestruct = gmtime((time_t *)&url->ims_time);
(void)strftime(timebuf, 80, "%a, %d %b %Y %T GMT",
timestruct);
if (verbose)
fetch_info("If-Modified-Since: %s", timebuf);
http_cmd(conn, "If-Modified-Since: %s", timebuf);
}
/* virtual host */ /* virtual host */
http_cmd(conn, "Host: %s", host); http_cmd(conn, "Host: %s", host);
@ -940,6 +953,7 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
switch (http_get_reply(conn)) { switch (http_get_reply(conn)) {
case HTTP_OK: case HTTP_OK:
case HTTP_PARTIAL: case HTTP_PARTIAL:
case HTTP_NOT_MODIFIED:
/* fine */ /* fine */
break; break;
case HTTP_MOVED_PERM: case HTTP_MOVED_PERM:
@ -1074,7 +1088,10 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
} }
/* we have a hit or an error */ /* we have a hit or an error */
if (conn->err == HTTP_OK || conn->err == HTTP_PARTIAL || HTTP_ERROR(conn->err)) if (conn->err == HTTP_OK
|| conn->err == HTTP_NOT_MODIFIED
|| conn->err == HTTP_PARTIAL
|| HTTP_ERROR(conn->err))
break; break;
/* all other cases: we got a redirect */ /* all other cases: we got a redirect */
@ -1102,6 +1119,11 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
(long long)offset, (long long)length, (long long)offset, (long long)length,
(long long)size, (long long)clength)); (long long)size, (long long)clength));
if (conn->err == HTTP_NOT_MODIFIED) {
http_seterr(HTTP_NOT_MODIFIED);
return (NULL);
}
/* check for inconsistencies */ /* check for inconsistencies */
if (clength != -1 && length != -1 && clength != length) { if (clength != -1 && length != -1 && clength != length) {
http_seterr(HTTP_PROTOCOL_ERROR); http_seterr(HTTP_PROTOCOL_ERROR);

View File

@ -156,7 +156,7 @@ struct ifqueue arpintrq;
void arpwhohas(struct arpcom *, struct in_addr *); void arpwhohas(struct arpcom *, struct in_addr *);
void arpintr(void); void arpintr(void);
int arpresolve(struct arpcom *, int arpresolve(struct arpcom *,
struct rtentry *, struct mbuf *, struct sockaddr *, u_char *); struct rtentry *, struct mbuf *, struct sockaddr *, u_char *, struct llentry **);
void arp_ifinit(struct arpcom *, struct ifaddr *); void arp_ifinit(struct arpcom *, struct ifaddr *);
void arp_rtrequest(int, struct rtentry *, struct sockaddr *); void arp_rtrequest(int, struct rtentry *, struct sockaddr *);
@ -233,7 +233,7 @@ struct ether_multistep {
#ifdef _KERNEL #ifdef _KERNEL
void arp_rtrequest(int, struct rtentry *, struct sockaddr *); void arp_rtrequest(int, struct rtentry *, struct sockaddr *);
int arpresolve(struct arpcom *, struct rtentry *, struct mbuf *, int arpresolve(struct arpcom *, struct rtentry *, struct mbuf *,
struct sockaddr *, u_char *); struct sockaddr *, u_char *, struct llentry **);
void arpintr(void); void arpintr(void);
int arpioctl(u_long, caddr_t); int arpioctl(u_long, caddr_t);
void arp_ifinit(struct arpcom *, struct ifaddr *); void arp_ifinit(struct arpcom *, struct ifaddr *);

View File

@ -19,6 +19,7 @@ kinfo_getfile(pid_t pid, int *cntp)
char *buf, *bp, *eb; char *buf, *bp, *eb;
struct kinfo_file *kif, *kp, *kf; struct kinfo_file *kif, *kp, *kf;
*cntp = 0;
len = 0; len = 0;
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC; mib[1] = KERN_PROC;
@ -27,15 +28,15 @@ kinfo_getfile(pid_t pid, int *cntp)
error = sysctl(mib, 4, NULL, &len, NULL, 0); error = sysctl(mib, 4, NULL, &len, NULL, 0);
if (error) if (error)
return (0); return (NULL);
len = len * 4 / 3; len = len * 4 / 3;
buf = malloc(len); buf = malloc(len);
if (buf == NULL) if (buf == NULL)
return (0); return (NULL);
error = sysctl(mib, 4, buf, &len, NULL, 0); error = sysctl(mib, 4, buf, &len, NULL, 0);
if (error) { if (error) {
free(buf); free(buf);
return (0); return (NULL);
} }
/* Pass 1: count items */ /* Pass 1: count items */
cnt = 0; cnt = 0;
@ -50,7 +51,7 @@ kinfo_getfile(pid_t pid, int *cntp)
kif = calloc(cnt, sizeof(*kif)); kif = calloc(cnt, sizeof(*kif));
if (kif == NULL) { if (kif == NULL) {
free(buf); free(buf);
return (0); return (NULL);
} }
bp = buf; bp = buf;
eb = buf + len; eb = buf + len;

View File

@ -19,6 +19,7 @@ kinfo_getvmmap(pid_t pid, int *cntp)
char *buf, *bp, *eb; char *buf, *bp, *eb;
struct kinfo_vmentry *kiv, *kp, *kv; struct kinfo_vmentry *kiv, *kp, *kv;
*cntp = 0;
len = 0; len = 0;
mib[0] = CTL_KERN; mib[0] = CTL_KERN;
mib[1] = KERN_PROC; mib[1] = KERN_PROC;
@ -27,15 +28,15 @@ kinfo_getvmmap(pid_t pid, int *cntp)
error = sysctl(mib, 4, NULL, &len, NULL, 0); error = sysctl(mib, 4, NULL, &len, NULL, 0);
if (error) if (error)
return (0); return (NULL);
len = len * 4 / 3; len = len * 4 / 3;
buf = malloc(len); buf = malloc(len);
if (buf == NULL) if (buf == NULL)
return (0); return (NULL);
error = sysctl(mib, 4, buf, &len, NULL, 0); error = sysctl(mib, 4, buf, &len, NULL, 0);
if (error) { if (error) {
free(buf); free(buf);
return (0); return (NULL);
} }
/* Pass 1: count items */ /* Pass 1: count items */
cnt = 0; cnt = 0;
@ -50,7 +51,7 @@ kinfo_getvmmap(pid_t pid, int *cntp)
kiv = calloc(cnt, sizeof(*kiv)); kiv = calloc(cnt, sizeof(*kiv));
if (kiv == NULL) { if (kiv == NULL) {
free(buf); free(buf);
return (0); return (NULL);
} }
bp = buf; bp = buf;
eb = buf + len; eb = buf + len;

View File

@ -152,7 +152,6 @@ int bsd_arp_set(ia, eaddr, len)
sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin);
if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) {
if (sdl->sdl_family == AF_LINK && if (sdl->sdl_family == AF_LINK &&
(rtm->rtm_flags & RTF_LLINFO) &&
!(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) {
case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023:
case IFT_ISO88024: case IFT_ISO88025: case IFT_ISO88024: case IFT_ISO88025:

View File

@ -90,22 +90,40 @@
</listitem> </listitem>
<listitem> <listitem>
<para>&intel; 64-bit &xeon; (<quote>Nocona</quote>). This <para>All multi-core &intel; &xeon; processors except
processor is fabricated on 90nm process technology, and Sossaman have EM64T support.</para>
operates with 2.80 to 3.60 GHz (FSB 800MHz) and &intel;
E7520/E7525/E7320 chipsets.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>&intel; &pentium; 4 Processor supporting &intel; EM64T <para>The single-core &intel; &xeon;
(<quote>Prescott</quote>). This is fabricated on 90nm processors <quote>Nocona</quote>, <quote>Irwindale</quote>,
process technology, uses FC-LGA775 package, and operates <quote>Potomac</quote>, and <quote>Cranford</quote> have
with 3.20F/3.40F/3.60F GHz and &intel; 925X Express EM64T support.</para>
chipsets. The corresponding S-Spec numbers are SL7L9,
SL7L8, SL7LA, SL7NZ, SL7PZ, and SL7PX. Note that
processors marked as 5xx numbers do not support
EM64T.</para>
</listitem> </listitem>
<listitem>
<para>All &intel; Core 2 (not Core Duo) and later
processors</para>
</listitem>
<listitem>
<para>All &intel; &pentium; D processors</para>
</listitem>
<listitem>
<para>&intel; &pentium; 4s and Celeron Ds using
the <quote>Cedar Mill</quote> core have EM64T
support.</para>
</listitem>
<listitem>
<para>Some &intel; &pentium; 4s and Celeron Ds using
the <quote>Prescott</quote> core have EM64T support. See
the <ulink url="http://processorfinder.intel.com">Intel
Processor Spec Finder</ulink> for the definitive answer about
EM64T support in Intel processors.</para>
</listitem>
</itemizedlist> </itemizedlist>
<para>&intel; EM64T is an extended version of IA-32 (x86) and <para>&intel; EM64T is an extended version of IA-32 (x86) and
@ -114,7 +132,7 @@
to &intel; EM64T as <quote>64-bit extension technology</quote> to &intel; EM64T as <quote>64-bit extension technology</quote>
or <quote>IA-32e</quote>.</para> or <quote>IA-32e</quote>.</para>
<para>The largest tested memory configuration to date is 8GB. <para>The largest tested memory configuration to date is 64GB.
SMP support has been recently completed and is reasonably SMP support has been recently completed and is reasonably
robust.</para> robust.</para>
@ -760,7 +778,7 @@
&hwlist.tl; &hwlist.tl;
<para>[&arch.amd64;, &arch.i386, &arch.pc98;] SMC 83c17x <para>[&arch.amd64;, &arch.i386;, &arch.pc98;] SMC 83c17x
(EPIC)-based Ethernet NICs (&man.tx.4; driver)</para> (EPIC)-based Ethernet NICs (&man.tx.4; driver)</para>
&hwlist.txp; &hwlist.txp;
@ -784,7 +802,7 @@
<sect2 id="fddi"> <sect2 id="fddi">
<title>FDDI Interfaces</title> <title>FDDI Interfaces</title>
<para>[&arch.i386, &arch.pc98;] DEC DEFPA PCI (&man.fpa.4; <para>[&arch.i386;, &arch.pc98;] DEC DEFPA PCI (&man.fpa.4;
driver)</para> driver)</para>
<para>[&arch.i386;] DEC DEFEA EISA (&man.fpa.4; driver)</para> <para>[&arch.i386;] DEC DEFEA EISA (&man.fpa.4; driver)</para>
@ -793,17 +811,17 @@
<sect2 id="atm"> <sect2 id="atm">
<title>ATM Interfaces</title> <title>ATM Interfaces</title>
<para>[&arch.i386, &arch.pc98;] Midway-based ATM interfaces <para>[&arch.i386;, &arch.pc98;] Midway-based ATM interfaces
(&man.en.4; driver)</para> (&man.en.4; driver)</para>
<para>[&arch.i386, &arch.pc98; &arch.sparc64;] FORE Systems, <para>[&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems,
Inc. PCA-200E ATM PCI Adapters (hfa and &man.fatm.4; Inc. PCA-200E ATM PCI Adapters (hfa and &man.fatm.4;
drivers)</para> drivers)</para>
<para>[&arch.i386;, &arch.pc98;] IDT NICStAR 77201/211-based ATM <para>[&arch.i386;, &arch.pc98;] IDT NICStAR 77201/211-based ATM
Adapters (&man.idt.4; driver)</para> Adapters (&man.idt.4; driver)</para>
<para>[&arch.i386, &arch.pc98; &arch.sparc64;] FORE Systems, <para>[&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems,
Inc. HE155 and HE622 ATM interfaces (&man.hatm.4; Inc. HE155 and HE622 ATM interfaces (&man.hatm.4;
driver)</para> driver)</para>
@ -1008,7 +1026,7 @@
<sect2 id="serial"> <sect2 id="serial">
<title>Serial Interfaces</title> <title>Serial Interfaces</title>
<para>[&arch.amd64; &arch.i386;] <quote>PC standard</quote> <para>[&arch.amd64;, &arch.i386;] <quote>PC standard</quote>
8250, 16450, and 16550-based serial ports (&man.sio.4; 8250, 16450, and 16550-based serial ports (&man.sio.4;
driver)</para> driver)</para>
@ -1016,7 +1034,7 @@
&hwlist.scc; &hwlist.scc;
<para>[&arch.amd64; &arch.i386;] AST 4 port serial card using <para>[&arch.amd64;, &arch.i386;] AST 4 port serial card using
shared IRQ</para> shared IRQ</para>
<para>[&arch.i386;] ARNET serial cards (&man.ar.4; <para>[&arch.i386;] ARNET serial cards (&man.ar.4;
@ -1068,25 +1086,25 @@
<para>[&arch.i386;] DigiBoard intelligent serial cards (digi <para>[&arch.i386;] DigiBoard intelligent serial cards (digi
driver)</para> driver)</para>
<para>[&arch.amd64;, &arch.i386, &arch.ia64;] PCI-Based <para>[&arch.amd64;, &arch.i386;, &arch.ia64;] PCI-Based
multi-port serial boards (&man.puc.4; driver)</para> multi-port serial boards (&man.puc.4; driver)</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Actiontech 56K PCI</para> <para>[&arch.amd64;, &arch.i386;] Actiontech 56K PCI</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Avlab Technology, PCI IO 2S <para>[&arch.amd64;, &arch.i386;] Avlab Technology, PCI IO 2S
and PCI IO 4S</para> and PCI IO 4S</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Comtrol RocketPort 550</para> <para>[&arch.amd64;, &arch.i386;] Comtrol RocketPort 550</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Decision Computers PCCOM <para>[&arch.amd64;, &arch.i386;] Decision Computers PCCOM
4-port serial and dual port RS232/422/485</para> 4-port serial and dual port RS232/422/485</para>
</listitem> </listitem>
@ -1095,92 +1113,92 @@
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Dolphin Peripherals <para>[&arch.amd64;, &arch.i386;] Dolphin Peripherals
4025/4035/4036</para> 4025/4035/4036</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] IC Book Labs Dreadnought <para>[&arch.amd64;, &arch.i386;] IC Book Labs Dreadnought
16x Lite and Pro</para> 16x Lite and Pro</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Lava Computers <para>[&arch.amd64;, &arch.i386;] Lava Computers
2SP-PCI/DSerial-PCI/Quattro-PCI/Octopus-550</para> 2SP-PCI/DSerial-PCI/Quattro-PCI/Octopus-550</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Middle Digital, Weasle <para>[&arch.amd64;, &arch.i386;] Middle Digital, Weasle
serial port</para> serial port</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Moxa Industio CP-114, <para>[&arch.amd64;, &arch.i386;] Moxa Industio CP-114,
Smartio C104H-PCI and C168H/PCI</para> Smartio C104H-PCI and C168H/PCI</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] NEC PK-UG-X001 and <para>[&arch.amd64;, &arch.i386;] NEC PK-UG-X001 and
PK-UG-X008</para> PK-UG-X008</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Netmos NM9835 <para>[&arch.amd64;, &arch.i386;] Netmos NM9835
PCI-2S-550</para> PCI-2S-550</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Oxford Semiconductor <para>[&arch.amd64;, &arch.i386;] Oxford Semiconductor
OX16PCI954 PCI UART</para> OX16PCI954 PCI UART</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Syba Tech SD-LAB <para>[&arch.amd64;, &arch.i386;] Syba Tech SD-LAB
PCI-4S2P-550-ECP</para> PCI-4S2P-550-ECP</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] SIIG Cyber I/O PCI <para>[&arch.amd64;, &arch.i386;] SIIG Cyber I/O PCI
16C550/16C650/16C850</para> 16C550/16C650/16C850</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] SIIG Cyber 2P1S PCI <para>[&arch.amd64;, &arch.i386;] SIIG Cyber 2P1S PCI
16C550/16C650/16C850</para> 16C550/16C650/16C850</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] SIIG Cyber 2S1P PCI <para>[&arch.amd64;, &arch.i386;] SIIG Cyber 2S1P PCI
16C550/16C650/16C850</para> 16C550/16C650/16C850</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] SIIG Cyber 4S PCI <para>[&arch.amd64;, &arch.i386;] SIIG Cyber 4S PCI
16C550/16C650/16C850</para> 16C550/16C650/16C850</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] SIIG Cyber Serial (Single <para>[&arch.amd64;, &arch.i386;] SIIG Cyber Serial (Single
and Dual) PCI 16C550/16C650/16C850</para> and Dual) PCI 16C550/16C650/16C850</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Syba Tech <para>[&arch.amd64;, &arch.i386;] Syba Tech
Ltd. PCI-4S2P-550-ECP</para> Ltd. PCI-4S2P-550-ECP</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] Titan PCI-200H and <para>[&arch.amd64;, &arch.i386;] Titan PCI-200H and
PCI-800H</para> PCI-800H</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] US Robotics (3Com) 3CP5609 <para>[&arch.amd64;, &arch.i386;] US Robotics (3Com) 3CP5609
modem</para> modem</para>
</listitem> </listitem>
<listitem> <listitem>
<para>[&arch.amd64; &arch.i386;] VScom PCI-400 and <para>[&arch.amd64;, &arch.i386;] VScom PCI-400 and
PCI-800</para> PCI-800</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
@ -1406,7 +1424,7 @@
<para>[&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;] <para>[&arch.amd64;, &arch.i386;, &arch.ia64;, &arch.pc98;]
Keyboards (&man.ukbd.4; driver)</para> Keyboards (&man.ukbd.4; driver)</para>
<para>[&arch.amd64;, &arch.i386, &arch.pc98;] <para>[&arch.amd64;, &arch.i386;, &arch.pc98;]
Miscellaneous</para> Miscellaneous</para>
<itemizedlist> <itemizedlist>
@ -1507,7 +1525,7 @@
<para>[&arch.amd64;, &arch.i386;, &arch.pc98;] Floppy drives <para>[&arch.amd64;, &arch.i386;, &arch.pc98;] Floppy drives
(&man.fdc.4; driver)</para> (&man.fdc.4; driver)</para>
<para>[&arch.amd64; &arch.i386;] VGA-compatible video cards <para>[&arch.amd64;, &arch.i386;] VGA-compatible video cards
(&man.vga.4; driver)</para> (&man.vga.4; driver)</para>
<note> <note>

View File

@ -382,10 +382,6 @@ print_routing(char *proto)
rtm = (struct rt_msghdr *)next; rtm = (struct rt_msghdr *)next;
sa = (struct sockaddr *)(rtm + 1); sa = (struct sockaddr *)(rtm + 1);
get_rtaddrs(rtm->rtm_addrs, sa, rti_info); get_rtaddrs(rtm->rtm_addrs, sa, rti_info);
if (rtm->rtm_flags & RTF_WASCLONED) {
if ((rtm->rtm_flags & RTF_LLINFO) == 0)
continue;
}
if ((sa = rti_info[RTAX_DST]) != NULL) { if ((sa = rti_info[RTAX_DST]) != NULL) {
sprintf(fbuf, "%s", sock_ntop(sa, sa->sa_len)); sprintf(fbuf, "%s", sock_ntop(sa, sa->sa_len));
if (((sa1 = rti_info[RTAX_NETMASK]) != NULL) if (((sa1 = rti_info[RTAX_NETMASK]) != NULL)

View File

@ -25,7 +25,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd June 25, 2008 .Dd December 14, 2008
.Dt ATACONTROL 8 .Dt ATACONTROL 8
.Os .Os
.Sh NAME .Sh NAME
@ -63,6 +63,7 @@
.Nm .Nm
.Ic mode .Ic mode
.Ar device .Ar device
.Op Ar mode
.Nm .Nm
.Ic info .Ic info
.Ar channel .Ar channel
@ -94,7 +95,7 @@ The
.Ar channel .Ar channel
argument is the ATA channel device (e.g., ata0) on which to operate. argument is the ATA channel device (e.g., ata0) on which to operate.
The following commands are supported: The following commands are supported:
.Bl -tag -width "rebuild" .Bl -tag -width ".Ic addspare"
.It Ic attach .It Ic attach
Attach an ATA Attach an ATA
.Ar channel . .Ar channel .
@ -162,9 +163,13 @@ Rebuild a RAID1 array on a RAID capable ATA controller.
.It Ic status .It Ic status
Get the status of an ATA RAID. Get the status of an ATA RAID.
.It Ic mode .It Ic mode
Without the mode argument, the current transfer modes of the Without the
.Ar mode
argument, the current transfer mode of the
device are printed. device are printed.
If the mode argument is given, the ATA driver If the
.Ar mode
argument is given, the ATA driver
is asked to change the transfer mode to the one given. is asked to change the transfer mode to the one given.
The ATA driver The ATA driver
will reject modes that are not supported by the hardware. will reject modes that are not supported by the hardware.
@ -190,13 +195,12 @@ and
.Cm UDMA6 .Cm UDMA6
(alias (alias
.Cm UDMA133 ) . .Cm UDMA133 ) .
The device name and manufacture/version strings are shown.
.It Ic cap .It Ic cap
Show detailed info about the device on Show detailed info about the device on
.Ar device . .Ar device .
.It Ic spindown .It Ic spindown
Set or report timeout after which the Set or report timeout after which the
.Ar device .Ar device
will be spun down. will be spun down.
To arm the timeout the device needs at least one more request after To arm the timeout the device needs at least one more request after
setting the timeout. setting the timeout.
@ -205,6 +209,7 @@ No further actions are needed in this case.
.It Ic info .It Ic info
Show info about the attached devices on the Show info about the attached devices on the
.Ar channel . .Ar channel .
The device name and manufacture/version strings are shown.
.It Ic list .It Ic list
Show info about all attached devices on all active controllers. Show info about all attached devices on all active controllers.
.El .El
@ -312,7 +317,7 @@ If the system has a pure software array and is not using a "real" ATA
RAID controller, then shut the system down, make sure that the disk RAID controller, then shut the system down, make sure that the disk
that was still working is moved to the bootable position (channel 0 that was still working is moved to the bootable position (channel 0
or whatever the BIOS allows the system to boot from) and the blank disk or whatever the BIOS allows the system to boot from) and the blank disk
is placed in the secondary position, then boot the system into is placed in the secondary position, then boot the system into
single-user mode and issue the command: single-user mode and issue the command:
.Pp .Pp
.Dl "atacontrol addspare ar0 ad6" .Dl "atacontrol addspare ar0 ad6"

View File

@ -307,7 +307,7 @@ void
config::parse_one_file(const char *fn) config::parse_one_file(const char *fn)
{ {
if (Dflag) if (Dflag)
printf("Parsing %s\n", fn); fprintf(stderr, "Parsing %s\n", fn);
yyin = fopen(fn, "r"); yyin = fopen(fn, "r");
if (yyin == NULL) if (yyin == NULL)
err(1, "Cannot open config file %s", fn); err(1, "Cannot open config file %s", fn);
@ -325,7 +325,7 @@ config::parse_files_in_dir(const char *dirname)
char path[PATH_MAX]; char path[PATH_MAX];
if (Dflag) if (Dflag)
printf("Parsing files in %s\n", dirname); fprintf(stderr, "Parsing files in %s\n", dirname);
dirp = opendir(dirname); dirp = opendir(dirname);
if (dirp == NULL) if (dirp == NULL)
return; return;

View File

@ -110,7 +110,7 @@ statement.
.It Ic directory Qq Ar /some/path ; .It Ic directory Qq Ar /some/path ;
Adds the given directory to the list of directories from which Adds the given directory to the list of directories from which
.Xr devd 8 .Xr devd 8
will read will read all files named "*.conf" as further
configuration files. configuration files.
Any number of Any number of
.Ic directory .Ic directory

View File

@ -211,7 +211,7 @@ g_metadata_store(const char *name, u_char *md, size_t size)
sector = NULL; sector = NULL;
error = 0; error = 0;
fd = open(path, O_WRONLY); fd = open(path, O_RDWR);
if (fd == -1) if (fd == -1)
return (errno); return (errno);
mediasize = g_get_mediasize(name); mediasize = g_get_mediasize(name);

View File

@ -425,7 +425,7 @@ setregdomain_cb(int s, void *arg)
struct ieee80211_devcaps_req dc; struct ieee80211_devcaps_req dc;
struct regdata *rdp = getregdata(); struct regdata *rdp = getregdata();
if (rd->country != 0) { if (rd->country != NO_COUNTRY) {
const struct country *cc; const struct country *cc;
/* /*
* Check current country seting to make sure it's * Check current country seting to make sure it's
@ -456,7 +456,7 @@ setregdomain_cb(int s, void *arg)
errx(1, "country %s (%s) is not usable with " errx(1, "country %s (%s) is not usable with "
"regdomain %d", cc->isoname, cc->name, "regdomain %d", cc->isoname, cc->name,
rd->regdomain); rd->regdomain);
else if (rp->cc != 0 && rp->cc != cc) else if (rp->cc != NULL && rp->cc != cc)
errx(1, "country %s (%s) is not usable with " errx(1, "country %s (%s) is not usable with "
"regdomain %s", cc->isoname, cc->name, "regdomain %s", cc->isoname, cc->name,
rp->name); rp->name);
@ -663,31 +663,39 @@ getchannelflags(const char *val, int freq)
#undef _CHAN_HT #undef _CHAN_HT
} }
static void
getchannel(int s, struct ieee80211_channel *chan, const char *val)
{
int v, flags;
char *eptr;
memset(chan, 0, sizeof(*chan));
if (isanyarg(val)) {
chan->ic_freq = IEEE80211_CHAN_ANY;
return;
}
getchaninfo(s);
errno = 0;
v = strtol(val, &eptr, 10);
if (val[0] == '\0' || val == eptr || errno == ERANGE ||
/* channel may be suffixed with nothing, :flag, or /width */
(eptr[0] != '\0' && eptr[0] != ':' && eptr[0] != '/'))
errx(1, "invalid channel specification%s",
errno == ERANGE ? " (out of range)" : "");
flags = getchannelflags(val, v);
if (v > 255) { /* treat as frequency */
mapfreq(chan, v, flags);
} else {
mapchan(chan, v, flags);
}
}
static void static void
set80211channel(const char *val, int d, int s, const struct afswtch *rafp) set80211channel(const char *val, int d, int s, const struct afswtch *rafp)
{ {
struct ieee80211_channel chan; struct ieee80211_channel chan;
memset(&chan, 0, sizeof(chan)); getchannel(s, &chan, val);
if (!isanyarg(val)) {
int v, flags;
char *ep;
getchaninfo(s);
v = strtol(val, &ep, 10);
if (val[0] == '\0' || val == ep || errno == ERANGE ||
/* channel may be suffixed with nothing, :flag, or /width */
(ep[0] != '\0' && ep[0] != ':' && ep[0] != '/'))
errx(1, "invalid channel specification");
flags = getchannelflags(val, v);
if (v > 255) { /* treat as frequency */
mapfreq(&chan, v, flags);
} else {
mapchan(&chan, v, flags);
}
} else {
chan.ic_freq = IEEE80211_CHAN_ANY;
}
set80211(s, IEEE80211_IOC_CURCHAN, 0, sizeof(chan), &chan); set80211(s, IEEE80211_IOC_CURCHAN, 0, sizeof(chan), &chan);
} }
@ -695,17 +703,8 @@ static void
set80211chanswitch(const char *val, int d, int s, const struct afswtch *rafp) set80211chanswitch(const char *val, int d, int s, const struct afswtch *rafp)
{ {
struct ieee80211_chanswitch_req csr; struct ieee80211_chanswitch_req csr;
int v, flags;
memset(&csr, 0, sizeof(csr)); getchannel(s, &csr.csa_chan, val);
getchaninfo(s);
v = atoi(val);
flags = getchannelflags(val, v);
if (v > 255) { /* treat as frequency */
mapfreq(&csr.csa_chan, v, flags);
} else {
mapchan(&csr.csa_chan, v, flags);
}
csr.csa_mode = 1; csr.csa_mode = 1;
csr.csa_count = 5; csr.csa_count = 5;
set80211(s, IEEE80211_IOC_CHANSWITCH, 0, sizeof(csr), &csr); set80211(s, IEEE80211_IOC_CHANSWITCH, 0, sizeof(csr), &csr);
@ -1770,14 +1769,21 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
printf("%u: skip, flags 0x%x not available\n", freq, chanFlags); printf("%u: skip, flags 0x%x not available\n", freq, chanFlags);
continue; continue;
} }
/*
* NB: don't enforce 1/2 and 1/4 rate channels being
* specified in the device's calibration list for
* 900MHz cards because most are not self-identifying.
*/
if ((flags & IEEE80211_CHAN_HALF) && if ((flags & IEEE80211_CHAN_HALF) &&
(chanFlags & IEEE80211_CHAN_HALF) == 0) { ((chanFlags & IEEE80211_CHAN_HALF) == 0 &&
(flags & IEEE80211_CHAN_GSM) == 0)) {
if (verbose) if (verbose)
printf("%u: skip, device does not support half-rate channels\n", freq); printf("%u: skip, device does not support half-rate channels\n", freq);
continue; continue;
} }
if ((flags & IEEE80211_CHAN_QUARTER) && if ((flags & IEEE80211_CHAN_QUARTER) &&
(chanFlags & IEEE80211_CHAN_QUARTER) == 0) { ((chanFlags & IEEE80211_CHAN_HALF) == 0 &&
(flags & IEEE80211_CHAN_GSM) == 0)) {
if (verbose) if (verbose)
printf("%u: skip, device does not support quarter-rate channels\n", freq); printf("%u: skip, device does not support quarter-rate channels\n", freq);
continue; continue;
@ -1951,8 +1957,12 @@ DECL_CMD_FUNC(set80211regdomain, val, d)
rd = lib80211_regdomain_findbyname(rdp, val); rd = lib80211_regdomain_findbyname(rdp, val);
if (rd == NULL) { if (rd == NULL) {
rd = lib80211_regdomain_findbysku(rdp, atoi(val)); char *eptr;
if (rd == NULL) long sku = strtol(val, &eptr, 0);
if (eptr != val)
rd = lib80211_regdomain_findbysku(rdp, sku);
if (eptr == val || rd == NULL)
errx(1, "unknown regdomain %s", val); errx(1, "unknown regdomain %s", val);
} }
getregdomain(s); getregdomain(s);
@ -1975,8 +1985,12 @@ DECL_CMD_FUNC(set80211country, val, d)
cc = lib80211_country_findbyname(rdp, val); cc = lib80211_country_findbyname(rdp, val);
if (cc == NULL) { if (cc == NULL) {
cc = lib80211_country_findbycc(rdp, atoi(val)); char *eptr;
if (cc == NULL) long code = strtol(val, &eptr, 0);
if (eptr != val)
cc = lib80211_country_findbycc(rdp, code);
if (eptr == val || cc == NULL)
errx(1, "unknown ISO country code %s", val); errx(1, "unknown ISO country code %s", val);
} }
getregdomain(s); getregdomain(s);
@ -3534,8 +3548,12 @@ get80211opmode(int s)
(void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); (void) strncpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name));
if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) {
if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) if (ifmr.ifm_current & IFM_IEEE80211_ADHOC) {
return IEEE80211_M_IBSS; /* XXX ahdemo */ if (ifmr.ifm_current & IFM_FLAG0)
return IEEE80211_M_AHDEMO;
else
return IEEE80211_M_IBSS;
}
if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP) if (ifmr.ifm_current & IFM_IEEE80211_HOSTAP)
return IEEE80211_M_HOSTAP; return IEEE80211_M_HOSTAP;
if (ifmr.ifm_current & IFM_IEEE80211_MONITOR) if (ifmr.ifm_current & IFM_IEEE80211_MONITOR)
@ -4244,6 +4262,7 @@ ieee80211_status(int s)
} }
} }
} }
if (get80211val(s, IEEE80211_IOC_BEACON_INTERVAL, &val) != -1) { if (get80211val(s, IEEE80211_IOC_BEACON_INTERVAL, &val) != -1) {
/* XXX default define not visible */ /* XXX default define not visible */
if (val != 100 || verbose) if (val != 100 || verbose)

View File

@ -48,6 +48,7 @@ static const char rcsid[] = "$FreeBSD$";
#define MAXLEVEL 20 #define MAXLEVEL 20
struct mystate { struct mystate {
XML_Parser parser;
struct regdata *rdp; struct regdata *rdp;
struct regdomain *rd; /* current domain */ struct regdomain *rd; /* current domain */
struct netband *netband; /* current netband */ struct netband *netband; /* current netband */
@ -107,7 +108,8 @@ start_element(void *data, const char *name, const char **attr)
} }
if (iseq(name, "netband") && mt->curband == NULL && mt->rd != NULL) { if (iseq(name, "netband") && mt->curband == NULL && mt->rd != NULL) {
if (mode == NULL) { if (mode == NULL) {
/* XXX complain */ warnx("no mode for netband at line %ld",
XML_GetCurrentLineNumber(mt->parser));
return; return;
} }
if (iseq(mode, "11b")) if (iseq(mode, "11b"))
@ -120,12 +122,16 @@ start_element(void *data, const char *name, const char **attr)
mt->curband = &mt->rd->bands_11ng; mt->curband = &mt->rd->bands_11ng;
else if (iseq(mode, "11na")) else if (iseq(mode, "11na"))
mt->curband = &mt->rd->bands_11na; mt->curband = &mt->rd->bands_11na;
/* XXX else complain */ else
warnx("unknown mode \"%s\" at line %ld",
__DECONST(char *, mode),
XML_GetCurrentLineNumber(mt->parser));
return; return;
} }
if (iseq(name, "band") && mt->netband == NULL) { if (iseq(name, "band") && mt->netband == NULL) {
if (mt->curband == NULL) { if (mt->curband == NULL) {
/* XXX complain */ warnx("band without enclosing netband at line %ld",
XML_GetCurrentLineNumber(mt->parser));
return; return;
} }
mt->netband = calloc(1, sizeof(struct netband)); mt->netband = calloc(1, sizeof(struct netband));
@ -135,6 +141,8 @@ start_element(void *data, const char *name, const char **attr)
if (iseq(name, "freqband") && mt->freqband == NULL && mt->netband != NULL) { if (iseq(name, "freqband") && mt->freqband == NULL && mt->netband != NULL) {
/* XXX handle inlines and merge into table? */ /* XXX handle inlines and merge into table? */
if (mt->netband->band != NULL) { if (mt->netband->band != NULL) {
warnx("duplicate freqband at line %ld ignored",
XML_GetCurrentLineNumber(mt->parser));
/* XXX complain */ /* XXX complain */
} else } else
mt->netband->band = (void *)strdup(ref); mt->netband->band = (void *)strdup(ref);
@ -144,6 +152,7 @@ start_element(void *data, const char *name, const char **attr)
if (iseq(name, "country") && mt->country == NULL) { if (iseq(name, "country") && mt->country == NULL) {
mt->country = calloc(1, sizeof(struct country)); mt->country = calloc(1, sizeof(struct country));
mt->country->isoname = strdup(id); mt->country->isoname = strdup(id);
mt->country->code = NO_COUNTRY;
mt->nident++; mt->nident++;
LIST_INSERT_HEAD(&mt->rdp->countries, mt->country, next); LIST_INSERT_HEAD(&mt->rdp->countries, mt->country, next);
return; return;
@ -159,8 +168,8 @@ start_element(void *data, const char *name, const char **attr)
#undef iseq #undef iseq
} }
static uint32_t static int
decode_flag(const char *p, int len) decode_flag(struct mystate *mt, const char *p, int len)
{ {
#define iseq(a,b) (strcasecmp(a,b) == 0) #define iseq(a,b) (strcasecmp(a,b) == 0)
static const struct { static const struct {
@ -168,7 +177,7 @@ decode_flag(const char *p, int len)
int len; int len;
uint32_t value; uint32_t value;
} flags[] = { } flags[] = {
#define FLAG(x) { #x, sizeof(#x), x } #define FLAG(x) { #x, sizeof(#x)-1, x }
FLAG(IEEE80211_CHAN_A), FLAG(IEEE80211_CHAN_A),
FLAG(IEEE80211_CHAN_B), FLAG(IEEE80211_CHAN_B),
FLAG(IEEE80211_CHAN_G), FLAG(IEEE80211_CHAN_G),
@ -205,6 +214,8 @@ decode_flag(const char *p, int len)
for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++)
if (len == flags[i].len && iseq(p, flags[i].name)) if (len == flags[i].len && iseq(p, flags[i].name))
return flags[i].value; return flags[i].value;
warnx("unknown flag \"%.*s\" at line %ld ignored",
len, p, XML_GetCurrentLineNumber(mt->parser));
return 0; return 0;
#undef iseq #undef iseq
} }
@ -241,11 +252,12 @@ end_element(void *data, const char *name)
} }
if (iseq(name, "flags")) { if (iseq(name, "flags")) {
if (mt->freqband != NULL) if (mt->freqband != NULL)
mt->freqband->flags |= decode_flag(p, len); mt->freqband->flags |= decode_flag(mt, p, len);
else if (mt->netband != NULL) else if (mt->netband != NULL)
mt->netband->flags |= decode_flag(p, len); mt->netband->flags |= decode_flag(mt, p, len);
else { else {
/* XXX complain */ warnx("flags without freqband or netband at line %ld ignored",
XML_GetCurrentLineNumber(mt->parser));
} }
goto done; goto done;
} }
@ -289,7 +301,8 @@ end_element(void *data, const char *name)
} }
if (len != 0) { if (len != 0) {
printf("Unexpected XML: name \"%s\" data \"%s\"\n", name, p); warnx("unexpected XML token \"%s\" data \"%s\" at line %ld",
name, p, XML_GetCurrentLineNumber(mt->parser));
/* XXX goto done? */ /* XXX goto done? */
} }
/* </freqband> */ /* </freqband> */
@ -307,15 +320,12 @@ end_element(void *data, const char *name)
/* </band> */ /* </band> */
if (iseq(name, "band") && mt->netband != NULL) { if (iseq(name, "band") && mt->netband != NULL) {
if (mt->netband->band == NULL) { if (mt->netband->band == NULL) {
printf("No frequency band information at line %d\n", warnx("no freqbands for band at line %ld",
#if 0 XML_GetCurrentLineNumber(mt->parser));
XML_GetCurrentLineNumber(parser));
#else
0);
#endif
} }
if (mt->netband->maxPower == 0) { if (mt->netband->maxPower == 0) {
/* XXX complain */ warnx("no maxpower for band at line %ld",
XML_GetCurrentLineNumber(mt->parser));
} }
/* default max power w/ DFS to max power */ /* default max power w/ DFS to max power */
if (mt->netband->maxPowerDFS == 0) if (mt->netband->maxPowerDFS == 0)
@ -330,14 +340,17 @@ end_element(void *data, const char *name)
} }
/* </country> */ /* </country> */
if (iseq(name, "country") && mt->country != NULL) { if (iseq(name, "country") && mt->country != NULL) {
if (mt->country->code == 0) { if (mt->country->code == NO_COUNTRY) {
/* XXX must have iso cc */ warnx("no ISO cc for country at line %ld",
XML_GetCurrentLineNumber(mt->parser));
} }
if (mt->country->name == NULL) { if (mt->country->name == NULL) {
/* XXX must have name */ warnx("no name for country at line %ld",
XML_GetCurrentLineNumber(mt->parser));
} }
if (mt->country->rd == NULL) { if (mt->country->rd == NULL) {
/* XXX? rd ref? */ warnx("no regdomain reference for country at line %ld",
XML_GetCurrentLineNumber(mt->parser));
} }
mt->country = NULL; mt->country = NULL;
goto done; goto done;
@ -383,7 +396,6 @@ findid(struct regdata *rdp, const void *id, int type)
int int
lib80211_regdomain_readconfig(struct regdata *rdp, const void *p, size_t len) lib80211_regdomain_readconfig(struct regdata *rdp, const void *p, size_t len)
{ {
XML_Parser parser;
struct mystate *mt; struct mystate *mt;
struct regdomain *dp; struct regdomain *dp;
struct country *cp; struct country *cp;
@ -398,17 +410,17 @@ lib80211_regdomain_readconfig(struct regdata *rdp, const void *p, size_t len)
return ENOMEM; return ENOMEM;
/* parse the XML input */ /* parse the XML input */
mt->rdp = rdp; mt->rdp = rdp;
parser = XML_ParserCreate(NULL); mt->parser = XML_ParserCreate(NULL);
XML_SetUserData(parser, mt); XML_SetUserData(mt->parser, mt);
XML_SetElementHandler(parser, start_element, end_element); XML_SetElementHandler(mt->parser, start_element, end_element);
XML_SetCharacterDataHandler(parser, char_data); XML_SetCharacterDataHandler(mt->parser, char_data);
if (XML_Parse(parser, p, len, 1) != XML_STATUS_OK) { if (XML_Parse(mt->parser, p, len, 1) != XML_STATUS_OK) {
warnx("%s: %s at line %ld", __func__, warnx("%s: %s at line %ld", __func__,
XML_ErrorString(XML_GetErrorCode(parser)), XML_ErrorString(XML_GetErrorCode(mt->parser)),
XML_GetCurrentLineNumber(parser)); XML_GetCurrentLineNumber(mt->parser));
return -1; return -1;
} }
XML_ParserFree(parser); XML_ParserFree(mt->parser);
/* setup the identifer table */ /* setup the identifer table */
rdp->ident = calloc(sizeof(struct ident), mt->nident + 1); rdp->ident = calloc(sizeof(struct ident), mt->nident + 1);

View File

@ -73,6 +73,7 @@ struct regdomain {
struct country { struct country {
enum ISOCountryCode code; enum ISOCountryCode code;
#define NO_COUNTRY 0xffff
const struct regdomain *rd; const struct regdomain *rd;
const char* isoname; const char* isoname;
const char* name; const char* name;

View File

@ -69,6 +69,7 @@
.Op Ar number ... .Op Ar number ...
.Pp .Pp
.Nm .Nm
.Op Fl q
.Cm nat .Cm nat
.Ar number .Ar number
.Cm config .Cm config
@ -235,6 +236,7 @@ Try to resolve addresses and service names in output.
.It Fl q .It Fl q
While While
.Cm add Ns ing , .Cm add Ns ing ,
.Cm nat Ns ing ,
.Cm zero Ns ing , .Cm zero Ns ing ,
.Cm resetlog Ns ging .Cm resetlog Ns ging
or or

View File

@ -4067,10 +4067,12 @@ config_nat(int ac, char **av)
if (i) if (i)
err(1, "setsockopt(%s)", "IP_FW_NAT_CFG"); err(1, "setsockopt(%s)", "IP_FW_NAT_CFG");
/* After every modification, we show the resultant rule. */ if (!do_quiet) {
int _ac = 3; /* After every modification, we show the resultant rule. */
char *_av[] = {"show", "config", id}; int _ac = 3;
show_nat(_ac, _av); char *_av[] = {"show", "config", id};
show_nat(_ac, _av);
}
} }
static void static void

View File

@ -68,6 +68,8 @@ static const char rcsid[] =
#define MOUNT_META_OPTION_FSTAB "fstab" #define MOUNT_META_OPTION_FSTAB "fstab"
#define MOUNT_META_OPTION_CURRENT "current" #define MOUNT_META_OPTION_CURRENT "current"
#define MAX_ARGS 100
int debug, fstab_style, verbose; int debug, fstab_style, verbose;
char *catopt(char *, const char *); char *catopt(char *, const char *);
@ -501,7 +503,7 @@ int
mountfs(const char *vfstype, const char *spec, const char *name, int flags, mountfs(const char *vfstype, const char *spec, const char *name, int flags,
const char *options, const char *mntopts) const char *options, const char *mntopts)
{ {
char *argv[100]; char *argv[MAX_ARGS];
struct statfs sf; struct statfs sf;
int argc, i, ret; int argc, i, ret;
char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX]; char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX];
@ -546,6 +548,10 @@ mountfs(const char *vfstype, const char *spec, const char *name, int flags,
argv[argc++] = strdup(name); argv[argc++] = strdup(name);
argv[argc] = NULL; argv[argc] = NULL;
if (MAX_ARGS <= argc )
errx(1, "Cannot process more than %d mount arguments",
MAX_ARGS);
if (debug) { if (debug) {
if (use_mountprog(vfstype)) if (use_mountprog(vfstype))
printf("exec: mount_%s", vfstype); printf("exec: mount_%s", vfstype);

View File

@ -88,7 +88,7 @@ mount_fs(const char *vfstype, int argc, char *argv[])
char *p, *val; char *p, *val;
int ret; int ret;
strncpy(fstype, vfstype, sizeof(fstype)); strlcpy(fstype, vfstype, sizeof(fstype));
memset(errmsg, 0, sizeof(errmsg)); memset(errmsg, 0, sizeof(errmsg));
getmnt_silent = 1; getmnt_silent = 1;

View File

@ -605,9 +605,6 @@ newroute(argc, argv)
case K_NOSTATIC: case K_NOSTATIC:
flags &= ~RTF_STATIC; flags &= ~RTF_STATIC;
break; break;
case K_LLINFO:
flags |= RTF_LLINFO;
break;
case K_LOCK: case K_LOCK:
locking = 1; locking = 1;
break; break;
@ -632,9 +629,6 @@ newroute(argc, argv)
case K_PROXY: case K_PROXY:
proxy = 1; proxy = 1;
break; break;
case K_CLONING:
flags |= RTF_CLONING;
break;
case K_XRESOLVE: case K_XRESOLVE:
flags |= RTF_XRESOLVE; flags |= RTF_XRESOLVE;
break; break;

View File

@ -1103,12 +1103,13 @@ flush_kern(void)
|| INFO_DST(&info)->sa_family != AF_INET) || INFO_DST(&info)->sa_family != AF_INET)
continue; continue;
#if defined (RTF_LLINFO)
/* ignore ARP table entries on systems with a merged route /* ignore ARP table entries on systems with a merged route
* and ARP table. * and ARP table.
*/ */
if (rtm->rtm_flags & RTF_LLINFO) if (rtm->rtm_flags & RTF_LLINFO)
continue; continue;
#endif
#if defined(RTF_WASCLONED) && defined(__FreeBSD__) #if defined(RTF_WASCLONED) && defined(__FreeBSD__)
/* ignore cloned routes /* ignore cloned routes
*/ */
@ -1261,11 +1262,13 @@ read_rt(void)
continue; continue;
} }
#if defined(RTF_LLINFO)
if (m.r.rtm.rtm_flags & RTF_LLINFO) { if (m.r.rtm.rtm_flags & RTF_LLINFO) {
trace_act("ignore ARP %s", str); trace_act("ignore ARP %s", str);
continue; continue;
} }
#endif
#if defined(RTF_WASCLONED) && defined(__FreeBSD__) #if defined(RTF_WASCLONED) && defined(__FreeBSD__)
if (m.r.rtm.rtm_flags & RTF_WASCLONED) { if (m.r.rtm.rtm_flags & RTF_WASCLONED) {
trace_act("ignore cloned %s", str); trace_act("ignore cloned %s", str);

View File

@ -473,6 +473,7 @@ MLINKS+=edsc.4 if_edsc.4
MLINKS+=ef.4 if_ef.4 MLINKS+=ef.4 if_ef.4
MLINKS+=em.4 if_em.4 MLINKS+=em.4 if_em.4
MLINKS+=en.4 if_en.4 MLINKS+=en.4 if_en.4
MLINKS+=enc.4 if_enc.4
MLINKS+=et.4 if_et.4 MLINKS+=et.4 if_et.4
MLINKS+=faith.4 if_faith.4 MLINKS+=faith.4 if_faith.4
MLINKS+=fatm.4 if_fatm.4 MLINKS+=fatm.4 if_fatm.4

View File

@ -56,8 +56,8 @@ The driver uses ACPI as the backend to fetch sensor values and
descriptions and provides its data via the descriptions and provides its data via the
.Xr sysctl 8 .Xr sysctl 8
interface, under dev.acpi_aiboost.0 namespace. interface, under dev.acpi_aiboost.0 namespace.
Descriptions for these values are set to sysctl description, Descriptions for these values are available
which can be see with sysctl -d. with sysctl -d.
.Pp .Pp
The The
.Nm .Nm

View File

@ -25,7 +25,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd August 20, 2008 .Dd December 17, 2008
.Dt ACPI_ASUS 4 i386 .Dt ACPI_ASUS 4 i386
.Os .Os
.Sh NAME .Sh NAME
@ -56,7 +56,8 @@ interface to manipulate the brightness of the LCD panel and the display output
state. state.
Hotkey events are passed to Hotkey events are passed to
.Xr devd 8 .Xr devd 8
for easy handling in userspace. for easy handling in userspace with the default configuration in
.Pa /etc/devd/asus.conf .
.Pp .Pp
Currently, the following Asus laptops are fully supported: Currently, the following Asus laptops are fully supported:
.Pp .Pp

View File

@ -25,7 +25,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 7, 2007 .Dd December 15, 2008
.Dt FXP 4 .Dt FXP 4
.Os .Os
.Sh NAME .Sh NAME
@ -51,6 +51,13 @@ The
.Nm .Nm
driver provides support for Ethernet adapters based on the Intel driver provides support for Ethernet adapters based on the Intel
i82557, i82558, i82559, i82550, and i82562 chips. i82557, i82558, i82559, i82550, and i82562 chips.
The driver supports TCP/UDP/IP checksum offload for both transmit
and receive on i82550 and i82551.
On i82559 only TCP/UDP checksum offload for receive is supported.
TCP segmentation offload (TSO) for IPv4 as well as VLAN hardware
tag insertion/stripping is supported on i82550 and i82551.
Wake On Lan (WOL) support is provided on all controllers
except i82557, i82259ER and early i82558 revisions.
.Pp .Pp
The The
.Nm .Nm

View File

@ -196,7 +196,7 @@ Messages include:
#define RTM_REDIRECT 0x6 /* Told to use different route */ #define RTM_REDIRECT 0x6 /* Told to use different route */
#define RTM_MISS 0x7 /* Lookup failed on this address */ #define RTM_MISS 0x7 /* Lookup failed on this address */
#define RTM_LOCK 0x8 /* fix specified metrics */ #define RTM_LOCK 0x8 /* fix specified metrics */
#define RTM_RESOLVE 0xb /* request to resolve dst to LL addr */ #define RTM_RESOLVE 0xb /* request to resolve dst to LL addr - unused */
#define RTM_NEWADDR 0xc /* address being added to iface */ #define RTM_NEWADDR 0xc /* address being added to iface */
#define RTM_DELADDR 0xd /* address being removed from iface */ #define RTM_DELADDR 0xd /* address being removed from iface */
#define RTM_IFINFO 0xe /* iface going up/down etc. */ #define RTM_IFINFO 0xe /* iface going up/down etc. */
@ -308,7 +308,7 @@ Specifiers for which addresses are present in the messages are:
#define RTA_DST 0x1 /* destination sockaddr present */ #define RTA_DST 0x1 /* destination sockaddr present */
#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ #define RTA_GATEWAY 0x2 /* gateway sockaddr present */
#define RTA_NETMASK 0x4 /* netmask sockaddr present */ #define RTA_NETMASK 0x4 /* netmask sockaddr present */
#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ #define RTA_GENMASK 0x8 /* cloning mask sockaddr present - unused */
#define RTA_IFP 0x10 /* interface name sockaddr present */ #define RTA_IFP 0x10 /* interface name sockaddr present */
#define RTA_IFA 0x20 /* interface addr sockaddr present */ #define RTA_IFA 0x20 /* interface addr sockaddr present */
#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ #define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */

View File

@ -53,7 +53,9 @@ This call either reads or writes data from a file, depending on the value of
.Pp .Pp
The call may block. The call may block.
.Sh RETURN VALUES .Sh RETURN VALUES
Zero is returned on success, otherwise an error is returned. Always zero.
Errors should be signalled by setting BIO_ERROR on b_ioflags field in struct buf,
and setting b_error to the appropriate errno value.
.Sh SEE ALSO .Sh SEE ALSO
.\" .Xr buf 9 , .\" .Xr buf 9 ,
.Xr vnode 9 .Xr vnode 9

View File

@ -27,7 +27,8 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.Dd October 11, 2004 .\"
.Dd December 11, 2008
.Os .Os
.Dt RTALLOC 9 .Dt RTALLOC 9
.Sh NAME .Sh NAME
@ -64,21 +65,6 @@ certain protocol\- and interface-specific actions to take place.
.\" XXX - -mdoc should contain a standard request for getting em and .\" XXX - -mdoc should contain a standard request for getting em and
.\" en dashes. .\" en dashes.
.Pp .Pp
When a route with the flag
.Dv RTF_CLONING
is retrieved, and the action of this flag is not masked, the
.Nm
facility automatically generates a new route using information in the
old route as a template, and
sends an
.Dv RTM_RESOLVE
message to the appropriate interface-address route-management routine
.Pq Fn ifa->ifa_rtrequest .
This generated route is called
.Em cloned ,
and has
.Dv RTF_WASCLONED
flag set.
.Dv RTF_PRCLONING .Dv RTF_PRCLONING
flag is obsolete and thus ignored by facility. flag is obsolete and thus ignored by facility.
If the If the
@ -123,22 +109,19 @@ field.
.Pp .Pp
The The
.Fn rtalloc_ign .Fn rtalloc_ign
interface can be used when the default actions of interface can be used when the caller does not want to receive
.Fn rtalloc the returned
in the presence of the .Fa rtentry
.Dv RTF_CLONING locked.
flag is undesired.
The The
.Fa ro .Fa ro
argument is the same as argument is the same as
.Fn rtalloc , .Fn rtalloc ,
but there is additionally a but there is additionally a
.Fa flags .Fa flags
argument, which lists the flags in the route which are to be argument, which is now only used to pass
.Em ignored .Dv RTF_RNH_LOCKED
(in most cases this is indicating that the radix tree lock is already held.
.Dv RTF_CLONING
flag).
Both Both
.Fn rtalloc .Fn rtalloc
and and
@ -163,16 +146,7 @@ directly as the
argument. argument.
The second argument, The second argument,
.Fa report , .Fa report ,
controls whether controls whether the lower layers are notified when a lookup fails.
.Dv RTM_RESOLVE
requests are sent to the lower layers when an
.Dv RTF_CLONING
or
.Dv RTF_PRCLONING
route is cloned.
Ordinarily a value of one should be passed, except
in the processing of those lower layers which use the cloning
facility.
The third argument, The third argument,
.Fa flags , .Fa flags ,
is a set of flags to ignore, as in is a set of flags to ignore, as in

View File

@ -28,7 +28,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd October 7, 2004 .Dd December 11, 2008
.Os .Os
.Dt RTENTRY 9 .Dt RTENTRY 9
.Sh NAME .Sh NAME
@ -76,8 +76,11 @@ right (some protocols will put a link-layer address here), or some
intermediate stop on the way to that destination (if the intermediate stop on the way to that destination (if the
.Dv RTF_GATEWAY .Dv RTF_GATEWAY
flag is set). flag is set).
.It Vt "u_long rt_flags" ; .It Vt "int rt_flags" ;
See below. See below.
.It Vt "int rt_refcnt" ;
Route entries are reference-counted; this field indicates the number
of external (to the radix tree) references.
.It Vt "struct ifnet *rt_ifp" ; .It Vt "struct ifnet *rt_ifp" ;
.It Vt "struct ifaddr *rt_ifa" ; .It Vt "struct ifaddr *rt_ifa" ;
These two fields represent the These two fields represent the
@ -88,48 +91,18 @@ packet to the destination or set of destinations which this route
represents. represents.
.It Vt "struct rt_metrics_lite rt_rmx" ; .It Vt "struct rt_metrics_lite rt_rmx" ;
See below. See below.
.It Vt "long rt_refcnt" ;
Route entries are reference-counted; this field indicates the number
of external (to the radix tree) references.
If the If the
.Dv RTF_UP .Dv RTF_UP
flag is not present, the flag is not present, the
.Fn rtfree .Fn rtfree
function will delete the route from the radix tree when the last function will delete the route from the radix tree when the last
reference drops. reference drops.
.It Vt "struct sockaddr *rt_genmask" ;
When the
.Fn rtalloc
family of functions performs a cloning operation as requested by the
.Dv RTF_CLONING
flag, this field is used as the mask for the new route which is
inserted into the table.
If this field is a null pointer, then a host
route is generated.
.It Vt "caddr_t rt_llinfo" ;
When the
.Dv RTF_LLINFO
flag is set, this field contains information specific to the link
layer represented by the named interface address.
(It is normally managed by the
.Va rt_ifa->ifa_rtrequest
routine.)
Protocols such as
.Xr arp 4
use this field to reference per-destination state internal to that
protocol.
.It Vt "struct rtentry *rt_gwroute" ; .It Vt "struct rtentry *rt_gwroute" ;
This member is a reference to a route whose destination is This member is a reference to a route whose destination is
.Va rt_gateway . .Va rt_gateway .
It is only used for It is only used for
.Dv RTF_GATEWAY .Dv RTF_GATEWAY
routes. routes.
.It Vt "struct rtentry *rt_parent" ;
A reference to the route from which this route was cloned, or a null
pointer if this route was not generated by cloning.
See also the
.Dv RTF_WASCLONED
flag.
.It Vt "struct mtx rt_mtx" ; .It Vt "struct mtx rt_mtx" ;
Mutex to lock this routing entry. Mutex to lock this routing entry.
.El .El
@ -162,23 +135,12 @@ This route was modified by
Used only in the Used only in the
.Xr route 4 .Xr route 4
protocol, indicating that the request was executed. protocol, indicating that the request was executed.
.It Dv RTF_CLONING
When this route is returned as a result of a lookup, automatically
create a new route using this one as a template and
.Va rt_genmask
(if present) as a mask.
.It Dv RTF_XRESOLVE .It Dv RTF_XRESOLVE
When this route is returned as a result of a lookup, send a report on When this route is returned as a result of a lookup, send a report on
the the
.Xr route 4 .Xr route 4
interface requesting that an external process perform resolution for interface requesting that an external process perform resolution for
this route. this route.
(Used in conjunction with
.Dv RTF_CLONING . )
.It Dv RTF_LLINFO
Indicates that this route represents information being managed by a
link layer's adaptation layer (e.g.,
.Tn ARP ) .
.It Dv RTF_STATIC .It Dv RTF_STATIC
Indicates that this route was manually added by means of the Indicates that this route was manually added by means of the
.Xr route 8 .Xr route 8
@ -191,14 +153,6 @@ Requests that output sent via this route be discarded.
Protocol-specific. Protocol-specific.
.It Dv RTF_PRCLONING .It Dv RTF_PRCLONING
This flag is obsolete and simply ignored by facility. This flag is obsolete and simply ignored by facility.
.It Dv RTF_WASCLONED
Indicates that this route was generated as a result of cloning
requested by the
.Dv RTF_CLONING
flag.
When set, the
.Va rt_parent
field indicates the route from which this one was generated.
.It Dv RTF_PINNED .It Dv RTF_PINNED
(Reserved for future use to indicate routes which are not to be (Reserved for future use to indicate routes which are not to be
modified by a routing protocol.) modified by a routing protocol.)
@ -296,8 +250,3 @@ The
and and
.Va rmx_filler .Va rmx_filler
fields could be named better. fields could be named better.
.Pp
There is some disagreement over whether it is legitimate for
.Dv RTF_LLINFO
to be set by any process other than
.Va rt_ifa->ifa_rtrequest .

View File

@ -26,7 +26,7 @@
.\" From: @(#)style 1.14 (Berkeley) 4/28/95 .\" From: @(#)style 1.14 (Berkeley) 4/28/95
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd February 10, 2005 .Dd December 17, 2008
.Dt STYLE 9 .Dt STYLE 9
.Os .Os
.Sh NAME .Sh NAME
@ -602,11 +602,9 @@ Do YOU understand the following?
k = !(l & FLAGS); k = !(l & FLAGS);
.Ed .Ed
.Pp .Pp
Exits should be 0 on success, or according to the predefined Exits should be 0 on success, or 1 on failure.
values in
.Xr sysexits 3 .
.Bd -literal .Bd -literal
exit(EX_OK); /* exit(0); /*
* Avoid obvious comments such as * Avoid obvious comments such as
* "Exit 0 on success." * "Exit 0 on success."
*/ */
@ -806,7 +804,7 @@ placed in a single set of brackets.
.Ed .Ed
.Bd -literal .Bd -literal
(void)fprintf(stderr, "usage: f [-ab]\en"); (void)fprintf(stderr, "usage: f [-ab]\en");
exit(EX_USAGE); exit(1);
} }
.Ed .Ed
.Pp .Pp
@ -840,7 +838,6 @@ and produce minimal warnings.
.Xr indent 1 , .Xr indent 1 ,
.Xr lint 1 , .Xr lint 1 ,
.Xr err 3 , .Xr err 3 ,
.Xr sysexits 3 ,
.Xr warn 3 , .Xr warn 3 ,
.Xr style.Makefile 5 .Xr style.Makefile 5
.Sh HISTORY .Sh HISTORY

View File

@ -459,9 +459,9 @@ nmi_calltrap:
*/ */
movq %rsp,%rsi /* source stack pointer */ movq %rsp,%rsi /* source stack pointer */
movq $TF_SIZE,%rcx movq $TF_SIZE,%rcx
movq PCPU(RSP0),%rbx movq PCPU(RSP0),%rdx
subq %rcx,%rbx subq %rcx,%rdx
movq %rbx,%rdi /* destination stack pointer */ movq %rdx,%rdi /* destination stack pointer */
shrq $3,%rcx /* trap frame size in long words */ shrq $3,%rcx /* trap frame size in long words */
cld cld
@ -470,7 +470,7 @@ nmi_calltrap:
movl %ss,%eax movl %ss,%eax
pushq %rax /* tf_ss */ pushq %rax /* tf_ss */
pushq %rbx /* tf_rsp (on kernel stack) */ pushq %rdx /* tf_rsp (on kernel stack) */
pushfq /* tf_rflags */ pushfq /* tf_rflags */
movl %cs,%eax movl %cs,%eax
pushq %rax /* tf_cs */ pushq %rax /* tf_cs */
@ -480,16 +480,20 @@ outofnmi:
/* /*
* At this point the processor has exited NMI mode and is running * At this point the processor has exited NMI mode and is running
* with interrupts turned off on the normal kernel stack. * with interrupts turned off on the normal kernel stack.
* We turn interrupts back on, and take the usual 'doreti' exit
* path.
* *
* If a pending NMI gets recognized at or after this point, it * If a pending NMI gets recognized at or after this point, it
* will cause a kernel callchain to be traced. Since this path * will cause a kernel callchain to be traced.
* is only taken for NMI interrupts from user space, our `swapgs' *
* state is correct for taking the doreti path. * We turn interrupts back on, and call the user callchain capture hook.
*/ */
movq pmc_hook,%rax
orq %rax,%rax
jz nocallchain
movq PCPU(CURTHREAD),%rdi /* thread */
movq $PMC_FN_USER_CALLCHAIN,%rsi /* command */
movq %rsp,%rdx /* frame */
sti sti
jmp doreti call *%rax
nocallchain: nocallchain:
#endif #endif
testl %ebx,%ebx testl %ebx,%ebx

View File

@ -322,15 +322,15 @@ printcpuinfo(void)
"\003SVM" /* Secure Virtual Mode */ "\003SVM" /* Secure Virtual Mode */
"\004ExtAPIC" /* Extended APIC register */ "\004ExtAPIC" /* Extended APIC register */
"\005CR8" /* CR8 in legacy mode */ "\005CR8" /* CR8 in legacy mode */
"\006<b5>" "\006ABM" /* LZCNT instruction */
"\007<b6>" "\007SSE4A" /* SSE4A */
"\010<b7>" "\010MAS" /* Misaligned SSE mode */
"\011Prefetch" /* 3DNow! Prefetch/PrefetchW */ "\011Prefetch" /* 3DNow! Prefetch/PrefetchW */
"\012<b9>" "\012OSVW" /* OS visible workaround */
"\013<b10>" "\013IBS" /* Instruction based sampling */
"\014<b11>" "\014SSE5" /* SSE5 */
"\015<b12>" "\015SKINIT" /* SKINIT/STGI */
"\016<b13>" "\016WDT" /* Watchdog timer */
"\017<b14>" "\017<b14>"
"\020<b15>" "\020<b15>"
"\021<b16>" "\021<b16>"

View File

@ -16,5 +16,5 @@ device io # I/O device
device uart_ns8250 device uart_ns8250
# Default partitioning schemes # Default partitioning schemes
options GEOM_BSD options GEOM_PART_BSD
options GEOM_MBR options GEOM_PART_MBR

View File

@ -81,18 +81,6 @@ __ElfType(Auxinfo);
#define AT_BASE 7 /* Interpreter's base address. */ #define AT_BASE 7 /* Interpreter's base address. */
#define AT_FLAGS 8 /* Flags (unused for i386). */ #define AT_FLAGS 8 /* Flags (unused for i386). */
#define AT_ENTRY 9 /* Where interpreter should transfer control. */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */
/*
* The following non-standard values are used for passing information
* from John Polstra's testbed program to the dynamic linker. These
* are expected to go away soon.
*
* Unfortunately, these overlap the Linux non-standard values, so they
* must not be used in the same context.
*/
#define AT_BRK 10 /* Starting point for sbrk and brk. */
#define AT_DEBUG 11 /* Debugging level. */
/* /*
* The following non-standard values are used in Linux ELF binaries. * The following non-standard values are used in Linux ELF binaries.
*/ */

View File

@ -150,7 +150,15 @@
#define AMDID2_SVM 0x00000004 #define AMDID2_SVM 0x00000004
#define AMDID2_EXT_APIC 0x00000008 #define AMDID2_EXT_APIC 0x00000008
#define AMDID2_CR8 0x00000010 #define AMDID2_CR8 0x00000010
#define AMDID2_ABM 0x00000020
#define AMDID2_SSE4A 0x00000040
#define AMDID2_MAS 0x00000080
#define AMDID2_PREFETCH 0x00000100 #define AMDID2_PREFETCH 0x00000100
#define AMDID2_OSVW 0x00000200
#define AMDID2_IBS 0x00000400
#define AMDID2_SSE5 0x00000800
#define AMDID2_SKINIT 0x00001000
#define AMDID2_WDT 0x00002000
/* /*
* CPUID instruction 1 eax info * CPUID instruction 1 eax info

View File

@ -254,8 +254,6 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp)
args = (Elf32_Auxargs *)imgp->auxargs; args = (Elf32_Auxargs *)imgp->auxargs;
pos = base + (imgp->args->argc + imgp->args->envc + 2); pos = base + (imgp->args->argc + imgp->args->envc + 2);
if (args->trace)
AUXARGS_ENTRY_32(pos, AT_DEBUG, 1);
if (args->execfd != -1) if (args->execfd != -1)
AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY_32(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY_32(pos, AT_PHDR, args->phdr);

View File

@ -7,5 +7,5 @@ machine arm
device mem device mem
options GEOM_BSD options GEOM_PART_BSD
options GEOM_MBR options GEOM_PART_MBR

View File

@ -57,7 +57,6 @@ options SYSVSEM #SYSV-style semaphores
options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
options KBD_INSTALL_CDEV # install a CDEV entry in /dev options KBD_INSTALL_CDEV # install a CDEV entry in /dev
options GEOM_PART_GPT # GUID Partition Tables. options GEOM_PART_GPT # GUID Partition Tables.
options GEOM_MBR # DOS/MBR partitioning
options GEOM_LABEL # Providers labelization. options GEOM_LABEL # Providers labelization.
options BOOTP options BOOTP

View File

@ -70,10 +70,6 @@ __ElfType(Auxinfo);
#define AT_BASE 7 /* Interpreter's base address. */ #define AT_BASE 7 /* Interpreter's base address. */
#define AT_FLAGS 8 /* Flags (unused). */ #define AT_FLAGS 8 /* Flags (unused). */
#define AT_ENTRY 9 /* Where interpreter should transfer control. */ #define AT_ENTRY 9 /* Where interpreter should transfer control. */
#define AT_BRK 10 /* Starting point for sbrk and brk. */
#define AT_DEBUG 11 /* Debugging level. */
#define AT_NOTELF 10 /* Program is not ELF ?? */ #define AT_NOTELF 10 /* Program is not ELF ?? */
#define AT_UID 11 /* Real uid. */ #define AT_UID 11 /* Real uid. */
#define AT_EUID 12 /* Effective uid. */ #define AT_EUID 12 /* Effective uid. */

View File

@ -12,7 +12,7 @@ SUBDIR+= ficl
.endif .endif
# Build EFI library. # Build EFI library.
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "ia64" .if ${MACHINE_ARCH} == "amd64" || ${MACHINE} == "i386" || ${MACHINE_ARCH} == "ia64"
SUBDIR+= efi SUBDIR+= efi
.endif .endif

View File

@ -60,7 +60,7 @@ gptzfsboot.bin: gptzfsboot.out
objcopy -S -O binary gptzfsboot.out ${.TARGET} objcopy -S -O binary gptzfsboot.out ${.TARGET}
gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o gptzfsboot.out: ${BTXCRT} zfsboot.o sio.o
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c zfsboot.o: ${.CURDIR}/../../zfs/zfsimpl.c

View File

@ -80,7 +80,7 @@ zfsboot.bin: zfsboot.out
objcopy -S -O binary zfsboot.out ${.TARGET} objcopy -S -O binary zfsboot.out ${.TARGET}
zfsboot.out: ${BTXCRT} zfsboot.o sio.o zfsboot.out: ${BTXCRT} zfsboot.o sio.o
${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
zfsboot.o: zfsboot.s zfsboot.o: zfsboot.s

View File

@ -94,8 +94,8 @@ struct netif_driver *netif_drivers[] = {
*/ */
struct file_format *file_formats[] = { struct file_format *file_formats[] = {
&uboot_elf, &uboot_elf,
NULL NULL
}; };
/* /*
@ -104,6 +104,6 @@ struct file_format *file_formats[] = {
extern struct console uboot_console; extern struct console uboot_console;
struct console *consoles[] = { struct console *consoles[] = {
&uboot_console, &uboot_console,
NULL NULL
}; };

View File

@ -216,6 +216,7 @@ COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
static int static int
command_reboot(int argc, char *argv[]) command_reboot(int argc, char *argv[])
{ {
printf("Resetting...\n"); printf("Resetting...\n");
ub_reset(); ub_reset();

View File

@ -35,7 +35,8 @@ __FBSDID("$FreeBSD$");
#include "bootstrap.h" #include "bootstrap.h"
#include "libuboot.h" #include "libuboot.h"
static int uboot_parsedev(struct uboot_devdesc **dev, const char *devspec, const char **path); static int uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
const char **path);
/* /*
* Point (dev) at an allocated device specifier for the device matching the * Point (dev) at an allocated device specifier for the device matching the
@ -178,11 +179,11 @@ uboot_parsedev(struct uboot_devdesc **dev, const char *devspec,
} else { } else {
*dev = idev; *dev = idev;
} }
return(0); return (0);
fail: fail:
free(idev); free(idev);
return(err); return (err);
} }
@ -191,7 +192,7 @@ uboot_fmtdev(void *vdev)
{ {
struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev; struct uboot_devdesc *dev = (struct uboot_devdesc *)vdev;
char *cp; char *cp;
static char buf[128]; /* XXX device length constant? */ static char buf[128];
switch(dev->d_type) { switch(dev->d_type) {
case DEVT_NONE: case DEVT_NONE:
@ -220,12 +221,12 @@ uboot_fmtdev(void *vdev)
int int
uboot_setcurrdev(struct env_var *ev, int flags, const void *value) uboot_setcurrdev(struct env_var *ev, int flags, const void *value)
{ {
struct uboot_devdesc *ncurr; struct uboot_devdesc *ncurr;
int rv; int rv;
if ((rv = uboot_parsedev(&ncurr, value, NULL)) != 0) if ((rv = uboot_parsedev(&ncurr, value, NULL)) != 0)
return(rv); return (rv);
free(ncurr); free(ncurr);
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
return(0); return (0);
} }

View File

@ -873,17 +873,12 @@ dnode_read(spa_t *spa, const dnode_phys_t *dnode, off_t offset, void *buf, size_
int i, rc; int i, rc;
/* /*
* We truncate the offset to 32bits, mainly so that I don't * Note: bsize may not be a power of two here so we need to do an
* have to find a copy of __divdi3 to put into the bootstrap. * actual divide rather than a bitshift.
* I don't think the bootstrap needs to access anything bigger
* than 2G anyway. Note that block addresses are still 64bit
* so it doesn't affect the possible size of the media.
* We still use 64bit block numbers so that the bitshifts
* work correctly. Note: bsize may not be a power of two here.
*/ */
while (buflen > 0) { while (buflen > 0) {
uint64_t bn = ((int) offset) / bsize; uint64_t bn = offset / bsize;
int boff = ((int) offset) % bsize; int boff = offset % bsize;
int ibn; int ibn;
const blkptr_t *indbp; const blkptr_t *indbp;
blkptr_t bp; blkptr_t bp;

View File

@ -290,7 +290,7 @@ cam_periph_acquire(struct cam_periph *periph)
} }
void void
cam_periph_release(struct cam_periph *periph) cam_periph_release_locked(struct cam_periph *periph)
{ {
if (periph == NULL) if (periph == NULL)
@ -302,7 +302,21 @@ cam_periph_release(struct cam_periph *periph)
camperiphfree(periph); camperiphfree(periph);
} }
xpt_unlock_buses(); xpt_unlock_buses();
}
void
cam_periph_release(struct cam_periph *periph)
{
struct cam_sim *sim;
if (periph == NULL)
return;
sim = periph->sim;
mtx_assert(sim->mtx, MA_NOTOWNED);
mtx_lock(sim->mtx);
cam_periph_release_locked(periph);
mtx_unlock(sim->mtx);
} }
int int
@ -311,8 +325,6 @@ cam_periph_hold(struct cam_periph *periph, int priority)
struct mtx *mtx; struct mtx *mtx;
int error; int error;
mtx_assert(periph->sim->mtx, MA_OWNED);
/* /*
* Increment the reference count on the peripheral * Increment the reference count on the peripheral
* while we wait for our lock attempt to succeed * while we wait for our lock attempt to succeed
@ -324,13 +336,14 @@ cam_periph_hold(struct cam_periph *periph, int priority)
return (ENXIO); return (ENXIO);
mtx = periph->sim->mtx; mtx = periph->sim->mtx;
mtx_assert(mtx, MA_OWNED);
if (mtx == &Giant) if (mtx == &Giant)
mtx = NULL; mtx = NULL;
while ((periph->flags & CAM_PERIPH_LOCKED) != 0) { while ((periph->flags & CAM_PERIPH_LOCKED) != 0) {
periph->flags |= CAM_PERIPH_LOCK_WANTED; periph->flags |= CAM_PERIPH_LOCK_WANTED;
if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) { if ((error = msleep(periph, mtx, priority, "caplck", 0)) != 0) {
cam_periph_release(periph); cam_periph_release_locked(periph);
return (error); return (error);
} }
} }
@ -351,7 +364,7 @@ cam_periph_unhold(struct cam_periph *periph)
wakeup(periph); wakeup(periph);
} }
cam_periph_release(periph); cam_periph_release_locked(periph);
} }
/* /*

View File

@ -141,6 +141,7 @@ cam_status cam_periph_alloc(periph_ctor_t *periph_ctor,
struct cam_periph *cam_periph_find(struct cam_path *path, char *name); struct cam_periph *cam_periph_find(struct cam_path *path, char *name);
cam_status cam_periph_acquire(struct cam_periph *periph); cam_status cam_periph_acquire(struct cam_periph *periph);
void cam_periph_release(struct cam_periph *periph); void cam_periph_release(struct cam_periph *periph);
void cam_periph_release_locked(struct cam_periph *periph);
int cam_periph_hold(struct cam_periph *periph, int priority); int cam_periph_hold(struct cam_periph *periph, int priority);
void cam_periph_unhold(struct cam_periph *periph); void cam_periph_unhold(struct cam_periph *periph);
void cam_periph_invalidate(struct cam_periph *periph); void cam_periph_invalidate(struct cam_periph *periph);

View File

@ -84,6 +84,7 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll,
sim->max_tagged_dev_openings = max_tagged_dev_transactions; sim->max_tagged_dev_openings = max_tagged_dev_transactions;
sim->max_dev_openings = max_dev_transactions; sim->max_dev_openings = max_dev_transactions;
sim->flags = 0; sim->flags = 0;
sim->refcount = 1;
sim->devq = queue; sim->devq = queue;
sim->mtx = mtx; sim->mtx = mtx;
if (mtx == &Giant) { if (mtx == &Giant) {
@ -103,11 +104,41 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll,
void void
cam_sim_free(struct cam_sim *sim, int free_devq) cam_sim_free(struct cam_sim *sim, int free_devq)
{ {
int error;
sim->refcount--;
if (sim->refcount > 0) {
error = msleep(sim, sim->mtx, PRIBIO, "simfree", 0);
KASSERT(error == 0, ("invalid error value for msleep(9)"));
}
KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
if (free_devq) if (free_devq)
cam_simq_free(sim->devq); cam_simq_free(sim->devq);
free(sim, M_CAMSIM); free(sim, M_CAMSIM);
} }
void
cam_sim_release(struct cam_sim *sim)
{
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
mtx_assert(sim->mtx, MA_OWNED);
sim->refcount--;
if (sim->refcount == 0)
wakeup(sim);
}
void
cam_sim_hold(struct cam_sim *sim)
{
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
mtx_assert(sim->mtx, MA_OWNED);
sim->refcount++;
}
void void
cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id) cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id)
{ {

View File

@ -61,6 +61,8 @@ struct cam_sim * cam_sim_alloc(sim_action_func sim_action,
int max_tagged_dev_transactions, int max_tagged_dev_transactions,
struct cam_devq *queue); struct cam_devq *queue);
void cam_sim_free(struct cam_sim *sim, int free_devq); void cam_sim_free(struct cam_sim *sim, int free_devq);
void cam_sim_hold(struct cam_sim *sim);
void cam_sim_release(struct cam_sim *sim);
/* Optional sim attributes may be set with these. */ /* Optional sim attributes may be set with these. */
void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id); void cam_sim_set_path(struct cam_sim *sim, u_int32_t path_id);
@ -105,6 +107,7 @@ struct cam_sim {
#define CAM_SIM_ON_DONEQ 0x04 #define CAM_SIM_ON_DONEQ 0x04
struct callout callout; struct callout callout;
struct cam_devq *devq; /* Device Queue to use for this SIM */ struct cam_devq *devq; /* Device Queue to use for this SIM */
int refcount; /* References to the SIM. */
/* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */ /* "Pool" of inactive ccbs managed by xpt_alloc_ccb and xpt_free_ccb */
SLIST_HEAD(,ccb_hdr) ccb_freeq; SLIST_HEAD(,ccb_hdr) ccb_freeq;

View File

@ -698,19 +698,6 @@ static struct cdevsw xpt_cdevsw = {
}; };
static void dead_sim_action(struct cam_sim *sim, union ccb *ccb);
static void dead_sim_poll(struct cam_sim *sim);
/* Dummy SIM that is used when the real one has gone. */
static struct cam_sim cam_dead_sim = {
.sim_action = dead_sim_action,
.sim_poll = dead_sim_poll,
.sim_name = "dead_sim",
};
#define SIM_DEAD(sim) ((sim) == &cam_dead_sim)
/* Storage for debugging datastructures */ /* Storage for debugging datastructures */
#ifdef CAMDEBUG #ifdef CAMDEBUG
struct cam_path *cam_dpath; struct cam_path *cam_dpath;
@ -3023,19 +3010,10 @@ xpt_action(union ccb *start_ccb)
case XPT_ENG_EXEC: case XPT_ENG_EXEC:
{ {
struct cam_path *path; struct cam_path *path;
struct cam_sim *sim;
int runq; int runq;
path = start_ccb->ccb_h.path; path = start_ccb->ccb_h.path;
sim = path->bus->sim;
if (SIM_DEAD(sim)) {
/* The SIM has gone; just execute the CCB directly. */
cam_ccbq_send_ccb(&path->device->ccbq, start_ccb);
(*(sim->sim_action))(sim, start_ccb);
break;
}
cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb); cam_ccbq_insert_ccb(&path->device->ccbq, start_ccb);
if (path->device->qfrozen_cnt == 0) if (path->device->qfrozen_cnt == 0)
runq = xpt_schedule_dev_sendq(path->bus, path->device); runq = xpt_schedule_dev_sendq(path->bus, path->device);
@ -3623,7 +3601,6 @@ void
xpt_schedule(struct cam_periph *perph, u_int32_t new_priority) xpt_schedule(struct cam_periph *perph, u_int32_t new_priority)
{ {
struct cam_ed *device; struct cam_ed *device;
union ccb *work_ccb;
int runq; int runq;
mtx_assert(perph->sim->mtx, MA_OWNED); mtx_assert(perph->sim->mtx, MA_OWNED);
@ -3640,15 +3617,6 @@ xpt_schedule(struct cam_periph *perph, u_int32_t new_priority)
new_priority); new_priority);
} }
runq = 0; runq = 0;
} else if (SIM_DEAD(perph->path->bus->sim)) {
/* The SIM is gone so just call periph_start directly. */
work_ccb = xpt_get_ccb(perph->path->device);
if (work_ccb == NULL)
return; /* XXX */
xpt_setup_ccb(&work_ccb->ccb_h, perph->path, new_priority);
perph->pinfo.priority = new_priority;
perph->periph_start(perph, work_ccb);
return;
} else { } else {
/* New entry on the queue */ /* New entry on the queue */
CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE, CAM_DEBUG(perph->path, CAM_DEBUG_SUBTRACE,
@ -4336,6 +4304,7 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus)
TAILQ_INIT(&new_bus->et_entries); TAILQ_INIT(&new_bus->et_entries);
new_bus->path_id = sim->path_id; new_bus->path_id = sim->path_id;
cam_sim_hold(sim);
new_bus->sim = sim; new_bus->sim = sim;
timevalclear(&new_bus->last_reset); timevalclear(&new_bus->last_reset);
new_bus->flags = 0; new_bus->flags = 0;
@ -4372,15 +4341,8 @@ int32_t
xpt_bus_deregister(path_id_t pathid) xpt_bus_deregister(path_id_t pathid)
{ {
struct cam_path bus_path; struct cam_path bus_path;
struct cam_ed *device;
struct cam_ed_qinfo *qinfo;
struct cam_devq *devq;
struct cam_periph *periph;
struct cam_sim *ccbsim;
union ccb *work_ccb;
cam_status status; cam_status status;
status = xpt_compile_path(&bus_path, NULL, pathid, status = xpt_compile_path(&bus_path, NULL, pathid,
CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD);
if (status != CAM_REQ_CMP) if (status != CAM_REQ_CMP)
@ -4389,42 +4351,6 @@ xpt_bus_deregister(path_id_t pathid)
xpt_async(AC_LOST_DEVICE, &bus_path, NULL); xpt_async(AC_LOST_DEVICE, &bus_path, NULL);
xpt_async(AC_PATH_DEREGISTERED, &bus_path, NULL); xpt_async(AC_PATH_DEREGISTERED, &bus_path, NULL);
/* The SIM may be gone, so use a dummy SIM for any stray operations. */
devq = bus_path.bus->sim->devq;
ccbsim = bus_path.bus->sim;
bus_path.bus->sim = &cam_dead_sim;
/* Execute any pending operations now. */
while ((qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->send_queue,
CAMQ_HEAD)) != NULL ||
(qinfo = (struct cam_ed_qinfo *)camq_remove(&devq->alloc_queue,
CAMQ_HEAD)) != NULL) {
do {
device = qinfo->device;
work_ccb = cam_ccbq_peek_ccb(&device->ccbq, CAMQ_HEAD);
if (work_ccb != NULL) {
devq->active_dev = device;
cam_ccbq_remove_ccb(&device->ccbq, work_ccb);
cam_ccbq_send_ccb(&device->ccbq, work_ccb);
(*(ccbsim->sim_action))(ccbsim, work_ccb);
}
periph = (struct cam_periph *)camq_remove(&device->drvq,
CAMQ_HEAD);
if (periph != NULL)
xpt_schedule(periph, periph->pinfo.priority);
} while (work_ccb != NULL || periph != NULL);
}
/* Make sure all completed CCBs are processed. */
while (!TAILQ_EMPTY(&ccbsim->sim_doneq)) {
camisr_runqueue(&ccbsim->sim_doneq);
/* Repeat the async's for the benefit of any new devices. */
xpt_async(AC_LOST_DEVICE, &bus_path, NULL);
xpt_async(AC_PATH_DEREGISTERED, &bus_path, NULL);
}
/* Release the reference count held while registered. */ /* Release the reference count held while registered. */
xpt_release_bus(bus_path.bus); xpt_release_bus(bus_path.bus);
xpt_release_path(&bus_path); xpt_release_path(&bus_path);
@ -4921,6 +4847,7 @@ xpt_release_bus(struct cam_eb *bus)
TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links); TAILQ_REMOVE(&xsoftc.xpt_busses, bus, links);
xsoftc.bus_generation++; xsoftc.bus_generation++;
mtx_unlock(&xsoftc.xpt_topo_lock); mtx_unlock(&xsoftc.xpt_topo_lock);
cam_sim_release(bus->sim);
free(bus, M_CAMXPT); free(bus, M_CAMXPT);
} }
} }
@ -4982,9 +4909,6 @@ xpt_alloc_device(struct cam_eb *bus, struct cam_et *target, lun_id_t lun_id)
struct cam_devq *devq; struct cam_devq *devq;
cam_status status; cam_status status;
if (SIM_DEAD(bus->sim))
return (NULL);
/* Make space for us in the device queue on our bus */ /* Make space for us in the device queue on our bus */
devq = bus->sim->devq; devq = bus->sim->devq;
status = cam_devq_resize(devq, devq->alloc_queue.array_size + 1); status = cam_devq_resize(devq, devq->alloc_queue.array_size + 1);
@ -5094,11 +5018,9 @@ xpt_release_device(struct cam_eb *bus, struct cam_et *target,
TAILQ_REMOVE(&target->ed_entries, device,links); TAILQ_REMOVE(&target->ed_entries, device,links);
target->generation++; target->generation++;
bus->sim->max_ccbs -= device->ccbq.devq_openings; bus->sim->max_ccbs -= device->ccbq.devq_openings;
if (!SIM_DEAD(bus->sim)) { /* Release our slot in the devq */
/* Release our slot in the devq */ devq = bus->sim->devq;
devq = bus->sim->devq; cam_devq_resize(devq, devq->alloc_queue.array_size - 1);
cam_devq_resize(devq, devq->alloc_queue.array_size - 1);
}
camq_fini(&device->drvq); camq_fini(&device->drvq);
camq_fini(&device->ccbq.queue); camq_fini(&device->ccbq.queue);
free(device, M_CAMXPT); free(device, M_CAMXPT);
@ -6392,7 +6314,7 @@ probedone(struct cam_periph *periph, union ccb *done_ccb)
xpt_done(done_ccb); xpt_done(done_ccb);
if (TAILQ_FIRST(&softc->request_ccbs) == NULL) { if (TAILQ_FIRST(&softc->request_ccbs) == NULL) {
cam_periph_invalidate(periph); cam_periph_invalidate(periph);
cam_periph_release(periph); cam_periph_release_locked(periph);
} else { } else {
probeschedule(periph); probeschedule(periph);
} }
@ -7269,11 +7191,8 @@ camisr_runqueue(void *V_queue)
dev = ccb_h->path->device; dev = ccb_h->path->device;
cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h); cam_ccbq_ccb_done(&dev->ccbq, (union ccb *)ccb_h);
ccb_h->path->bus->sim->devq->send_active--;
if (!SIM_DEAD(ccb_h->path->bus->sim)) { ccb_h->path->bus->sim->devq->send_openings++;
ccb_h->path->bus->sim->devq->send_active--;
ccb_h->path->bus->sim->devq->send_openings++;
}
if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0 if (((dev->flags & CAM_DEV_REL_ON_COMPLETE) != 0
&& (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ) && (ccb_h->status&CAM_STATUS_MASK) != CAM_REQUEUE_REQ)
@ -7317,15 +7236,3 @@ camisr_runqueue(void *V_queue)
} }
} }
static void
dead_sim_action(struct cam_sim *sim, union ccb *ccb)
{
ccb->ccb_h.status = CAM_DEV_NOT_THERE;
xpt_done(ccb);
}
static void
dead_sim_poll(struct cam_sim *sim)
{
}

View File

@ -772,8 +772,8 @@ daclose(struct disk *dp)
softc->flags &= ~DA_FLAG_OPEN; softc->flags &= ~DA_FLAG_OPEN;
cam_periph_unhold(periph); cam_periph_unhold(periph);
cam_periph_release(periph);
cam_periph_unlock(periph); cam_periph_unlock(periph);
cam_periph_release(periph);
return (0); return (0);
} }

View File

@ -218,8 +218,6 @@ svr4_fixup(register_t **stack_base, struct image_params *imgp)
args = (Elf32_Auxargs *)imgp->auxargs; args = (Elf32_Auxargs *)imgp->auxargs;
pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2);
if (args->trace)
AUXARGS_ENTRY(pos, AT_DEBUG, 1);
if (args->execfd != -1) if (args->execfd != -1)
AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd); AUXARGS_ENTRY(pos, AT_EXECFD, args->execfd);
AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr);

View File

@ -1958,7 +1958,7 @@ device fatm #Fore PCA200E
device hatm #Fore/Marconi HE155/622 device hatm #Fore/Marconi HE155/622
device patm #IDT77252 cards (ProATM and IDT) device patm #IDT77252 cards (ProATM and IDT)
device utopia #ATM PHY driver device utopia #ATM PHY driver
options NATM #native ATM #options NATM #native ATM
options LIBMBPOOL #needed by patm, iatm options LIBMBPOOL #needed by patm, iatm

View File

@ -2173,6 +2173,7 @@ net/if_gre.c optional gre
net/if_iso88025subr.c optional token net/if_iso88025subr.c optional token
net/if_lagg.c optional lagg net/if_lagg.c optional lagg
net/if_loop.c optional loop net/if_loop.c optional loop
net/if_llatbl.c standard
net/if_media.c standard net/if_media.c standard
net/if_mib.c standard net/if_mib.c standard
net/if_ppp.c optional ppp net/if_ppp.c optional ppp

View File

@ -30,9 +30,11 @@ dev/kbd/kbd.c optional sc
dev/ofw/openfirm.c optional aim dev/ofw/openfirm.c optional aim
dev/ofw/openfirmio.c optional aim dev/ofw/openfirmio.c optional aim
dev/ofw/ofw_bus_if.m optional aim dev/ofw/ofw_bus_if.m optional aim
dev/ofw/ofw_if.m optional aim
dev/ofw/ofw_bus_subr.c optional aim dev/ofw/ofw_bus_subr.c optional aim
dev/ofw/ofw_console.c optional aim dev/ofw/ofw_console.c optional aim
dev/ofw/ofw_disk.c optional ofwd aim dev/ofw/ofw_disk.c optional ofwd aim
dev/ofw/ofw_standard.c optional aim
dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac dev/powermac_nvram/powermac_nvram.c optional powermac_nvram powermac
dev/quicc/quicc_bfe_ocp.c optional quicc mpc85xx dev/quicc/quicc_bfe_ocp.c optional quicc mpc85xx
dev/scc/scc_bfe_macio.c optional scc powermac dev/scc/scc_bfe_macio.c optional scc powermac

View File

@ -42,8 +42,10 @@ dev/kbd/kbd.c optional atkbd | sc | ukbd
dev/le/if_le_lebuffer.c optional le sbus dev/le/if_le_lebuffer.c optional le sbus
dev/le/if_le_ledma.c optional le sbus dev/le/if_le_ledma.c optional le sbus
dev/le/lebuffer_sbus.c optional le sbus dev/le/lebuffer_sbus.c optional le sbus
dev/ofw/ofw_if.m standard
dev/ofw/ofw_bus_if.m standard dev/ofw/ofw_bus_if.m standard
dev/ofw/ofw_bus_subr.c standard dev/ofw/ofw_bus_subr.c standard
dev/ofw/ofw_standard.c standard
dev/ofw/ofw_console.c optional ofw_console dev/ofw/ofw_console.c optional ofw_console
dev/ofw/openfirm.c standard dev/ofw/openfirm.c standard
dev/ofw/openfirmio.c standard dev/ofw/openfirmio.c standard
@ -111,7 +113,6 @@ sparc64/sparc64/mp_exception.S optional smp \
sparc64/sparc64/mp_locore.S optional smp sparc64/sparc64/mp_locore.S optional smp
sparc64/sparc64/mp_machdep.c optional smp sparc64/sparc64/mp_machdep.c optional smp
sparc64/sparc64/nexus.c standard sparc64/sparc64/nexus.c standard
sparc64/sparc64/ofw_bus.c standard
sparc64/sparc64/ofw_machdep.c standard sparc64/sparc64/ofw_machdep.c standard
sparc64/sparc64/pmap.c standard sparc64/sparc64/pmap.c standard
sparc64/sparc64/prof_machdep.c optional profiling-routine sparc64/sparc64/prof_machdep.c optional profiling-routine

View File

@ -21,8 +21,10 @@ ukbdmap.h optional ukbd_dflt_keymap \
crypto/blowfish/bf_enc.c optional crypto | ipsec crypto/blowfish/bf_enc.c optional crypto | ipsec
crypto/des/des_enc.c optional crypto | ipsec | netsmb crypto/des/des_enc.c optional crypto | ipsec | netsmb
dev/ofw/ofw_bus_if.m standard dev/ofw/ofw_bus_if.m standard
dev/ofw/ofw_if.m standard
dev/ofw/ofw_bus_subr.c standard dev/ofw/ofw_bus_subr.c standard
dev/ofw/ofw_console.c optional ofw_console dev/ofw/ofw_console.c optional ofw_console
dev/ofw/ofw_standard.c standard
dev/ofw/openfirm.c standard dev/ofw/openfirm.c standard
dev/ofw/openfirmio.c standard dev/ofw/openfirmio.c standard
dev/ofw/openpromio.c standard dev/ofw/openpromio.c standard
@ -65,7 +67,6 @@ sun4v/sun4v/mp_locore.S optional smp
sun4v/sun4v/mp_machdep.c optional smp sun4v/sun4v/mp_machdep.c optional smp
sun4v/sun4v/nexus.c standard sun4v/sun4v/nexus.c standard
sun4v/cddl/t1_copy.S standard sun4v/cddl/t1_copy.S standard
sparc64/sparc64/ofw_bus.c standard
sparc64/sparc64/ofw_machdep.c standard sparc64/sparc64/ofw_machdep.c standard
sun4v/sun4v/pmap.c standard sun4v/sun4v/pmap.c standard
sparc64/sparc64/prof_machdep.c optional profiling-routine sparc64/sparc64/prof_machdep.c optional profiling-routine

View File

@ -3162,7 +3162,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer)
#ifdef RTF_PRCLONING #ifdef RTF_PRCLONING
rtalloc_ign(&ro, (RTF_CLONING | RTF_PRCLONING)); rtalloc_ign(&ro, (RTF_CLONING | RTF_PRCLONING));
#else /* !RTF_PRCLONING */ #else /* !RTF_PRCLONING */
in_rtalloc_ign(&ro, RTF_CLONING, 0); in_rtalloc_ign(&ro, 0, 0);
#endif #endif
#else /* ! __FreeBSD__ */ #else /* ! __FreeBSD__ */
rtalloc_noclone(&ro, NO_CLONING); rtalloc_noclone(&ro, NO_CLONING);
@ -3183,7 +3183,7 @@ pf_calc_mss(struct pf_addr *addr, sa_family_t af, u_int16_t offer)
rtalloc_ign((struct route *)&ro6, rtalloc_ign((struct route *)&ro6,
(RTF_CLONING | RTF_PRCLONING)); (RTF_CLONING | RTF_PRCLONING));
#else /* !RTF_PRCLONING */ #else /* !RTF_PRCLONING */
rtalloc_ign((struct route *)&ro6, RTF_CLONING); rtalloc_ign((struct route *)&ro6, 0);
#endif #endif
#else /* ! __FreeBSD__ */ #else /* ! __FreeBSD__ */
rtalloc_noclone((struct route *)&ro6, NO_CLONING); rtalloc_noclone((struct route *)&ro6, NO_CLONING);
@ -5986,9 +5986,9 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif)
#ifdef __FreeBSD__ #ifdef __FreeBSD__
/* XXX MRT not always INET */ /* stick with table 0 though */ /* XXX MRT not always INET */ /* stick with table 0 though */
if (af == AF_INET) if (af == AF_INET)
in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); in_rtalloc_ign((struct route *)&ro, 0, 0);
else else
rtalloc_ign((struct route *)&ro, RTF_CLONING); rtalloc_ign((struct route *)&ro, 0);
#else /* ! __FreeBSD__ */ #else /* ! __FreeBSD__ */
rtalloc_noclone((struct route *)&ro, NO_CLONING); rtalloc_noclone((struct route *)&ro, NO_CLONING);
#endif #endif
@ -6068,9 +6068,9 @@ pf_rtlabel_match(struct pf_addr *addr, sa_family_t af, struct pf_addr_wrap *aw)
rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING)); rtalloc_ign((struct route *)&ro, (RTF_CLONING|RTF_PRCLONING));
# else /* !RTF_PRCLONING */ # else /* !RTF_PRCLONING */
if (af == AF_INET) if (af == AF_INET)
in_rtalloc_ign((struct route *)&ro, RTF_CLONING, 0); in_rtalloc_ign((struct route *)&ro, 0, 0);
else else
rtalloc_ign((struct route *)&ro, RTF_CLONING); rtalloc_ign((struct route *)&ro, 0);
# endif # endif
#else /* ! __FreeBSD__ */ #else /* ! __FreeBSD__ */
rtalloc_noclone((struct route *)&ro, NO_CLONING); rtalloc_noclone((struct route *)&ro, NO_CLONING);

View File

@ -115,8 +115,10 @@ void pfi_change_group_event(void * __unused, char *);
void pfi_detach_group_event(void * __unused, struct ifg_group *); void pfi_detach_group_event(void * __unused, struct ifg_group *);
void pfi_ifaddr_event(void * __unused, struct ifnet *); void pfi_ifaddr_event(void * __unused, struct ifnet *);
#ifdef VIMAGE_GLOBALS
extern struct ifgrouphead ifg_head; extern struct ifgrouphead ifg_head;
#endif #endif
#endif
RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_PROTOTYPE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare);
RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare); RB_GENERATE(pfi_ifhead, pfi_kif, pfik_tree, pfi_if_compare);

View File

@ -116,22 +116,22 @@ __FBSDID("$FreeBSD$");
#define ISN_STATIC_INCREMENT 4096 #define ISN_STATIC_INCREMENT 4096
#define ISN_RANDOM_INCREMENT (4096 - 1) #define ISN_RANDOM_INCREMENT (4096 - 1)
static u_char isn_secret[32]; static u_char pf_isn_secret[32];
static int isn_last_reseed; static int pf_isn_last_reseed;
static u_int32_t isn_offset; static u_int32_t pf_isn_offset;
static MD5_CTX isn_ctx;
u_int32_t u_int32_t
pf_new_isn(struct pf_state *s) pf_new_isn(struct pf_state *s)
{ {
MD5_CTX isn_ctx;
u_int32_t md5_buffer[4]; u_int32_t md5_buffer[4];
u_int32_t new_isn; u_int32_t new_isn;
struct pf_state_host *src, *dst; struct pf_state_host *src, *dst;
/* Seed if this is the first use, reseed if requested. */ /* Seed if this is the first use, reseed if requested. */
if (isn_last_reseed == 0) { if (pf_isn_last_reseed == 0) {
read_random(&isn_secret, sizeof(isn_secret)); read_random(&pf_isn_secret, sizeof(pf_isn_secret));
isn_last_reseed = ticks; pf_isn_last_reseed = ticks;
} }
if (s->direction == PF_IN) { if (s->direction == PF_IN) {
@ -160,11 +160,11 @@ pf_new_isn(struct pf_state *s)
MD5Update(&isn_ctx, (u_char *) &src->addr, MD5Update(&isn_ctx, (u_char *) &src->addr,
sizeof(struct in_addr)); sizeof(struct in_addr));
} }
MD5Update(&isn_ctx, (u_char *) &isn_secret, sizeof(isn_secret)); MD5Update(&isn_ctx, (u_char *) &pf_isn_secret, sizeof(pf_isn_secret));
MD5Final((u_char *) &md5_buffer, &isn_ctx); MD5Final((u_char *) &md5_buffer, &isn_ctx);
new_isn = (tcp_seq) md5_buffer[0]; new_isn = (tcp_seq) md5_buffer[0];
isn_offset += ISN_STATIC_INCREMENT + pf_isn_offset += ISN_STATIC_INCREMENT +
(arc4random() & ISN_RANDOM_INCREMENT); (arc4random() & ISN_RANDOM_INCREMENT);
new_isn += isn_offset; new_isn += pf_isn_offset;
return (new_isn); return (new_isn);
} }

View File

@ -163,6 +163,7 @@ static void addr_send_arp(struct sockaddr_in *dst_in)
struct route iproute; struct route iproute;
struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst; struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst;
char dmac[ETHER_ADDR_LEN]; char dmac[ETHER_ADDR_LEN];
struct llentry *lle;
bzero(&iproute, sizeof iproute); bzero(&iproute, sizeof iproute);
*dst = *dst_in; *dst = *dst_in;
@ -172,7 +173,7 @@ static void addr_send_arp(struct sockaddr_in *dst_in)
return; return;
arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL,
rt_key(iproute.ro_rt), dmac); rt_key(iproute.ro_rt), dmac, &lle);
RTFREE(iproute.ro_rt); RTFREE(iproute.ro_rt);
} }
@ -186,6 +187,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
struct route iproute; struct route iproute;
struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst; struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst;
char dmac[ETHER_ADDR_LEN]; char dmac[ETHER_ADDR_LEN];
struct llentry *lle;
bzero(&iproute, sizeof iproute); bzero(&iproute, sizeof iproute);
*dst = *dst_in; *dst = *dst_in;
@ -202,7 +204,7 @@ static int addr_resolve_remote(struct sockaddr_in *src_in,
goto put; goto put;
} }
ret = arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL, ret = arpresolve(iproute.ro_rt->rt_ifp, iproute.ro_rt, NULL,
rt_key(iproute.ro_rt), dmac); rt_key(iproute.ro_rt), dmac, &lle);
if (ret) { if (ret) {
goto put; goto put;
} }

View File

@ -61,7 +61,7 @@ void
rc4_init(struct rc4_state *const state, const u_char *key, int keylen) rc4_init(struct rc4_state *const state, const u_char *key, int keylen)
{ {
u_char j; u_char j;
int i; int i, k;
/* Initialize state with identity permutation */ /* Initialize state with identity permutation */
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -70,9 +70,11 @@ rc4_init(struct rc4_state *const state, const u_char *key, int keylen)
state->index2 = 0; state->index2 = 0;
/* Randomize the permutation using key data */ /* Randomize the permutation using key data */
for (j = i = 0; i < 256; i++) { for (j = i = k = 0; i < 256; i++) {
j += state->perm[i] + key[i % keylen]; j += state->perm[i] + key[k];
swap_bytes(&state->perm[i], &state->perm[j]); swap_bytes(&state->perm[i], &state->perm[j]);
if (++k >= keylen)
k = 0;
} }
} }

View File

@ -61,6 +61,23 @@ static int acpi_smbat_get_bst(device_t dev, struct acpi_bst *bst);
ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery"); ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery");
SYSCTL_DECL(_debug_acpi);
SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery debugging");
/* On some laptops with smart batteries, enabling battery monitoring
* software causes keystrokes from atkbd to be lost. This has also been
* reported on Linux, and is apparently due to the keyboard and I2C line
* for the battery being routed through the same chip. Whether that's
* accurate or not, adding extra sleeps to the status checking code
* causes the problem to go away.
*
* If you experience that problem, try a value of 10ms and move up
* from there.
*/
static int batt_sleep_ms;
SYSCTL_INT(_debug_acpi_batt, OID_AUTO, batt_sleep_ms, CTLFLAG_RW, &batt_sleep_ms, 0,
"Sleep during battery status updates to prevent keystroke loss.");
static device_method_t acpi_smbat_methods[] = { static device_method_t acpi_smbat_methods[] = {
/* device interface */ /* device interface */
DEVMETHOD(device_probe, acpi_smbat_probe), DEVMETHOD(device_probe, acpi_smbat_probe),
@ -176,6 +193,9 @@ acpi_smbus_read_2(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
ACPI_SERIAL_ASSERT(smbat); ACPI_SERIAL_ASSERT(smbat);
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
val = addr; val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR, error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1); val, 1);
@ -194,6 +214,9 @@ acpi_smbus_read_2(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
if (error) if (error)
goto out; goto out;
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
for (to = SMBUS_TIMEOUT; to != 0; to--) { for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL, error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1); &val, 1);
@ -239,6 +262,9 @@ acpi_smbus_read_multi_1(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
ACPI_SERIAL_ASSERT(smbat); ACPI_SERIAL_ASSERT(smbat);
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
val = addr; val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR, error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1); val, 1);
@ -257,6 +283,9 @@ acpi_smbus_read_multi_1(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
if (error) if (error)
goto out; goto out;
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
for (to = SMBUS_TIMEOUT; to != 0; to--) { for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL, error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1); &val, 1);
@ -292,6 +321,9 @@ acpi_smbus_read_multi_1(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
if (len > val) if (len > val)
len = val; len = val;
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
while (len--) { while (len--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_DATA error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_DATA
+ len, &val, 1); + len, &val, 1);
@ -299,6 +331,8 @@ acpi_smbus_read_multi_1(struct acpi_smbat_softc *sc, uint8_t addr, uint8_t cmd,
goto out; goto out;
ptr[len] = val; ptr[len] = val;
if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
} }
out: out:

View File

@ -92,7 +92,8 @@ ata_pci_attach(device_t dev)
int unit; int unit;
/* do chipset specific setups only needed once */ /* do chipset specific setups only needed once */
if (ata_legacy(dev) || pci_read_config(dev, PCIR_BAR(2), 4) & IOMASK) ctlr->legacy = ata_legacy(dev);
if (ctlr->legacy || pci_read_config(dev, PCIR_BAR(2), 4) & IOMASK)
ctlr->channels = 2; ctlr->channels = 2;
else else
ctlr->channels = 1; ctlr->channels = 1;
@ -120,7 +121,7 @@ ata_pci_attach(device_t dev)
/* attach all channels on this controller */ /* attach all channels on this controller */
for (unit = 0; unit < ctlr->channels; unit++) { for (unit = 0; unit < ctlr->channels; unit++) {
if ((unit == 0 || unit == 1) && ata_legacy(dev)) { if ((unit == 0 || unit == 1) && ctlr->legacy) {
device_add_child(dev, "ata", unit); device_add_child(dev, "ata", unit);
continue; continue;
} }
@ -192,7 +193,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
if (type == SYS_RES_IOPORT) { if (type == SYS_RES_IOPORT) {
switch (*rid) { switch (*rid) {
case ATA_IOADDR_RID: case ATA_IOADDR_RID:
if (ata_legacy(dev)) { if (controller->legacy) {
start = (unit ? ATA_SECONDARY : ATA_PRIMARY); start = (unit ? ATA_SECONDARY : ATA_PRIMARY);
count = ATA_IOSIZE; count = ATA_IOSIZE;
end = start + count - 1; end = start + count - 1;
@ -204,7 +205,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
break; break;
case ATA_CTLADDR_RID: case ATA_CTLADDR_RID:
if (ata_legacy(dev)) { if (controller->legacy) {
start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_CTLOFFSET; start = (unit ? ATA_SECONDARY : ATA_PRIMARY) + ATA_CTLOFFSET;
count = ATA_CTLIOSIZE; count = ATA_CTLIOSIZE;
end = start + count - 1; end = start + count - 1;
@ -217,7 +218,7 @@ ata_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
} }
} }
if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) { if (type == SYS_RES_IRQ && *rid == ATA_IRQ_RID) {
if (ata_legacy(dev)) { if (controller->legacy) {
int irq = (unit == 0 ? 14 : 15); int irq = (unit == 0 ? 14 : 15);
res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
@ -233,6 +234,7 @@ int
ata_pci_release_resource(device_t dev, device_t child, int type, int rid, ata_pci_release_resource(device_t dev, device_t child, int type, int rid,
struct resource *r) struct resource *r)
{ {
struct ata_pci_controller *controller = device_get_softc(dev);
int unit = ((struct ata_channel *)device_get_softc(child))->unit; int unit = ((struct ata_channel *)device_get_softc(child))->unit;
if (type == SYS_RES_IOPORT) { if (type == SYS_RES_IOPORT) {
@ -256,7 +258,7 @@ ata_pci_release_resource(device_t dev, device_t child, int type, int rid,
if (rid != ATA_IRQ_RID) if (rid != ATA_IRQ_RID)
return ENOENT; return ENOENT;
if (ata_legacy(dev)) { if (controller->legacy) {
return BUS_RELEASE_RESOURCE(device_get_parent(dev), child, return BUS_RELEASE_RESOURCE(device_get_parent(dev), child,
SYS_RES_IRQ, rid, r); SYS_RES_IRQ, rid, r);
} }
@ -271,7 +273,9 @@ ata_pci_setup_intr(device_t dev, device_t child, struct resource *irq,
int flags, driver_filter_t *filter, driver_intr_t *function, int flags, driver_filter_t *filter, driver_intr_t *function,
void *argument, void **cookiep) void *argument, void **cookiep)
{ {
if (ata_legacy(dev)) { struct ata_pci_controller *controller = device_get_softc(dev);
if (controller->legacy) {
return BUS_SETUP_INTR(device_get_parent(dev), child, irq, return BUS_SETUP_INTR(device_get_parent(dev), child, irq,
flags, filter, function, argument, cookiep); flags, filter, function, argument, cookiep);
} }
@ -294,7 +298,9 @@ int
ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq, ata_pci_teardown_intr(device_t dev, device_t child, struct resource *irq,
void *cookie) void *cookie)
{ {
if (ata_legacy(dev)) { struct ata_pci_controller *controller = device_get_softc(dev);
if (controller->legacy) {
return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie); return BUS_TEARDOWN_INTR(device_get_parent(dev), child, irq, cookie);
} }
else { else {
@ -352,7 +358,7 @@ ata_pci_allocate(device_t dev)
ch->r_io[i].offset = i; ch->r_io[i].offset = i;
} }
ch->r_io[ATA_CONTROL].res = ctlio; ch->r_io[ATA_CONTROL].res = ctlio;
ch->r_io[ATA_CONTROL].offset = ata_legacy(device_get_parent(dev)) ? 0 : 2; ch->r_io[ATA_CONTROL].offset = ctlr->legacy ? 0 : 2;
ch->r_io[ATA_IDX_ADDR].res = io; ch->r_io[ATA_IDX_ADDR].res = io;
ata_default_registers(dev); ata_default_registers(dev);
if (ctlr->r_res1) { if (ctlr->r_res1) {
@ -369,9 +375,11 @@ ata_pci_allocate(device_t dev)
int int
ata_pci_status(device_t dev) ata_pci_status(device_t dev)
{ {
struct ata_pci_controller *controller =
device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev); struct ata_channel *ch = device_get_softc(dev);
if ((dumping || !ata_legacy(device_get_parent(dev))) && if ((dumping || !controller->legacy) &&
((ch->flags & ATA_ALWAYS_DMASTAT) || ((ch->flags & ATA_ALWAYS_DMASTAT) ||
(ch->dma.flags & ATA_DMA_ACTIVE))) { (ch->dma.flags & ATA_DMA_ACTIVE))) {
int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; int bmstat = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK;
@ -652,7 +660,7 @@ ata_setup_interrupt(device_t dev, void *intr_func)
struct ata_pci_controller *ctlr = device_get_softc(dev); struct ata_pci_controller *ctlr = device_get_softc(dev);
int rid = ATA_IRQ_RID; int rid = ATA_IRQ_RID;
if (!ata_legacy(dev)) { if (!ctlr->legacy) {
if (!(ctlr->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, if (!(ctlr->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_SHAREABLE | RF_ACTIVE))) { RF_SHAREABLE | RF_ACTIVE))) {
device_printf(dev, "unable to map interrupt\n"); device_printf(dev, "unable to map interrupt\n");

View File

@ -48,6 +48,7 @@ struct ata_pci_controller {
struct resource *r_irq; struct resource *r_irq;
void *handle; void *handle;
struct ata_chip_id *chip; struct ata_chip_id *chip;
int legacy;
int channels; int channels;
int (*chipinit)(device_t); int (*chipinit)(device_t);
int (*suspend)(device_t); int (*suspend)(device_t);

View File

@ -73,8 +73,9 @@ ata_ahci_probe(device_t dev)
char buffer[64]; char buffer[64];
/* is this a possible AHCI candidate ? */ /* is this a possible AHCI candidate ? */
if (pci_get_subclass(dev) != PCIS_STORAGE_SATA) if (pci_get_class(dev) != PCIC_STORAGE ||
return ENXIO; pci_get_subclass(dev) != PCIS_STORAGE_SATA)
return (ENXIO);
/* is this PCI device flagged as an AHCI compliant chip ? */ /* is this PCI device flagged as an AHCI compliant chip ? */
if (pci_read_config(dev, PCIR_PROGIF, 1) != PCIP_STORAGE_SATA_AHCI_1_0) if (pci_read_config(dev, PCIR_PROGIF, 1) != PCIP_STORAGE_SATA_AHCI_1_0)
@ -94,6 +95,7 @@ int
ata_ahci_chipinit(device_t dev) ata_ahci_chipinit(device_t dev)
{ {
struct ata_pci_controller *ctlr = device_get_softc(dev); struct ata_pci_controller *ctlr = device_get_softc(dev);
int error;
u_int32_t version; u_int32_t version;
/* if we have a memory BAR(5) we are likely on an AHCI part */ /* if we have a memory BAR(5) we are likely on an AHCI part */
@ -105,14 +107,19 @@ ata_ahci_chipinit(device_t dev)
/* setup interrupt delivery if not done allready by a vendor driver */ /* setup interrupt delivery if not done allready by a vendor driver */
if (!ctlr->r_irq) { if (!ctlr->r_irq) {
if (ata_setup_interrupt(dev, ata_generic_intr)) if (ata_setup_interrupt(dev, ata_generic_intr)) {
bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
return ENXIO; return ENXIO;
}
} }
else else
device_printf(dev, "AHCI called from vendor specific driver\n"); device_printf(dev, "AHCI called from vendor specific driver\n");
/* reset controller */ /* reset controller */
ata_ahci_ctlr_reset(dev); if ((error = ata_ahci_ctlr_reset(dev)) != 0) {
bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
return (error);
};
/* get the number of HW channels */ /* get the number of HW channels */
ctlr->channels = ctlr->channels =
@ -154,7 +161,6 @@ ata_ahci_ctlr_reset(device_t dev)
ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_HR); ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_HR);
DELAY(1000000); DELAY(1000000);
if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) { if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) {
bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2);
device_printf(dev, "AHCI controller reset failure\n"); device_printf(dev, "AHCI controller reset failure\n");
return ENXIO; return ENXIO;
} }

View File

@ -105,6 +105,9 @@ ata_sis_probe(device_t dev)
char buffer[64]; char buffer[64];
int found = 0; int found = 0;
if (pci_get_class(dev) != PCIC_STORAGE)
return (ENXIO);
if (pci_get_vendor(dev) != ATA_SIS_ID) if (pci_get_vendor(dev) != ATA_SIS_ID)
return ENXIO; return ENXIO;

Some files were not shown because too many files have changed in this diff Show More