Re: 5.5beta wierds

2014-01-21 Thread Philip Guenther
On Tue, Jan 21, 2014 at 8:33 PM, Otto Moerbeek o...@drijf.net wrote:
...
 Right. what happens is that localtime(3) returns NULL, because the
 year is not representable as an int. struct tm.tm_year must be an int
 according to posix.

 The diff below catches the case.

ok guenther@


 But it does not solve that 64-bit
 time_t can represent years that do not fit into the int sized tm_year.

Sure, and before there was the problem that there were struct
localtime values that mktime() could not convert to a time_t.  Lacking
types of fractional bit width, we have to live with one or the other,
no?


Philip Guenther



Re: 5.5beta wierds

2014-01-21 Thread Otto Moerbeek
On Tue, Jan 21, 2014 at 09:08:18PM +1300, Philip Guenther wrote:

 On Tue, Jan 21, 2014 at 8:33 PM, Otto Moerbeek o...@drijf.net wrote:
 ...
  Right. what happens is that localtime(3) returns NULL, because the
  year is not representable as an int. struct tm.tm_year must be an int
  according to posix.
 
  The diff below catches the case.
 
 ok guenther@
 
 
  But it does not solve that 64-bit
  time_t can represent years that do not fit into the int sized tm_year.
 
 Sure, and before there was the problem that there were struct
 localtime values that mktime() could not convert to a time_t.  Lacking
 types of fractional bit width, we have to live with one or the other,
 no?

indeed, it's one or the other.

I need to check which of the time functions can returns NULL. The man
page is awfully silent on that. 

-Otto   

 
 
 Philip Guenther



Re: 5.5beta wierds

2014-01-21 Thread Otto Moerbeek
On Tue, Jan 21, 2014 at 09:34:51AM +0100, Otto Moerbeek wrote:

 On Tue, Jan 21, 2014 at 09:08:18PM +1300, Philip Guenther wrote:
 
  On Tue, Jan 21, 2014 at 8:33 PM, Otto Moerbeek o...@drijf.net wrote:
  ...
   Right. what happens is that localtime(3) returns NULL, because the
   year is not representable as an int. struct tm.tm_year must be an int
   according to posix.
  
   The diff below catches the case.
  
  ok guenther@
  
  
   But it does not solve that 64-bit
   time_t can represent years that do not fit into the int sized tm_year.
  
  Sure, and before there was the problem that there were struct
  localtime values that mktime() could not convert to a time_t.  Lacking
  types of fractional bit width, we have to live with one or the other,
  no?
 
 indeed, it's one or the other.
 
 I need to check which of the time functions can returns NULL. The man
 page is awfully silent on that. 
 
   -Otto   
 
  
  
  Philip Guenther

And here's the man page diff, our ctime and asctime actually do not
ever return NULL, while posix allows that.

-Otto

Index: ctime.3
===
RCS file: /cvs/src/lib/libc/time/ctime.3,v
retrieving revision 1.40
diff -u -p -r1.40 ctime.3
--- ctime.3 17 Jul 2013 05:42:11 -  1.40
+++ ctime.3 21 Jan 2014 09:43:31 -
@@ -257,6 +257,17 @@ is non-zero if summer time is in effect.
 is the offset (in seconds) of the time represented
 from UTC, with positive values indicating east
 of the Prime Meridian.
+.Sh RETURN VALUES
+The functions
+.Fn localtime ,
+.Fn localtime_r ,
+.Fn gmtime
+and
+.Fn gmtime_r
+return NULL on error.
+The function
+.Fn mktime 
+returns \-1 on error.
 .Sh FILES
 .Bl -tag -width /usr/share/zoneinfo/posixrules -compact
 .It Pa /usr/share/zoneinfo



Re: More radix.c cleanup

2014-01-21 Thread Martin Pieuchot
On 21/01/14(Tue) 05:05, Claudio Jeker wrote:
 Cleanup the abuse of x as the rn_addmask radix node. Since in most
 cases x is just used as a temp variable. Main offender is rn_addmask()
 which sets x once at the top uses it then late in the function and then
 starts reuing it for various other stuff. While there fix some for loops
 to while ones and fix one strange do { } while() loop.
 And since rn_search() can not return NULL remove one extra check.
 
 OK?

ok mpi@,

I was about to comment on the few return (0) surrounding the code you
touched but since there's still a lot of possible improvements, that
might be for another diff :)


 -- 
 :wq Claudio
 
 Index: radix.c
 ===
 RCS file: /cvs/src/sys/net/radix.c,v
 retrieving revision 1.37
 diff -u -p -r1.37 radix.c
 --- radix.c   20 Jan 2014 22:42:06 -  1.37
 +++ radix.c   21 Jan 2014 03:44:20 -
 @@ -109,10 +109,10 @@ struct radix_node *rn_search_m(void *, s
  static inline struct radix_node *
  rn_search(void *v_arg, struct radix_node *head)
  {
 - struct radix_node *x;
 + struct radix_node *x = head;
   caddr_t v = v_arg;
  
 - for (x = head; x-rn_b = 0;) {
 + while (x-rn_b = 0) {
   if (x-rn_bmask  v[x-rn_off])
   x = x-rn_r;
   else
 @@ -124,11 +124,11 @@ rn_search(void *v_arg, struct radix_node
  struct radix_node *
  rn_search_m(void *v_arg, struct radix_node *head, void *m_arg)
  {
 - struct radix_node *x;
 + struct radix_node *x = head;
   caddr_t v = v_arg;
   caddr_t m = m_arg;
  
 - for (x = head; x-rn_b = 0;) {
 + while (x-rn_b = 0) {
   if ((x-rn_bmask  m[x-rn_off]) 
   (x-rn_bmask  v[x-rn_off]))
   x = x-rn_r;
 @@ -170,14 +170,14 @@ rn_refines(void *m_arg, void *n_arg)
  struct radix_node *
  rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
  {
 - struct radix_node *x;
 + struct radix_node *x, *tm;
   caddr_t netmask = 0;
  
   if (m_arg) {
 - x = rn_addmask(m_arg, 1, head-rnh_treetop-rn_off);
 - if (x == NULL)
 - return (0);
 - netmask = x-rn_key;
 + tm = rn_addmask(m_arg, 1, head-rnh_treetop-rn_off);
 + if (tm == NULL)
 + return (NULL);
 + netmask = tm-rn_key;
   }
   x = rn_match(v_arg, head);
   if (x  netmask) {
 @@ -278,28 +278,26 @@ on1:
   struct radix_mask *m;
   t = t-rn_p;
   m = t-rn_mklist;
 - if (m) {
 + while (m) {
   /*
* If non-contiguous masks ever become important
* we can restore the masking and open coding of
* the search and satisfaction test and put the
* calculation of off back before the do.
*/
 - do {
 - if (m-rm_flags  RNF_NORMAL) {
 - if (rn_b = m-rm_b)
 - return (m-rm_leaf);
 - } else {
 - struct radix_node *x;
 - off = min(t-rn_off, matched_off);
 - x = rn_search_m(v, t, m-rm_mask);
 - while (x  x-rn_mask != m-rm_mask)
 - x = x-rn_dupedkey;
 - if (x  rn_satisfies_leaf(v, x, off))
 - return x;
 - }
 - m = m-rm_mklist;
 - } while (m);
 + if (m-rm_flags  RNF_NORMAL) {
 + if (rn_b = m-rm_b)
 + return (m-rm_leaf);
 + } else {
 + struct radix_node *x;
 + off = min(t-rn_off, matched_off);
 + x = rn_search_m(v, t, m-rm_mask);
 + while (x  x-rn_mask != m-rm_mask)
 + x = x-rn_dupedkey;
 + if (x  rn_satisfies_leaf(v, x, off))
 + return x;
 + }
 + m = m-rm_mklist;
   }
   } while (t != top);
   return NULL;
 @@ -408,7 +406,7 @@ struct radix_node *
  rn_addmask(void *n_arg, int search, int skip)
  {
   caddr_t netmask = n_arg;
 - struct radix_node *x, *saved_x;
 + struct radix_node *tm, *saved_tm;
   caddr_t cp, cplim;
   int b = 0, mlen, j;
   int maskduplicated, m0, isnormal;
 @@ -438,21 +436,22 @@ rn_addmask(void *n_arg, int search, int 
   if (m0  last_zeroed)
   

installboot -c to force CHS mode

2014-01-21 Thread Florian Stinglmayr
Hi list,

I have hardware where the LBA boot fails with ERR R. Forcing CHS mode
allows me to boot the hardware just fine.

To make life easier, I have added an option -c to installboot. This
option sets the global symbol _force_chs to 1 in biosboot to save me
from pressing shift at start up.

Regards,
Florian

P.S.: A comment in biosboot.S actually suggested a -c option.

Index: installboot.8
===
RCS file: /cvs/src/sys/arch/i386/stand/installboot/installboot.8,v
retrieving revision 1.29
diff -u -p -u -r1.29 installboot.8
--- installboot.8   6 Mar 2010 16:16:43 -   1.29
+++ installboot.8   21 Jan 2014 17:24:59 -
@@ -33,7 +33,7 @@
 .Nd installs a bootstrap on an FFS disk or partition
 .Sh SYNOPSIS
 .Nm installboot
-.Op Fl nv
+.Op Fl cnv
 .Ar boot
 .Ar biosboot
 .Ar disk
@@ -52,6 +52,8 @@ Various filesystem parameters are also p
 .Pp
 The options are as follows:
 .Bl -tag -width flag_opt
+.It Fl c
+Force CHS mode in biosboot.
 .It Fl n
 Do not actually write anything on the disk.
 .It Fl v
Index: installboot.c
===
RCS file: /cvs/src/sys/arch/i386/stand/installboot/installboot.c,v
retrieving revision 1.70
diff -u -p -u -r1.70 installboot.c
--- installboot.c   13 Nov 2013 04:11:34 -  1.70
+++ installboot.c   21 Jan 2014 17:24:59 -
@@ -75,7 +75,7 @@ structsym_data {
 };
 
 extern char *__progname;
-intverbose, nowrite = 0;
+intverbose, nowrite = 0, forcechs = 0;
 char   *boot, *proto, *dev, *realdev;
 char   *protostore;
 long   protosize;
@@ -87,6 +87,7 @@ struct sym_data pbr_symbols[] = {
{_inodeblk,   4},
{_inodedbl,   4},
{_nblocks,2},
+   {_force_chs,  1},
{NULL}
 };
 
@@ -113,7 +114,7 @@ static void sr_installpbr(int, int, int)
 static void
 usage(void)
 {
-   fprintf(stderr, usage: %s [-nv] boot biosboot device\n, __progname);
+   fprintf(stderr, usage: %s [-cnv] boot biosboot device\n, __progname);
exit(1);
 }
 
@@ -130,8 +131,12 @@ main(int argc, char *argv[])
int devfd;
struct  disklabel dl;
 
-   while ((c = getopt(argc, argv, vn)) != -1) {
+   while ((c = getopt(argc, argv, cnv)) != -1) {
switch (c) {
+   case 'c':
+   /* Force CHS mode */
+   forcechs = 1;
+   break;
case 'n':
/* Do not actually write the bootblock to disk. */
nowrite = 1;
@@ -542,6 +547,7 @@ getbootparams(char *boot, int devfd, str
sym_set_value(pbr_symbols, _inodedbl,
char *)ap) - buf) + INODEOFF));
sym_set_value(pbr_symbols, _nblocks, ndb);
+   sym_set_value(pbr_symbols, _force_chs, forcechs);
 
if (verbose) {
fprintf(stderr, %s is %d blocks x %d bytes\n,
@@ -758,6 +764,7 @@ sr_installboot(int devfd)
sym_set_value(pbr_symbols, _inodeblk, inodeblk);
sym_set_value(pbr_symbols, _inodedbl, inodedbl);
sym_set_value(pbr_symbols, _nblocks, nblocks);
+   sym_set_value(pbr_symbols, _force_chs, forcechs);
 
if (verbose)
fprintf(stderr, %s is %d blocks x %d bytes\n,



readpassphrase constant flags

2014-01-21 Thread Fritjof Bornebusch
Hi tech,

these diffs use the constant RPP_ECHO_OFF described in the readpassphrase 
manpage and not to value 0x00 itself.

Regards,
Fritjof

Index: login_skey.c
===
RCS file: /cvs/src/libexec/login_skey/login_skey.c,v
retrieving revision 1.23
diff -u -p -u -r1.23 login_skey.c
--- login_skey.c2 Jun 2009 20:42:48 -   1.23
+++ login_skey.c21 Jan 2014 18:11:30 -
@@ -131,7 +131,7 @@ main(int argc, char *argv[])
if (haskey)
alarm(120);
resumed = 0;
-   if (!readpassphrase(challenge, response, sizeof(response), 0))
+   if (!readpassphrase(challenge, response, sizeof(response), 
RPP_ECHO_OFF))
exit(1);
if (response[0] == '\0')
readpassphrase(S/Key Password [echo on]: ,


Index: login_token.c
===
RCS file: /cvs/src/libexec/login_token/login_token.c,v
retrieving revision 1.11
diff -u -p -u -r1.11 login_token.c
--- login_token.c   3 Dec 2013 01:29:00 -   1.11
+++ login_token.c   21 Jan 2014 18:12:52 -
@@ -153,7 +153,7 @@ main(int argc, char *argv[])
exit(0);
}
 
-   pp = readpassphrase(challenge, response, sizeof(response), 0);
+   pp = readpassphrase(challenge, response, sizeof(response), 
RPP_ECHO_OFF);
if (pp == NULL)
exit(1);
if (*pp == '\0') {



Index: x99token.c
===
RCS file: /cvs/src/usr.bin/x99token/x99token.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 x99token.c
--- x99token.c  27 Nov 2013 00:13:22 -  1.9
+++ x99token.c  21 Jan 2014 18:14:33 -
@@ -81,7 +81,7 @@ main(int argc, char **argv)
}
 
if (init)
-   readpassphrase(Enter Key: , buf, sizeof(buf), 0);
+   readpassphrase(Enter Key: , buf, sizeof(buf), RPP_ECHO_OFF);
else if ((fp = fopen(keyfile, r)) == NULL)
err(1, unable to open %s, keyfile);
else {



Re: 5.5beta wierds

2014-01-21 Thread Todd C. Miller
On Tue, 21 Jan 2014 10:44:00 +0100, Otto Moerbeek wrote:

 And here's the man page diff, our ctime and asctime actually do not
 ever return NULL, while posix allows that.

Isn't it worth documenting that ctime and asctime are allowed to
return NULL, even though they do not on OpenBSD?

 - todd



Re: readpassphrase constant flags

2014-01-21 Thread Philip Guenther
On Wed, Jan 22, 2014 at 7:20 AM, Fritjof Bornebusch frit...@alokat.org wrote:
 Hi tech,

 these diffs use the constant RPP_ECHO_OFF described in the readpassphrase 
 manpage and not to value 0x00 itself.

I think this is a doc clarity/consistency issue.  The manpage says:
 readpassphrase() takes the following optional flags:

If the flags are optional, then you can leave them all out, which in
this case means you use zero.


We describe that sort of usage differently and more clearly in other
manpages.  I like regex(3)'s phrasing:
 cflags is the bitwise OR of zero or more of the following flags:

The phrasing of the *at(2) family of functions is slightly less clear
and seems a bit wordy to me on reflection.  fchmodat(2):
 Values for flag are constructed by bitwise-inclusive ORing flags from the
 following list defined in fcntl.h:

(followed by a list with only one item, though maybe POSIX will some
day add another)


Hmm, the wording for recv(2) is actually wrong:
 The flags argument to a recv call is formed by ORing one or more of the
 values:

N: it should say _zero_ or more...


jmc, what do you think?


Philip Guenther



IPv6 pseudo-header checksum

2014-01-21 Thread Christian Weisgerber
This diff splits the TCP/UDP/ICMPv6 checksumming for IPv6 into
separate calculations of the pseudo-header checksum and the rest,
just like we do for IPv4.  This should allow us to enable TX checksum
offload for IPv6 on some chipsets.

I'm uncertain how much consistency checking we want.

Also, this adds another call to ip6_lasthdr() per packet, and
ip6_lasthdr() calls ip6_nexthdr().  The function bodies are dirt
cheap, but I don't know what the cost of a function call is.

Parts of this came originally from NetBSD, I think.

M netinet6/in6.h
M netinet6/in6_cksum.c
M netinet6/ip6_output.c

Index: netinet6/in6.h
===
RCS file: /cvs/src/sys/netinet6/in6.h,v
retrieving revision 1.69
diff -u -p -r1.69 in6.h
--- netinet6/in6.h  28 Oct 2013 21:02:35 -  1.69
+++ netinet6/in6.h  21 Jan 2014 15:43:23 -
@@ -416,6 +416,54 @@ typedef__socklen_t socklen_t;  /* length
 #endif /* __BSD_VISIBLE */
 
 #ifdef _KERNEL
+/*
+ * in6_cksum_phdr:
+ *
+ * Compute significant parts of the IPv6 checksum pseudo-header
+ * for use in a delayed TCP/UDP checksum calculation.
+ *
+ * Args:
+ *
+ * src Source IPv6 address
+ * dst Destination IPv6 address
+ * len htonl(proto-hdr-len)
+ * nxt htonl(next-proto-number)
+ *
+ * NOTE: We expect the src and dst addresses to be 16-bit
+ * aligned!
+ */
+static __inline u_int16_t __attribute__((__unused__))
+in6_cksum_phdr(const struct in6_addr *src, const struct in6_addr *dst,
+u_int32_t len, u_int32_t nxt)
+{
+   u_int32_t sum = 0;
+   const u_int16_t *w;
+
+   w = (const u_int16_t *) src;
+   sum += w[0];
+   if (!IN6_IS_SCOPE_EMBED(src))
+   sum += w[1];
+   sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
+   sum += w[6]; sum += w[7];
+
+   w = (const u_int16_t *) dst;
+   sum += w[0];
+   if (!IN6_IS_SCOPE_EMBED(dst))
+   sum += w[1];
+   sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5];
+   sum += w[6]; sum += w[7];
+
+   sum += (u_int16_t)(len  16) + (u_int16_t)(len /* 0x*/);
+
+   sum += (u_int16_t)(nxt  16) + (u_int16_t)(nxt /* 0x*/);
+
+   sum = (u_int16_t)(sum  16) + (u_int16_t)(sum /* 0x*/);
+
+   if (sum  0x)
+   sum -= 0x;
+
+   return (sum);
+}
 
 extern u_char inet6ctlerrmap[];
 extern struct ifqueue ip6intrq;/* IP6 packet input queue */
Index: netinet6/in6_cksum.c
===
RCS file: /cvs/src/sys/netinet6/in6_cksum.c,v
retrieving revision 1.15
diff -u -p -r1.15 in6_cksum.c
--- netinet6/in6_cksum.c11 Jun 2008 19:00:50 -  1.15
+++ netinet6/in6_cksum.c21 Jan 2014 15:38:27 -
@@ -115,6 +115,10 @@ in6_cksum(struct mbuf *m, u_int8_t nxt, 
m-m_pkthdr.len, off, len);
}
 
+   /* Skip pseudo-header if nxt == 0. */
+   if (nxt == 0)
+goto skip_phdr;
+
bzero(uph, sizeof(uph));
 
/*
@@ -141,6 +145,7 @@ in6_cksum(struct mbuf *m, u_int8_t nxt, 
sum += uph.phs[0];  sum += uph.phs[1];
sum += uph.phs[2];  sum += uph.phs[3];
 
+skip_phdr:
/*
 * Secondly calculate a summary of the first mbuf excluding offset.
 */
Index: netinet6/ip6_output.c
===
RCS file: /cvs/src/sys/netinet6/ip6_output.c,v
retrieving revision 1.150
diff -u -p -r1.150 ip6_output.c
--- netinet6/ip6_output.c   21 Jan 2014 10:18:26 -  1.150
+++ netinet6/ip6_output.c   21 Jan 2014 18:30:03 -
@@ -3211,7 +3211,7 @@ in6_delayed_cksum(struct mbuf *m, u_int8
if (offset = 0 || nxtp != nxt)
/* If the desired next protocol isn't found, punt. */
return;
-   csum = (u_int16_t)(in6_cksum(m, nxt, offset, m-m_pkthdr.len - offset));
+   csum = (u_int16_t)(in6_cksum(m, 0, offset, m-m_pkthdr.len - offset));
 
switch (nxt) {
case IPPROTO_TCP:
@@ -3238,6 +3238,29 @@ in6_delayed_cksum(struct mbuf *m, u_int8
 void
 in6_proto_cksum_out(struct mbuf *m, struct ifnet *ifp)
 {
+   /* some hw and in6_delayed_cksum need the pseudo header cksum */
+   if (m-m_pkthdr.csum_flags 
+   (M_TCP_CSUM_OUT|M_UDP_CSUM_OUT|M_ICMP_CSUM_OUT)) {
+   struct ip6_hdr *ip6;
+   int nxt, offset;
+   u_int16_t csum;
+
+   ip6 = mtod(m, struct ip6_hdr *);
+   offset = ip6_lasthdr(m, 0, IPPROTO_IPV6, nxt);
+   csum = in6_cksum_phdr(ip6-ip6_src, ip6-ip6_dst,
+   htonl(m-m_pkthdr.len - offset), htonl(nxt));
+   if (nxt == IPPROTO_TCP)
+   offset += offsetof(struct tcphdr, th_sum);
+   else if (nxt == IPPROTO_UDP)
+   offset += 

tmpfs kqueue

2014-01-21 Thread Ted Unangst
As noticed by aja, kqueue doesn't work on tmpfs.

Copy more better bits from ufs instead of using generic bits.

Index: tmpfs_vnops.c
===
RCS file: /cvs/src/sys/tmpfs/tmpfs_vnops.c,v
retrieving revision 1.12
diff -u -p -r1.12 tmpfs_vnops.c
--- tmpfs_vnops.c   7 Jan 2014 04:44:56 -   1.12
+++ tmpfs_vnops.c   21 Jan 2014 20:34:26 -
@@ -53,6 +53,7 @@ __KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.
 #include sys/vnode.h
 #include sys/lockf.h
 #include sys/poll.h
+#include sys/file.h
 
 #include uvm/uvm.h
 
@@ -60,6 +61,8 @@ __KERNEL_RCSID(0, $NetBSD: tmpfs_vnops.
 #include tmpfs/tmpfs_vnops.h
 #include tmpfs/tmpfs.h
 
+int tmpfs_kqfilter(void *v);
+
 /*
  * vnode operations vector used for files stored in a tmpfs file system.
  */
@@ -76,7 +79,7 @@ struct vops tmpfs_vops = {
.vop_write  = tmpfs_write,
.vop_ioctl  = tmpfs_ioctl,
.vop_poll   = tmpfs_poll,
-   .vop_kqfilter   = vop_generic_kqfilter,
+   .vop_kqfilter   = tmpfs_kqfilter,
.vop_revoke = vop_generic_revoke,
.vop_fsync  = tmpfs_fsync,
.vop_remove = tmpfs_remove,
@@ -2567,4 +2570,104 @@ tmpfs_rename_abort(void *v)
VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
+}
+
+void filt_tmpfsdetach(struct knote *kn);
+int filt_tmpfsread(struct knote *kn, long hint);
+int filt_tmpfswrite(struct knote *kn, long hint);
+int filt_tmpfsvnode(struct knote *kn, long hint);
+
+struct filterops tmpfsread_filtops = 
+   { 1, NULL, filt_tmpfsdetach, filt_tmpfsread };
+struct filterops tmpfswrite_filtops = 
+   { 1, NULL, filt_tmpfsdetach, filt_tmpfswrite };
+struct filterops tmpfsvnode_filtops = 
+   { 1, NULL, filt_tmpfsdetach, filt_tmpfsvnode };
+
+int
+tmpfs_kqfilter(void *v)
+{
+   struct vop_kqfilter_args *ap = v;
+   struct vnode *vp = ap-a_vp;
+   struct knote *kn = ap-a_kn;
+
+   switch (kn-kn_filter) {
+   case EVFILT_READ:
+   kn-kn_fop = tmpfsread_filtops;
+   break;
+   case EVFILT_WRITE:
+   kn-kn_fop = tmpfswrite_filtops;
+   break;
+   case EVFILT_VNODE:
+   kn-kn_fop = tmpfsvnode_filtops;
+   break;
+   default:
+   return (EINVAL);
+   }
+
+   kn-kn_hook = (caddr_t)vp;
+
+   SLIST_INSERT_HEAD(vp-v_selectinfo.si_note, kn, kn_selnext);
+
+   return (0);
+}
+
+void
+filt_tmpfsdetach(struct knote *kn)
+{
+   struct vnode *vp = (struct vnode *)kn-kn_hook;
+
+   SLIST_REMOVE(vp-v_selectinfo.si_note, kn, knote, kn_selnext);
+}
+
+int
+filt_tmpfsread(struct knote *kn, long hint)
+{
+   struct vnode *vp = (struct vnode *)kn-kn_hook;
+   tmpfs_node_t *node = VP_TO_TMPFS_NODE(vp);
+
+   /*
+* filesystem is gone, so set the EOF flag and schedule 
+* the knote for deletion.
+*/
+   if (hint == NOTE_REVOKE) {
+   kn-kn_flags |= (EV_EOF | EV_ONESHOT);
+   return (1);
+   }
+
+kn-kn_data = node-tn_size - kn-kn_fp-f_offset;
+   if (kn-kn_data == 0  kn-kn_sfflags  NOTE_EOF) {
+   kn-kn_fflags |= NOTE_EOF;
+   return (1);
+   }
+
+return (kn-kn_data != 0);
+}
+
+int
+filt_tmpfswrite(struct knote *kn, long hint)
+{
+   /*
+* filesystem is gone, so set the EOF flag and schedule 
+* the knote for deletion.
+*/
+   if (hint == NOTE_REVOKE) {
+   kn-kn_flags |= (EV_EOF | EV_ONESHOT);
+   return (1);
+   }
+
+kn-kn_data = 0;
+return (1);
+}
+
+int
+filt_tmpfsvnode(struct knote *kn, long hint)
+{
+   if (kn-kn_sfflags  hint)
+   kn-kn_fflags |= hint;
+   if (hint == NOTE_REVOKE) {
+   kn-kn_flags |= EV_EOF;
+   return (1);
+   }
+   return (kn-kn_fflags != 0);
 }



Re: readpassphrase constant flags

2014-01-21 Thread Fritjof Bornebusch
Philip Guenther guent...@gmail.com schrieb am Wed, 22. Jan 08:48:
 On Wed, Jan 22, 2014 at 7:20 AM, Fritjof Bornebusch frit...@alokat.org 
 wrote:
  Hi tech,
 
  these diffs use the constant RPP_ECHO_OFF described in the readpassphrase 
  manpage and not to value 0x00 itself.
 
 I think this is a doc clarity/consistency issue.  The manpage says:
  readpassphrase() takes the following optional flags:
 
 If the flags are optional, then you can leave them all out, which in
 this case means you use zero.
 
That's true, but zero is a constant that is described in the manpage.
If I take a look at the code and in the manpage in order to see how to call the
function and I see a zero in the function call as�a flag I wouldn't know that 
zero means RPP_ECHO_OFF.
So it makes it a lot more clear to me, to understand what the code is doing. 

 
 We describe that sort of usage differently and more clearly in other
 manpages.  I like regex(3)'s phrasing:
  cflags is the bitwise OR of zero or more of the following flags:
 
 The phrasing of the *at(2) family of functions is slightly less clear
 and seems a bit wordy to me on reflection.  fchmodat(2):
  Values for flag are constructed by bitwise-inclusive ORing flags from the
  following list defined in fcntl.h:
 
 (followed by a list with only one item, though maybe POSIX will some
 day add another)
 
 
 Hmm, the wording for recv(2) is actually wrong:
  The flags argument to a recv call is formed by ORing one or more of the
  values:
 
 N: it should say _zero_ or more...
 
 
 jmc, what do you think?
 
 
 Philip Guenther
 
Regards,
Fritjof



Re: readpassphrase constant flags

2014-01-21 Thread Todd C. Miller
On Wed, 22 Jan 2014 08:48:29 +1300, Philip Guenther wrote:

 I think this is a doc clarity/consistency issue.  The manpage says:
  readpassphrase() takes the following optional flags:
 
 If the flags are optional, then you can leave them all out, which in
 this case means you use zero.

It also says:

RPP_ECHO_OFFturn off echo (default behavior)

How is this unclear?

 - todd



Re: relayd: crash with two listen on (one is ssl)

2014-01-21 Thread Sebastian Benoit
This has been commited, thanks!

Erik Lax(e...@halon.se) on 2013.11.19 22:40:38 +0100:
 Hi,
 
 In relayd, if a relay is configured with two listen on directives, one
 with ssl and one without. In the relay_inherit function the ssl pointers
 (cert and key) are copied to the latter, and used/freed even if F_SSL is
 not set. This causes a double free later in purge_relay.
 
 relay http {
   listen on 127.0.0.1 port 4433 ssl
   listen on 127.0.0.1 port 8080
   forward with ssl to 127.0.0.1 port 443
 }
 
 There following patch fixes this.
 
 --- usr.sbin/relayd/parse.y.orig  Tue Nov 19 22:10:48 2013
 +++ usr.sbin/relayd/parse.y   Tue Nov 19 22:09:41 2013
 @@ -2809,6 +2809,12 @@
   rb-rl_conf.port = rc.port;
   rb-rl_conf.flags =
   (ra-rl_conf.flags  ~F_SSL) | (rc.flags  F_SSL);
 + if (!(rb-rl_conf.flags  F_SSL)) {
 + rb-rl_ssl_cert = NULL;
 + rb-rl_conf.ssl_cert_len = 0;
 + rb-rl_ssl_key = NULL;
 + rb-rl_conf.ssl_key_len = 0;
 + }
   TAILQ_INIT(rb-rl_tables);
 
   rb-rl_conf.id = ++last_relay_id;
 

-- 



Re: pflow(4) with optional flowsrc

2014-01-21 Thread Sebastian Benoit
this has been commited, thanks!

Nathanael Rensen(nathanael.open...@list.polymorpheus.com) on 2014.01.18 
23:49:26 +0800:
 Some time ago I proposed a diff to allow pflow(4) to determine the src IP
 address based on the route table if flowsrc was not specified. That diff
 was not accepted because having multiple places look up route tables is
 undesirable.
 
 Since then henning@ moved UDP checksum calcs into ip_output. That makes
 it very simple to allow the pflow flowsrc parameter to be optional. This
 diff permits the flowsrc parameter to be unspecified, as was permitted
 prior to version 1.35 of if_flow.c, except that now, thanks to henning@,
 it works.
 
 Nathanael
 
 
 Index: sbin/ifconfig/ifconfig.8
 ===
 RCS file: /cvs/src/sbin/ifconfig/ifconfig.8,v
 retrieving revision 1.237
 diff -u -p -u -p -r1.237 ifconfig.8
 --- sbin/ifconfig/ifconfig.8  13 Oct 2013 10:45:34 -  1.237
 +++ sbin/ifconfig/ifconfig.8  15 Jan 2014 18:20:18 -
 @@ -1224,12 +1224,11 @@ Pflow data will be sent to this address/
  Unset the receiver address and stop sending pflow data.
  .It Cm flowsrc Ar addr
  Set the source IP address for pflow packets.
 -Must be defined to export pflow data.
  .Ar addr
  is the IP address used as sender of the UDP packets and may be used to
  identify the source of the data on the pflow collector.
  .It Fl flowsrc
 -Unset the source address and stop sending pflow data.
 +Unset the source address.
  .It Cm pflowproto Ar n
  Set the protocol version.
  The default is version 5.
 Index: sbin/ifconfig/ifconfig.c
 ===
 RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
 retrieving revision 1.280
 diff -u -p -u -p -r1.280 ifconfig.c
 --- sbin/ifconfig/ifconfig.c  1 Dec 2013 10:05:29 -   1.280
 +++ sbin/ifconfig/ifconfig.c  15 Jan 2014 18:20:18 -
 @@ -3879,8 +3879,9 @@ pflow_status(void)
   if (ioctl(s, SIOCGETPFLOW, (caddr_t)ifr) == -1)
return;
  
 - printf(\tpflow: sender: %s , preq.sender_ip.s_addr != INADDR_ANY ?
 - inet_ntoa(preq.sender_ip) : INVALID);
 + printf(\tpflow: );
 + if (preq.sender_ip.s_addr != INADDR_ANY)
 + printf(sender: %s , inet_ntoa(preq.sender_ip));
   printf(receiver: %s:, preq.receiver_ip.s_addr != INADDR_ANY ?
   inet_ntoa(preq.receiver_ip) : INVALID);
   if (preq.receiver_port == 0)
 Index: share/man/man4/pflow.4
 ===
 RCS file: /cvs/src/share/man/man4/pflow.4,v
 retrieving revision 1.16
 diff -u -p -u -p -r1.16 pflow.4
 --- share/man/man4/pflow.414 Sep 2013 14:54:30 -  1.16
 +++ share/man/man4/pflow.415 Jan 2014 18:20:18 -
 @@ -42,8 +42,7 @@ Multiple
  interfaces can be created at runtime using the
  .Ic ifconfig pflow Ns Ar N Ic create
  command.
 -Each interface must be configured with a flow sender IP address,
 -a flow receiver IP address,
 +Each interface must be configured with a flow receiver IP address
  and a flow receiver port number.
  .Pp
  Only states created by a rule marked with the
 @@ -92,8 +91,6 @@ collector.
  .Cm flowdst
  defines the collector IP address and the port.
  The
 -.Cm flowsrc
 -IP address and
  .Cm flowdst
  IP address and port must be defined to enable the export of flows.
  .Pp
 Index: sys/net/if_pflow.c
 ===
 RCS file: /cvs/src/sys/net/if_pflow.c,v
 retrieving revision 1.38
 diff -u -p -u -p -r1.38 if_pflow.c
 --- sys/net/if_pflow.c1 Nov 2013 14:34:27 -   1.38
 +++ sys/net/if_pflow.c15 Jan 2014 18:20:23 -
 @@ -426,7 +426,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd
   if ((ifp-if_flags  IFF_UP) 
   sc-sc_receiver_ip.s_addr != INADDR_ANY 
   sc-sc_receiver_port != 0 
 - sc-sc_sender_ip.s_addr != INADDR_ANY 
   sc-sc_sender_port != 0) {
   ifp-if_flags |= IFF_RUNNING;
   sc-sc_gcounter=pflowstats.pflow_flows;
 @@ -506,7 +505,6 @@ pflowioctl(struct ifnet *ifp, u_long cmd
   if ((ifp-if_flags  IFF_UP) 
   sc-sc_receiver_ip.s_addr != INADDR_ANY 
   sc-sc_receiver_port != 0 
 - sc-sc_sender_ip.s_addr != INADDR_ANY 
   sc-sc_sender_port != 0) {
   ifp-if_flags |= IFF_RUNNING;
   sc-sc_gcounter=pflowstats.pflow_flows;
 

-- 



Re: 5.5beta wierds

2014-01-21 Thread David Walker
Rod Whitworth loki () witworx ! com
 I feel that date should spit out an error message rather than
 crash even if it only happens when some idiot plays with the numbers.

Every time you do that I get a little bit sadder.
Leave something for me.



Re: readpassphrase constant flags

2014-01-21 Thread Fritjof Bornebusch
Todd C. Miller todd.mil...@courtesan.com schrieb am Tue, 21. Jan 14:38:
 On Wed, 22 Jan 2014 08:48:29 +1300, Philip Guenther wrote:
 
  I think this is a doc clarity/consistency issue.  The manpage says:
   readpassphrase() takes the following optional flags:
  
  If the flags are optional, then you can leave them all out, which in
  this case means you use zero.
 
 It also says:
 
 RPP_ECHO_OFFturn off echo (default behavior)
 
 How is this unclear?
RPP_ECHO_OFF is the default behaviour, zero is not. 

But I don't want to start a huge discussion about the usage of zero or a 
constant.
It just strikes me. 

 
  - todd
 

Regards,
Fritjof



PATCH: fix bug in handling genmask

2014-01-21 Thread Kieran Devlin
hope this time i get the part ‘poke claudio@’ right


a. fix a bug.
b. get rid of some junk in ‘mask_rnhead’.
c. forbid unprivileged user to insert ‘genmask' into ‘mask_rnhead'

bug is in this line
memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1, (caddr_t *)t-rn_key 
+ 1, ((struct sockaddr *)t-rn_key)-sa_len) 
to make this right, at least, it should look like this
memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1, (caddr_t *)t-rn_key 
+ 1, ((struct sockaddr *)t-rn_key)-sa_len - 1)
after doing this, the whole checking seems completely unnecessary, is expected 
result from ‘rn_addmask’.

Index: net/rtsock.c
===
RCS file: /cvs/src/sys/net/rtsock.c,v
retrieving revision 1.136
diff -u -p -r1.136 rtsock.c
--- net/rtsock.c21 Jan 2014 10:08:02 -  1.136
+++ net/rtsock.c21 Jan 2014 21:27:32 -
@@ -564,20 +564,25 @@ route_output(struct mbuf *m, ...)
error = EINVAL;
goto flush;
}
-   if (info.rti_info[RTAX_GENMASK] != NULL) {
-   struct radix_node   *t;
-   t = rn_addmask(info.rti_info[RTAX_GENMASK], 0, 1);
-   if (t  info.rti_info[RTAX_GENMASK]-sa_len =
-   ((struct sockaddr *)t-rn_key)-sa_len 
-   memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1,
-   (caddr_t *)t-rn_key + 1,
-   ((struct sockaddr *)t-rn_key)-sa_len) - 1)
-   info.rti_info[RTAX_GENMASK] =
-   (struct sockaddr *)(t-rn_key);
-   else {
+   if (info.rti_info[RTAX_GENMASK] != NULL  rtm-rtm_type != RTM_GET) {
+   rnh = rt_gettable(info.rti_info[RTAX_DST]-sa_family, tableid);
+   if (rnh == NULL) {
+   error = EINVAL;
+   goto flush;
+   }
+   rn = rn_addmask(info.rti_info[RTAX_GENMASK], 0,
+   rnh-rnh_treetop-rn_off);
+   if (rn == NULL) {
error = ENOBUFS;
goto flush;
}
+   if (!((struct sockaddr *)rn-rn_key)-sa_len) {
+   error = EINVAL;
+   goto flush;
+   }
+   info.rti_info[RTAX_GENMASK] = (struct sockaddr *)rn-rn_key;
+   } else {
+   info.rti_info[RTAX_GENMASK] = NULL;
}
 #ifdef MPLS
info.rti_mpls = rtm-rtm_mpls;




udav(4): add CoreChip RD9700 support

2014-01-21 Thread SASANO Takayoshi
Hi,

Here is a patch adding CoreChip RD9700 support to udav(4).

The chip is used by USB-Ethernet dongles for Android gadget, they are
sold at eBay with cheap price tag (under 5.00 USD).

RD9700 is bad DM9601 copy.

The description of these dongles says USB 2.0 10/100Mbps but
actually they work with USB 1.1 (full-speed) and 10Mbps half-duplex.

They have no serial EEPROM, no different MAC address. I have two
dongles and they have same address (00:e0:4c:53:44:58) and Windows'
driver sets 00:01:0a:XX:XX:XX (XX:XX:XX is different).

RD9700 does not have MII-PHY so the patch simply bypasses MII related
routine.

The performance is poor, receive is extremely slow.

At RD9700's bulk-in pipe, sometimes there is no Zero-Length-Packet
(ZLP) to show the end of USB transaction. The device uses one Ethernet
frame as one USB transaction, so no ZLP makes dropping frame. There is
no remedy for this problem.

Comments or ok?

Regards,
-- 
SASANO Takayoshi u...@mx5.nisiq.net

Index: if_udav.c
===
RCS file: /cvs/src/sys/dev/usb/if_udav.c,v
retrieving revision 1.64
diff -u -p -r1.64 if_udav.c
--- if_udav.c   15 Nov 2013 10:17:39 -  1.64
+++ if_udav.c   21 Jan 2014 21:06:30 -
@@ -109,6 +109,7 @@ void udav_txeof(struct usbd_xfer *, void
 void udav_rxeof(struct usbd_xfer *, void *, usbd_status);
 void udav_tick(void *);
 void udav_tick_task(void *);
+void udav_tick_task_rd9700(void *);
 int udav_ioctl(struct ifnet *, u_long, caddr_t);
 void udav_stop_task(struct udav_softc *);
 void udav_stop(struct ifnet *, int);
@@ -155,6 +156,7 @@ static const struct udav_type {
struct usb_devno udav_dev;
u_int16_t udav_flags;
 #define UDAV_EXT_PHY   0x0001
+#define UDAV_RD97000x0002
 } udav_devs [] = {
{{ USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB_TXC }, 0 },
{{ USB_VENDOR_DAVICOM, USB_PRODUCT_DAVICOM_DM9601 }, 0 },
@@ -164,7 +166,8 @@ static const struct udav_type {
{{ USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ZT6688 }, 0 },
{{ USB_VENDOR_SHANTOU, USB_PRODUCT_SHANTOU_ADM8515 }, 0 },
{{ USB_VENDOR_UNKNOWN4, USB_PRODUCT_UNKNOWN4_DM9601 }, 0 },
-   {{ USB_VENDOR_UNKNOWN6, USB_PRODUCT_UNKNOWN6_DM9601 }, 0 }
+   {{ USB_VENDOR_UNKNOWN6, USB_PRODUCT_UNKNOWN6_DM9601 }, 0 },
+   {{ USB_VENDOR_UNKNOWN4, USB_PRODUCT_UNKNOWN4_RD9700 }, UDAV_RD9700 },
 };
 #define udav_lookup(v, p) ((struct udav_type *)usb_lookup(udav_devs, v, p))
 
@@ -202,6 +205,7 @@ udav_attach(struct device *parent, struc
printf(%s: , devname);
 
sc-sc_udev = dev;
+   sc-sc_flags = udav_lookup(uaa-vendor, uaa-product)-udav_flags;
 
/* Move the device into the configured state. */
err = usbd_set_config_no(dev, UDAV_CONFIG_NO, 1);
@@ -210,8 +214,8 @@ udav_attach(struct device *parent, struc
goto bad;
}
 
-   usb_init_task(sc-sc_tick_task, udav_tick_task, sc,
-   USB_TASK_TYPE_GENERIC);
+   usb_init_task(sc-sc_tick_task, (sc-sc_flags  UDAV_RD9700) ?
+   udav_tick_task_rd9700 : udav_tick_task, sc, USB_TASK_TYPE_GENERIC);
rw_init(sc-sc_mii_lock, udavmii);
usb_init_task(sc-sc_stop_task, (void (*)(void *)) udav_stop_task, sc,
USB_TASK_TYPE_GENERIC);
@@ -224,7 +228,6 @@ udav_attach(struct device *parent, struc
}
 
sc-sc_ctl_iface = iface;
-   sc-sc_flags = udav_lookup(uaa-vendor, uaa-product)-udav_flags;
 
/* get interface descriptor */
id = usbd_get_interface_descriptor(sc-sc_ctl_iface);
@@ -294,12 +297,20 @@ udav_attach(struct device *parent, struc
mii-mii_flags = MIIF_AUTOTSLEEP;
ifmedia_init(mii-mii_media, 0,
 udav_ifmedia_change, udav_ifmedia_status);
-   mii_attach(self, mii, 0x, MII_PHY_ANY, MII_OFFSET_ANY, 0);
-   if (LIST_FIRST(mii-mii_phys) == NULL) {
+   if (sc-sc_flags  UDAV_RD9700) {
+   /* no MII-PHY */
ifmedia_add(mii-mii_media, IFM_ETHER | IFM_NONE, 0, NULL);
ifmedia_set(mii-mii_media, IFM_ETHER | IFM_NONE);
-   } else
-   ifmedia_set(mii-mii_media, IFM_ETHER | IFM_AUTO);
+   } else {
+   mii_attach(self, mii, 0x, 
+  MII_PHY_ANY, MII_OFFSET_ANY, 0);
+   if (LIST_FIRST(mii-mii_phys) == NULL) {
+   ifmedia_add(mii-mii_media, IFM_ETHER | IFM_NONE,
+   0, NULL);
+   ifmedia_set(mii-mii_media, IFM_ETHER | IFM_NONE);
+   } else
+   ifmedia_set(mii-mii_media, IFM_ETHER | IFM_AUTO);
+   }
 
/* attach the interface */
if_attach(ifp);
@@ -342,7 +353,8 @@ udav_detach(struct device *self, int fla
if (ifp-if_flags  IFF_RUNNING)
udav_stop(GET_IFP(sc), 1);
 
-   mii_detach(sc-sc_mii, MII_PHY_ANY, MII_OFFSET_ANY);
+   if (!(sc-sc_flags  UDAV_RD9700))
+   

Buggy i386 install55.iso

2014-01-21 Thread Rod Whitworth
Date 2014-01-20 
Downloaded copies from two mirrors same result.
Second one from Edmonton.

Doing install (not doing upgrade etc) process gets to the point of
loading sets and crashes with a 5 line message that disappears before I
can memorise it and a faster small message that gets away from me.

Tested on two disparate machines - same result.

Repeatability 100%.

I'll try an amd64 and report result.

/R/

*** NOTE *** Please DO NOT CC me. I am subscribed to the list.
Mail to the sender address that does not originate at the list server is 
tarpitted. The reply-to: address is provided for those who feel compelled to 
reply off list. Thankyou.

Rod/
---
This life is not the real thing.
It is not even in Beta.
If it was, then OpenBSD would already have a man page for it.




Re: Buggy i386 install55.iso

2014-01-21 Thread Rod Whitworth
On Wed, 22 Jan 2014 12:09:44 +1100, Rod Whitworth wrote:

Date 2014-01-20 
Downloaded copies from two mirrors same result.
Second one from Edmonton.

Doing install (not doing upgrade etc) process gets to the point of
loading sets and crashes with a 5 line message that disappears before I
can memorise it and a faster small message that gets away from me.

Tested on two disparate machines - same result.

Repeatability 100%.

I'll try an amd64 and report result.

/R/

The bug is not evident in either test machine running amd64 snap dated
Jan 20 (presently the one on offer in snapshots)

/R/

*** NOTE *** Please DO NOT CC me. I am subscribed to the list.
Mail to the sender address that does not originate at the list server is 
tarpitted. The reply-to: address is provided for those who feel compelled to 
reply off list. Thankyou.

Rod/
---
This life is not the real thing.
It is not even in Beta.
If it was, then OpenBSD would already have a man page for it.




Re: PATCH: fix bug in handling genmask

2014-01-21 Thread Claudio Jeker
On Wed, Jan 22, 2014 at 06:29:57AM +0800, Kieran Devlin wrote:
 hope this time i get the part ?poke claudio@? right
 
 
 a. fix a bug.
 b. get rid of some junk in ?mask_rnhead?.
 c. forbid unprivileged user to insert ?genmask' into ?mask_rnhead'
 
 bug is in this line
   memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1, (caddr_t *)t-rn_key 
 + 1, ((struct sockaddr *)t-rn_key)-sa_len) 
 to make this right, at least, it should look like this
   memcmp((caddr_t *)info.rti_info[RTAX_GENMASK] + 1, (caddr_t *)t-rn_key 
 + 1, ((struct sockaddr *)t-rn_key)-sa_len - 1)
 after doing this, the whole checking seems completely unnecessary, is 
 expected result from ?rn_addmask?.
 

While your diff is probably right I prefer to just nuke genmask support.
So I propose the following two diffs (kernel, userland) to get rid of it.
I was thinking about genmask a bit and I see no reason to keep it around.

What do people think?
-- 
:wq Claudio

 userland bits 

Just remove all genmask / GENMASK references from userland code.
route(8) will no longer allow -genmask but route monitor will still
show GENMASK if something sets it.
route6d no longer needs to look for GENMASK sockaddrs since the kernel
will not allow them.

Index: sbin/route/keywords.h
===
RCS file: /cvs/src/sbin/route/keywords.h,v
retrieving revision 1.27
diff -u -p -r1.27 keywords.h
--- sbin/route/keywords.h   4 Sep 2010 08:06:09 -   1.27
+++ sbin/route/keywords.h   22 Jan 2014 03:05:51 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: keywords.h,v 1.27 2010/09/04 08:06:09 blambert Exp $ */
+/* $OpenBSD$ */
 
 /* WARNING!  This file was generated by keywords.sh  */
 
@@ -20,7 +20,6 @@ enum {
K_EXPIRE,
K_FLUSH,
K_GATEWAY,
-   K_GENMASK,
K_GET,
K_HOPCOUNT,
K_HOST,
@@ -78,7 +77,6 @@ struct keytab keywords[] = {
{ expire, K_EXPIRE },
{ flush,  K_FLUSH },
{ gateway,K_GATEWAY },
-   { genmask,K_GENMASK },
{ get,K_GET },
{ hopcount,   K_HOPCOUNT },
{ host,   K_HOST },
Index: sbin/route/keywords.sh
===
RCS file: /cvs/src/sbin/route/keywords.sh,v
retrieving revision 1.25
diff -u -p -r1.25 keywords.sh
--- sbin/route/keywords.sh  4 Sep 2010 08:06:09 -   1.25
+++ sbin/route/keywords.sh  22 Jan 2014 03:05:40 -
@@ -21,7 +21,6 @@ exec
 expire
 flush
 gateway
-genmask
 get
 host
 hopcount
Index: sbin/route/route.8
===
RCS file: /cvs/src/sbin/route/route.8,v
retrieving revision 1.71
diff -u -p -r1.71 route.8
--- sbin/route/route.8  27 May 2013 14:07:25 -  1.71
+++ sbin/route/route.8  22 Jan 2014 03:06:23 -
@@ -441,15 +441,6 @@ or
 modifiers may be used to determine the interface name or interface address.
 .Pp
 The optional
-.Fl genmask
-modifier specifies that a cloning mask is present.
-This specifies the mask applied when determining if a child route should
-be created.
-It is only applicable to network routes with the
-.Dv RTF_CLONING
-flag set.
-.Pp
-The optional
 .Fl label
 modifier specifies on route addition or modification that the route
 should have the given
Index: sbin/route/route.c
===
RCS file: /cvs/src/sbin/route/route.c,v
retrieving revision 1.165
diff -u -p -r1.165 route.c
--- sbin/route/route.c  28 Oct 2013 15:05:35 -  1.165
+++ sbin/route/route.c  22 Jan 2014 03:07:15 -
@@ -62,7 +62,7 @@
 const struct if_status_description
if_status_descriptions[] = LINK_STATE_DESCRIPTIONS;
 
-union sockunion so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp, 
so_label, so_src;
+union sockunion so_dst, so_gate, so_mask, so_ifa, so_ifp, so_label, so_src;
 
 typedef union sockunion *sup;
 pid_t  pid;
@@ -532,11 +532,6 @@ newroute(int argc, char **argv)
usage(1+*argv);
getaddr(RTA_IFP, *++argv, NULL);
break;
-   case K_GENMASK:
-   if (!--argc)
-   usage(1+*argv);
-   getaddr(RTA_GENMASK, *++argv, NULL);
-   break;
case K_GATEWAY:
if (!--argc)
usage(1+*argv);
@@ -828,9 +823,6 @@ getaddr(int which, char *s, struct hoste
case RTA_NETMASK:
su = so_mask;
break;
-   case RTA_GENMASK:
-   su = so_genmask;
-   break;
case RTA_IFP:
su = so_ifp;
afamily = AF_LINK;
@@ -852,7 +844,6 @@ getaddr(int which, char *s, struct hoste
getaddr(RTA_NETMASK, s, NULL);