svn commit: r200006 - in user/eri/pf45/head: contrib/ntp/ntpd
share/man/man9 sys/dev/hwpmc sys/dev/xen/netfront sys/kern
usr.bin/netstat
Ermal Luçi
eri at FreeBSD.org
Tue Dec 1 22:41:38 UTC 2009
Author: eri
Date: Tue Dec 1 22:41:38 2009
New Revision: 200006
URL: http://svn.freebsd.org/changeset/base/200006
Log:
MFH
Modified:
user/eri/pf45/head/contrib/ntp/ntpd/ntp_io.c
user/eri/pf45/head/share/man/man9/ifnet.9
user/eri/pf45/head/sys/dev/hwpmc/hwpmc_x86.c
user/eri/pf45/head/sys/dev/xen/netfront/netfront.c
user/eri/pf45/head/sys/kern/tty.c
user/eri/pf45/head/usr.bin/netstat/if.c
user/eri/pf45/head/usr.bin/netstat/main.c
user/eri/pf45/head/usr.bin/netstat/netstat.1
user/eri/pf45/head/usr.bin/netstat/netstat.h
Directory Properties:
user/eri/pf45/head/ (props changed)
Modified: user/eri/pf45/head/contrib/ntp/ntpd/ntp_io.c
==============================================================================
--- user/eri/pf45/head/contrib/ntp/ntpd/ntp_io.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/contrib/ntp/ntpd/ntp_io.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -65,6 +65,12 @@
#endif /* IPV6 Multicast Support */
#endif /* IPv6 Support */
+#ifdef INCLUDE_IPV6_SUPPORT
+#include <netinet/in.h>
+#include <net/if_var.h>
+#include <netinet/in_var.h>
+#endif /* !INCLUDE_IPV6_SUPPORT */
+
extern int listen_to_virtual_ips;
extern const char *specific_interface;
@@ -1137,6 +1143,36 @@ set_wildcard_reuse(int family, int on)
}
#endif /* OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */
+#ifdef INCLUDE_IPV6_SUPPORT
+static isc_boolean_t
+is_anycast(struct sockaddr *sa, char *name)
+{
+#if defined(SIOCGIFAFLAG_IN6) && defined(IN6_IFF_ANYCAST)
+ struct in6_ifreq ifr6;
+ int fd;
+ u_int32_t flags6;
+
+ if (sa->sa_family != AF_INET6)
+ return ISC_FALSE;
+ if ((fd = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ return ISC_FALSE;
+ memset(&ifr6, 0, sizeof(ifr6));
+ memcpy(&ifr6.ifr_addr, (struct sockaddr_in6 *)sa,
+ sizeof(struct sockaddr_in6));
+ strlcpy(ifr6.ifr_name, name, IF_NAMESIZE);
+ if (ioctl(fd, SIOCGIFAFLAG_IN6, &ifr6) < 0) {
+ close(fd);
+ return ISC_FALSE;
+ }
+ close(fd);
+ flags6 = ifr6.ifr_ifru.ifru_flags6;
+ if ((flags6 & IN6_IFF_ANYCAST) != 0)
+ return ISC_TRUE;
+#endif /* !SIOCGIFAFLAG_IN6 || !IN6_IFF_ANYCAST */
+ return ISC_FALSE;
+}
+#endif /* !INCLUDE_IPV6_SUPPORT */
+
/*
* update_interface strategy
*
@@ -1276,6 +1312,11 @@ update_interfaces(
if (is_wildcard_addr(&interface.sin))
continue;
+#ifdef INCLUDE_IPV6_SUPPORT
+ if (is_anycast((struct sockaddr *)&interface.sin, isc_if.name))
+ continue;
+#endif /* !INCLUDE_IPV6_SUPPORT */
+
/*
* map to local *address* in order
* to map all duplicate interfaces to an interface structure
Modified: user/eri/pf45/head/share/man/man9/ifnet.9
==============================================================================
--- user/eri/pf45/head/share/man/man9/ifnet.9 Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/share/man/man9/ifnet.9 Tue Dec 1 22:41:38 2009 (r200006)
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 14, 2007
+.Dd December 1, 2009
.Os
.Dt IFNET 9
.Sh NAME
@@ -279,13 +279,6 @@ to refer to a particular interface by in
.Xr link_addr 3 ) .
(Initialized by
.Fn if_alloc . )
-.It Va if_timer
-.Pq Vt short
-Number of seconds until the watchdog timer
-.Fn if_watchdog
-is called, or zero if the timer is disabled.
-(Set by driver,
-decremented by generic watchdog code.)
.It Va if_flags
.Pq Vt int
Flags describing operational parameters of this interface (see below).
@@ -401,11 +394,6 @@ flags and flushing queues.
See the description of
.Fn ifioctl
below for more information.
-.It Fn if_watchdog
-Routine called by the generic code when the watchdog timer,
-.Va if_timer ,
-expires.
-Usually this will reset the interface.
.\" .It Fn if_poll_recv
.\" .It Fn if_poll_xmit
.\" .It Fn if_poll_slowinput
@@ -415,7 +403,7 @@ Usually this will reset the interface.
.\" section, below.
.It Fn if_init
Initialize and bring up the hardware,
-e.g., reset the chip and the watchdog timer and enable the receiver unit.
+e.g., reset the chip and enable the receiver unit.
Should mark the interface running,
but not active
.Dv ( IFF_RUNNING , ~IIF_OACTIVE ) .
Modified: user/eri/pf45/head/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- user/eri/pf45/head/sys/dev/hwpmc/hwpmc_x86.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/sys/dev/hwpmc/hwpmc_x86.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -101,7 +101,7 @@ pmc_save_user_callchain(uintptr_t *cc, i
if (copyin((void *) sp, &pc, sizeof(pc)) != 0)
return (n);
} else if (copyin((void *) r, &pc, sizeof(pc)) != 0 ||
- copyin((void *) fp, &fp, sizeof(fp) != 0))
+ copyin((void *) fp, &fp, sizeof(fp)) != 0)
return (n);
for (; n < nframes;) {
Modified: user/eri/pf45/head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- user/eri/pf45/head/sys/dev/xen/netfront/netfront.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/sys/dev/xen/netfront/netfront.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -155,6 +155,9 @@ static void netif_disconnect_backend(str
static int setup_device(device_t dev, struct netfront_info *info);
static void end_access(int ref, void *page);
+static int xn_ifmedia_upd(struct ifnet *ifp);
+static void xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr);
+
/* Xenolinux helper functions */
int network_connect(struct netfront_info *);
@@ -240,7 +243,9 @@ struct netfront_info {
/* Receive-ring batched refills. */
#define RX_MIN_TARGET 32
#define RX_MAX_TARGET NET_RX_RING_SIZE
- int rx_min_target, rx_max_target, rx_target;
+ int rx_min_target;
+ int rx_max_target;
+ int rx_target;
/*
* {tx,rx}_skbs store outstanding skbuffs. The first entry in each
@@ -253,19 +258,20 @@ struct netfront_info {
grant_ref_t grant_rx_ref[NET_TX_RING_SIZE + 1];
#define TX_MAX_TARGET min(NET_RX_RING_SIZE, 256)
- device_t xbdev;
- int tx_ring_ref;
- int rx_ring_ref;
- uint8_t mac[ETHER_ADDR_LEN];
+ device_t xbdev;
+ int tx_ring_ref;
+ int rx_ring_ref;
+ uint8_t mac[ETHER_ADDR_LEN];
struct xn_chain_data xn_cdata; /* mbufs */
- struct mbuf_head xn_rx_batch; /* head of the batch queue */
+ struct mbuf_head xn_rx_batch; /* head of the batch queue */
int xn_if_flags;
struct callout xn_stat_ch;
- u_long rx_pfn_array[NET_RX_RING_SIZE];
- multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
- mmu_update_t rx_mmu[NET_RX_RING_SIZE];
+ u_long rx_pfn_array[NET_RX_RING_SIZE];
+ multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
+ mmu_update_t rx_mmu[NET_RX_RING_SIZE];
+ struct ifmedia sc_media;
};
#define rx_mbufs xn_cdata.xn_rx_chain
@@ -1622,6 +1628,7 @@ xn_ifinit_locked(struct netfront_info *s
ifp->if_drv_flags |= IFF_DRV_RUNNING;
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
+ if_link_state_change(ifp, LINK_STATE_UP);
callout_reset(&sc->xn_stat_ch, hz, xn_tick, sc);
@@ -1761,7 +1768,7 @@ xn_ioctl(struct ifnet *ifp, u_long cmd,
/* FALLTHROUGH */
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
- error = EINVAL;
+ error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
break;
default:
error = ether_ioctl(ifp, cmd, data);
@@ -1785,6 +1792,7 @@ xn_stop(struct netfront_info *sc)
xn_free_tx_ring(sc);
ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+ if_link_state_change(ifp, LINK_STATE_DOWN);
}
/* START of Xenolinux helper functions adapted to FreeBSD */
@@ -1903,6 +1911,11 @@ create_netdev(device_t dev)
np->xbdev = dev;
XN_LOCK_INIT(np, xennetif);
+
+ ifmedia_init(&np->sc_media, 0, xn_ifmedia_upd, xn_ifmedia_sts);
+ ifmedia_add(&np->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
+ ifmedia_set(&np->sc_media, IFM_ETHER|IFM_MANUAL);
+
np->rx_target = RX_MIN_TARGET;
np->rx_min_target = RX_MIN_TARGET;
np->rx_max_target = RX_MAX_TARGET;
@@ -1987,7 +2000,8 @@ out:
* acknowledgement.
*/
#if 0
-static void netfront_closing(device_t dev)
+static void
+netfront_closing(device_t dev)
{
#if 0
struct netfront_info *info = dev->dev_driver_data;
@@ -2000,7 +2014,8 @@ static void netfront_closing(device_t de
}
#endif
-static int netfront_detach(device_t dev)
+static int
+netfront_detach(device_t dev)
{
struct netfront_info *info = device_get_softc(dev);
@@ -2011,8 +2026,8 @@ static int netfront_detach(device_t dev)
return 0;
}
-
-static void netif_free(struct netfront_info *info)
+static void
+netif_free(struct netfront_info *info)
{
netif_disconnect_backend(info);
#if 0
@@ -2020,7 +2035,8 @@ static void netif_free(struct netfront_i
#endif
}
-static void netif_disconnect_backend(struct netfront_info *info)
+static void
+netif_disconnect_backend(struct netfront_info *info)
{
XN_RX_LOCK(info);
XN_TX_LOCK(info);
@@ -2042,12 +2058,26 @@ static void netif_disconnect_backend(str
}
-static void end_access(int ref, void *page)
+static void
+end_access(int ref, void *page)
{
if (ref != GRANT_INVALID_REF)
gnttab_end_foreign_access(ref, page);
}
+static int
+xn_ifmedia_upd(struct ifnet *ifp)
+{
+ return (0);
+}
+
+static void
+xn_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
+{
+ ifmr->ifm_status = IFM_AVALID|IFM_ACTIVE;
+ ifmr->ifm_active = IFM_ETHER|IFM_MANUAL;
+}
+
/* ** Driver registration ** */
static device_method_t netfront_methods[] = {
/* Device interface */
Modified: user/eri/pf45/head/sys/kern/tty.c
==============================================================================
--- user/eri/pf45/head/sys/kern/tty.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/sys/kern/tty.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -102,10 +102,11 @@ static const char *dev_console_filename;
static void
tty_watermarks(struct tty *tp)
{
- size_t bs;
+ size_t bs = 0;
/* Provide an input buffer for 0.2 seconds of data. */
- bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX);
+ if (tp->t_termios.c_cflag & CREAD)
+ bs = MIN(tp->t_termios.c_ispeed / 5, TTYBUF_MAX);
ttyinq_setsize(&tp->t_inq, tp, bs);
/* Set low watermark at 10% (when 90% is available). */
@@ -890,6 +891,7 @@ ttydevsw_defparam(struct tty *tp, struct
t->c_ospeed = B50;
else if (t->c_ospeed > B115200)
t->c_ospeed = B115200;
+ t->c_cflag |= CREAD;
return (0);
}
Modified: user/eri/pf45/head/usr.bin/netstat/if.c
==============================================================================
--- user/eri/pf45/head/usr.bin/netstat/if.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/usr.bin/netstat/if.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -200,7 +200,6 @@ intpr(int interval1, u_long ifnetaddr, v
u_long ierrors;
u_long idrops;
u_long collisions;
- short timer;
int drops;
struct sockaddr *sa = NULL;
char name[IFNAMSIZ];
@@ -234,8 +233,6 @@ intpr(int interval1, u_long ifnetaddr, v
if (bflag)
printf(" %10.10s","Obytes");
printf(" %5s", "Coll");
- if (tflag)
- printf(" %s", "Time");
if (dflag)
printf(" %s", "Drop");
putchar('\n');
@@ -288,7 +285,6 @@ intpr(int interval1, u_long ifnetaddr, v
ierrors = ifnet.if_ierrors;
idrops = ifnet.if_iqdrops;
collisions = ifnet.if_collisions;
- timer = ifnet.if_timer;
drops = ifnet.if_snd.ifq_drops;
if (ifaddraddr == 0) {
@@ -435,8 +431,6 @@ intpr(int interval1, u_long ifnetaddr, v
show_stat("lu", 10, obytes, link_layer|network_layer);
show_stat("NRSlu", 5, collisions, link_layer);
- if (tflag)
- show_stat("LSd", 4, timer, link_layer);
if (dflag)
show_stat("LSd", 4, drops, link_layer);
putchar('\n');
Modified: user/eri/pf45/head/usr.bin/netstat/main.c
==============================================================================
--- user/eri/pf45/head/usr.bin/netstat/main.c Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/usr.bin/netstat/main.c Tue Dec 1 22:41:38 2009 (r200006)
@@ -339,7 +339,6 @@ int numeric_port; /* show ports numerica
static int pflag; /* show given protocol */
int rflag; /* show routing tables (or routing stats) */
int sflag; /* show protocol statistics */
-int tflag; /* show i/f watchdog timers */
int Wflag; /* wide display */
int xflag; /* extra information, includes all socket buffer info */
int zflag; /* zero stats */
@@ -360,7 +359,7 @@ main(int argc, char *argv[])
af = AF_UNSPEC;
- while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:rSstuWw:xz")) != -1)
+ while ((ch = getopt(argc, argv, "AaBbdf:ghI:iLlM:mN:np:rSsuWw:xz")) != -1)
switch(ch) {
case 'A':
Aflag = 1;
@@ -455,9 +454,6 @@ main(int argc, char *argv[])
case 'S':
numeric_addr = 1;
break;
- case 't':
- tflag = 1;
- break;
case 'u':
af = AF_UNIX;
break;
@@ -781,7 +777,7 @@ usage(void)
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: netstat [-AaLnSWx] [-f protocol_family | -p protocol]\n"
" [-M core] [-N system]",
-" netstat -i | -I interface [-abdhntW] [-f address_family]\n"
+" netstat -i | -I interface [-abdhnW] [-f address_family]\n"
" [-M core] [-N system]",
" netstat -w wait [-I interface] [-d] [-M core] [-N system]",
" netstat -s [-s] [-z] [-f protocol_family | -p protocol]\n"
Modified: user/eri/pf45/head/usr.bin/netstat/netstat.1
==============================================================================
--- user/eri/pf45/head/usr.bin/netstat/netstat.1 Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/usr.bin/netstat/netstat.1 Tue Dec 1 22:41:38 2009 (r200006)
@@ -92,7 +92,7 @@ is present, display socket buffer and tc
.Bk -words
.Nm
.Fl i | I Ar interface
-.Op Fl abdhntW
+.Op Fl abdhnW
.Op Fl f Ar address_family
.Op Fl M Ar core
.Op Fl N Ar system
@@ -123,9 +123,6 @@ If
.Fl h
is also present, print all counters in human readable form.
If
-.Fl t
-is also present, show the contents of watchdog timers.
-If
.Fl W
is also present, print interface names using a wider field size.
.It Xo
Modified: user/eri/pf45/head/usr.bin/netstat/netstat.h
==============================================================================
--- user/eri/pf45/head/usr.bin/netstat/netstat.h Tue Dec 1 22:38:37 2009 (r200005)
+++ user/eri/pf45/head/usr.bin/netstat/netstat.h Tue Dec 1 22:41:38 2009 (r200006)
@@ -49,7 +49,6 @@ extern int numeric_addr; /* show address
extern int numeric_port; /* show ports numerically */
extern int rflag; /* show routing tables (or routing stats) */
extern int sflag; /* show protocol statistics */
-extern int tflag; /* show i/f watchdog timers */
extern int Wflag; /* wide display */
extern int xflag; /* extended display, includes all socket buffer info */
extern int zflag; /* zero stats */
More information about the svn-src-user
mailing list