svn commit: r246532 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-02-07 Thread Andriy Gapon
Author: avg
Date: Fri Feb  8 07:49:54 2013
New Revision: 246532
URL: http://svnweb.freebsd.org/changeset/base/246532

Log:
  zfs_vget, zfs_fhtovp: properly handle the z_shares_dir object
  
  A special gfs vnode corresponds to that object.
  A regular zfs vnode must not be returned.
  
  This should be upstreamed.
  
  Reported by:  pluknet
  Submitted by: rmacklem
  Tested by:pluknet
  MFC after:10 days

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Feb 
 8 07:44:15 2013(r246531)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cFri Feb 
 8 07:49:54 2013(r246532)
@@ -2009,7 +2009,8 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla
 * .zfs/snapshot/ directories, that's why we return EOPNOTSUPP.
 * This will make NFS to switch to LOOKUP instead of using VGET.
 */
-   if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR)
+   if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR ||
+   (zfsvfs->z_shares_dir != 0 && ino == zfsvfs->z_shares_dir))
return (EOPNOTSUPP);
 
ZFS_ENTER(zfsvfs);
@@ -2101,14 +2102,22 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int
return (EINVAL);
}
 
-   /* A zero fid_gen means we are in the .zfs control directories */
-   if (fid_gen == 0 &&
-   (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) {
+   /*
+* A zero fid_gen means we are in .zfs or the .zfs/snapshot
+* directory tree. If the object == zfsvfs->z_shares_dir, then
+* we are in the .zfs/shares directory tree.
+*/
+   if ((fid_gen == 0 &&
+(object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) ||
+   (zfsvfs->z_shares_dir != 0 && object == zfsvfs->z_shares_dir)) {
*vpp = zfsvfs->z_ctldir;
ASSERT(*vpp != NULL);
if (object == ZFSCTL_INO_SNAPDIR) {
VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL,
0, NULL, NULL, NULL, NULL, NULL) == 0);
+   } else if (object == zfsvfs->z_shares_dir) {
+   VERIFY(zfsctl_root_lookup(*vpp, "shares", vpp, NULL,
+   0, NULL, NULL, NULL, NULL, NULL) == 0);
} else {
VN_HOLD(*vpp);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246531 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2013-02-07 Thread Andriy Gapon
Author: avg
Date: Fri Feb  8 07:44:15 2013
New Revision: 246531
URL: http://svnweb.freebsd.org/changeset/base/246531

Log:
  zfs: update comments about zfid_long_t to match the FreeBSD definitions
  
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Feb  8 07:29:07 2013(r246530)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
Fri Feb  8 07:44:15 2013(r246531)
@@ -110,7 +110,7 @@ typedef struct zfid_short {
 } zfid_short_t;
 
 /*
- * Filesystems under .zfs/snapshot have a total file ID size of 22 bytes
+ * Filesystems under .zfs/snapshot have a total file ID size of 22[*] bytes
  * (including the length field).  This makes files under .zfs/snapshot
  * accessible by NFSv3 and NFSv4, but not NFSv2.
  *
@@ -120,10 +120,13 @@ typedef struct zfid_short {
  * 6 bytes object number (48 bits)
  * 4 bytes generation number (32 bits)
  * 6 bytes objset id (48 bits)
- * 4 bytes currently just zero (32 bits)
+ * 4 bytes[**] currently just zero (32 bits)
  *
  * We reserve only 48 bits for the object number and objset id, as these are
  * the limits currently defined and imposed by the DMU.
+ *
+ * [*] 20 bytes on FreeBSD to fit into the size of struct fid.
+ * [**] 2 bytes on FreeBSD for the above reason.
  */
 typedef struct zfid_long {
zfid_short_tz_fid;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246530 - head/sys/kern

2013-02-07 Thread Andriy Gapon
Author: avg
Date: Fri Feb  8 07:29:07 2013
New Revision: 246530
URL: http://svnweb.freebsd.org/changeset/base/246530

Log:
  ktr: correctly handle possible wrap-around in the boot buffer
  
  Older entries should be 'before' newer entries in the new buffer too
  and there should be no zero-filled gap between them.
  
  Pointed out by:   jhb
  MFC after:3 days
  X-MFC with:   r246282

Modified:
  head/sys/kern/kern_ktr.c

Modified: head/sys/kern/kern_ktr.c
==
--- head/sys/kern/kern_ktr.cFri Feb  8 03:54:06 2013(r246529)
+++ head/sys/kern/kern_ktr.cFri Feb  8 07:29:07 2013(r246530)
@@ -213,7 +213,11 @@ ktr_entries_initializer(void *dummy __un
ktr_mask = 0;
ktr_buf = malloc(sizeof(*ktr_buf) * KTR_ENTRIES, M_KTR,
M_WAITOK | M_ZERO);
-   memcpy(ktr_buf, ktr_buf_init, sizeof(ktr_buf_init));
+   memcpy(ktr_buf, ktr_buf_init + ktr_idx,
+   (KTR_BOOT_ENTRIES - ktr_idx) * sizeof(*ktr_buf));
+   if (ktr_idx != 0)
+   memcpy(ktr_buf + KTR_BOOT_ENTRIES - ktr_idx, ktr_buf_init,
+   ktr_idx * sizeof(*ktr_buf));
ktr_entries = KTR_ENTRIES;
ktr_mask = mask;
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246522 - head/bin/sh

2013-02-07 Thread Jilles Tjoelker
Author: jilles
Date: Thu Feb  7 22:42:33 2013
New Revision: 246522
URL: http://svnweb.freebsd.org/changeset/base/246522

Log:
  sh: Simplify mksyntax and make it fit for cross-compiling.
  
  Now it outputs fixed files, which use constants provided by the C standard
  library to determine appropriate values for the target machine.
  
  Before, mksyntax inspected the host machine which resulted in subtle
  breakage if e.g. char is signed on the host and unsigned on the target such
  as when cross-compiling on x86 for ARM.
  
  Tested using -funsigned-char on amd64. Compiling build-tools without it and
  sh itself with it causes various tests to fail without this change but not
  with this change. With consistent -funsigned-char, tests pass with or
  without this change.
  
  The mksyntax program could be removed and syntax.c and syntax.h committed to
  the repository.
  
  Submitted by: Christoph Mallon
  MFC after:2 weeks

Modified:
  head/bin/sh/mksyntax.c

Modified: head/bin/sh/mksyntax.c
==
--- head/bin/sh/mksyntax.c  Thu Feb  7 22:40:26 2013(r246521)
+++ head/bin/sh/mksyntax.c  Thu Feb  7 22:42:33 2013(r246522)
@@ -103,23 +103,16 @@ static char writer[] = "\
 
 static FILE *cfile;
 static FILE *hfile;
-static const char *syntax[513];
-static int base;
-static int size;   /* number of values which a char variable can have */
-static int nbits;  /* number of bits in a character */
 
-static void filltable(const char *);
-static void init(void);
+static void add_default(void);
+static void finish(void);
+static void init(const char *);
 static void add(const char *, const char *);
-static void print(const char *);
 static void output_type_macros(void);
 
 int
 main(int argc __unused, char **argv __unused)
 {
-   char c;
-   char d;
-   int sign;
int i;
char buf[80];
int pos;
@@ -136,27 +129,8 @@ main(int argc __unused, char **argv __un
fputs(writer, hfile);
fputs(writer, cfile);
 
-   /* Determine the characteristics of chars. */
-   c = -1;
-   sign = (c > 0) ? 0 : 1;
-   for (nbits = 1 ; ; nbits++) {
-   d = (1 << nbits) - 1;
-   if (d == c)
-   break;
-   }
-#if 0
-   printf("%s %d bit chars\n", sign? "signed" : "unsigned", nbits);
-#endif
-   if (nbits > 9) {
-   fputs("Characters can't have more than 9 bits\n", stderr);
-   exit(2);
-   }
-   size = (1 << nbits) + 1;
-   base = 1;
-   if (sign)
-   base += 1 << (nbits - 1);
-
fputs("#include \n", hfile);
+   fputs("#include \n\n", hfile);
 
/* Generate the #define statements in the header file */
fputs("/* Syntax classes */\n", hfile);
@@ -177,8 +151,8 @@ main(int argc __unused, char **argv __un
fprintf(hfile, "/* %s */\n", is_entry[i].comment);
}
putc('\n', hfile);
-   fprintf(hfile, "#define SYNBASE %d\n", base);
-   fprintf(hfile, "#define PEOF %d\n\n", -base);
+   fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile);
+   fputs("#define PEOF -SYNBASE\n\n", hfile);
putc('\n', hfile);
fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile);
fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile);
@@ -189,10 +163,13 @@ main(int argc __unused, char **argv __un
putc('\n', hfile);
 
/* Generate the syntax tables. */
+   fputs("#include \"parser.h\"\n", cfile);
fputs("#include \"shell.h\"\n", cfile);
fputs("#include \"syntax.h\"\n\n", cfile);
-   init();
+
fputs("/* syntax table used when not in quotes */\n", cfile);
+   init("basesyntax");
+   add_default();
add("\n", "CNL");
add("\\", "CBACK");
add("'", "CSQUOTE");
@@ -201,9 +178,11 @@ main(int argc __unused, char **argv __un
add("$", "CVAR");
add("}", "CENDVAR");
add("<>();&| \t", "CSPCL");
-   print("basesyntax");
-   init();
+   finish();
+
fputs("\n/* syntax table used when in double quotes */\n", cfile);
+   init("dqsyntax");
+   add_default();
add("\n", "CNL");
add("\\", "CBACK");
add("\"", "CENDQUOTE");
@@ -212,17 +191,21 @@ main(int argc __unused, char **argv __un
add("}", "CENDVAR");
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
add("!*?[]=~:/-^", "CCTL");
-   print("dqsyntax");
-   init();
+   finish();
+
fputs("\n/* syntax table used when in single quotes */\n", cfile);
+   init("sqsyntax");
+   add_default();
add("\n", "CNL");
add("\\", "CSBACK");
add("'", "CENDQUOTE");
/* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */
add("!*?[]=~:/-^", "CCTL");
-   print("sqsyntax");
-   init();
+   finish();
+
fputs("\n/* syntax 

svn commit: r246520 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:32:09 2013
New Revision: 246520
URL: http://svnweb.freebsd.org/changeset/base/246520

Log:
  Mesh: recevied GANN frames where not parsed correctly.
  
  * Added mesh_parse_meshgate_action that parse all values to host endian;
  * Add more detailed debug output;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_mesh.c

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:31:37 2013
(r246519)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:32:09 2013
(r246520)
@@ -533,9 +533,6 @@ mesh_gatemode_cb(void *arg)
struct ieee80211_mesh_state *ms = vap->iv_mesh;
struct ieee80211_meshgann_ie gann;
 
-   IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss,
-   "%s", "send broadcast GANN");
-
gann.gann_flags = 0; /* Reserved */
gann.gann_hopcount = 0;
gann.gann_ttl = ms->ms_ttl;
@@ -543,6 +540,9 @@ mesh_gatemode_cb(void *arg)
gann.gann_seq = ms->ms_gateseq++;
gann.gann_interval = ieee80211_mesh_gateint;
 
+   IEEE80211_NOTE(vap, IEEE80211_MSG_MESH, vap->iv_bss,
+   "send broadcast GANN (seq %u)", gann.gann_seq);
+
ieee80211_send_action(vap->iv_bss, IEEE80211_ACTION_CAT_MESH,
IEEE80211_ACTION_MESH_GANN, &gann);
mesh_gatemode_setup(vap);
@@ -2605,6 +2605,40 @@ mesh_recv_action_meshlmetric(struct ieee
 }
 
 /*
+ * Parse meshgate action ie's for GANN frames.
+ * Returns -1 if parsing fails, otherwise 0.
+ */
+static int
+mesh_parse_meshgate_action(struct ieee80211_node *ni,
+const struct ieee80211_frame *wh,  /* XXX for VERIFY_LENGTH */
+struct ieee80211_meshgann_ie *ie, const uint8_t *frm, const uint8_t *efrm)
+{
+   struct ieee80211vap *vap = ni->ni_vap;
+   const struct ieee80211_meshgann_ie *gannie;
+
+   while (efrm - frm > 1) {
+   IEEE80211_VERIFY_LENGTH(efrm - frm, frm[1] + 2, return -1);
+   switch (*frm) {
+   case IEEE80211_ELEMID_MESHGANN:
+   gannie = (const struct ieee80211_meshgann_ie *) frm;
+   memset(ie, 0, sizeof(ie));
+   ie->gann_ie = gannie->gann_ie;
+   ie->gann_len = gannie->gann_len;
+   ie->gann_flags = gannie->gann_flags;
+   ie->gann_hopcount = gannie->gann_hopcount;
+   ie->gann_ttl = gannie->gann_ttl;
+   IEEE80211_ADDR_COPY(ie->gann_addr, gannie->gann_addr);
+   ie->gann_seq = LE_READ_4(&gannie->gann_seq);
+   ie->gann_interval = LE_READ_2(&gannie->gann_interval);
+   break;
+   }
+   frm += frm[1] + 2;
+   }
+
+   return 0;
+}
+
+/*
  * Mesh Gate Announcement handling.
  */
 static int
@@ -2617,29 +2651,36 @@ mesh_recv_action_meshgate(struct ieee802
struct ieee80211_mesh_gate_route *gr, *next;
struct ieee80211_mesh_route *rt_gate;
struct ieee80211_meshgann_ie pgann;
+   struct ieee80211_meshgann_ie ie;
int found = 0;
-   const struct ieee80211_meshgann_ie *ie =
-   (const struct ieee80211_meshgann_ie *)
-   (frm+2); /* action + code */
 
-   if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr))
+   /* +2 for action + code */
+   if (mesh_parse_meshgate_action(ni, wh, &ie, frm+2, efrm) != 0) {
+   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
+   ni->ni_macaddr, NULL, "%s",
+   "GANN parsing failed");
+   vap->iv_stats.is_rx_mgtdiscard++;
+   return (0);
+   }
+
+   if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie.gann_addr))
return 0;
 
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr,
-   "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":",
-   ie->gann_seq);
+   "received GANN, meshgate: %6D (seq %u)", ie.gann_addr, ":",
+   ie.gann_seq);
 
if (ms == NULL)
return (0);
MESH_RT_LOCK(ms);
TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) {
-   if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr))
+   if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie.gann_addr))
continue;
-   if (ie->gann_seq <= gr->gr_lastseq) {
+   if (ie.gann_seq <= gr->gr_lastseq) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
ni->ni_macaddr, NULL,
"GANN old seqno %u <= %u",
-   ie->gann_seq, gr->gr_lastseq);
+   ie.gann_seq, gr->gr_lastseq);
MESH_RT_UNLOCK(ms);
return (0);
}
@@ -2650,14 +2691,14 @@ mesh_

svn commit: r246519 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:31:37 2013
New Revision: 246519
URL: http://svnweb.freebsd.org/changeset/base/246519

Log:
  Mesh HWMP forwarding information: updating FI for transmitter.
  
  * Added hwmp_update_transmitter function that checks if the metric
to the transmitter have improved. If old FI is invalid or metric
is larger the FI to the transmitter is updated occurdingly.
This is a recommendation from the 802.11 2012 standard, table 13-9;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:30:58 2013
(r246518)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:31:37 2013
(r246519)
@@ -896,6 +896,45 @@ hwmp_rootmode_rann_cb(void *arg)
hwmp_rootmode_setup(vap);
 }
 
+/*
+ * Update forwarding information to TA if metric improves.
+ */
+static void
+hwmp_update_transmitter(struct ieee80211vap *vap, struct ieee80211_node *ni,
+const char *hwmp_frame)
+{
+   struct ieee80211_mesh_state *ms = vap->iv_mesh;
+   struct ieee80211_mesh_route *rttran = NULL; /* Transmitter */
+   int metric = 0;
+
+   rttran = ieee80211_mesh_rt_find(vap, ni->ni_macaddr);
+   if (rttran == NULL) {
+   rttran = ieee80211_mesh_rt_add(vap, ni->ni_macaddr);
+   if (rttran == NULL) {
+   IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
+   "unable to add path to transmitter %6D of %s",
+   ni->ni_macaddr, ":", hwmp_frame);
+   vap->iv_stats.is_mesh_rtaddfailed++;
+   return;
+   }
+   }
+   metric = ms->ms_pmetric->mpm_metric(ni);
+   if (!(rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) ||
+   rttran->rt_metric > metric)
+   {
+   IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
+   "%s path to transmiter %6D of %s, metric %d:%d",
+   rttran->rt_flags & IEEE80211_MESHRT_FLAGS_VALID ?
+   "prefer" : "update", ni->ni_macaddr, ":", hwmp_frame,
+   rttran->rt_metric, metric);
+   IEEE80211_ADDR_COPY(rttran->rt_nexthop, ni->ni_macaddr);
+   rttran->rt_metric = metric;
+   rttran->rt_nhops  = 1;
+   ieee80211_mesh_rt_update(rttran, ms->ms_ppath->mpp_inact);
+   rttran->rt_flags = IEEE80211_MESHRT_FLAGS_VALID;
+   }
+}
+
 #definePREQ_TFLAGS(n)  preq->preq_targets[n].target_flags
 #definePREQ_TADDR(n)   preq->preq_targets[n].target_addr
 #definePREQ_TSEQ(n)preq->preq_targets[n].target_seq
@@ -1010,10 +1049,8 @@ hwmp_recv_preq(struct ieee80211vap *vap,
return;
}
 
-   /*
-* Forwarding information for transmitter mesh STA
-* [OPTIONAL: if metric improved]
-*/
+   /* Update forwarding information to TA if metric improves. */
+   hwmp_update_transmitter(vap, ni, "PREQ");
 
/*
 * Check if the PREQ is addressed to us.
@@ -1268,7 +1305,6 @@ hwmp_recv_prep(struct ieee80211vap *vap,
 * rules defined in 13.10.8.4). If the conditions for creating or
 * updating the forwarding information have not been met in those
 * rules, no further steps are applied to the PREP.
-* [OPTIONAL]: update forwarding information to TA if metric improves.
 */
rt = ieee80211_mesh_rt_find(vap, prep->prep_targetaddr);
if (rt == NULL) {
@@ -1323,6 +1359,9 @@ hwmp_recv_prep(struct ieee80211vap *vap,
}
rt->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID; /* mark valid */
 
+   /* Update forwarding information to TA if metric improves */
+   hwmp_update_transmitter(vap, ni, "PREP");
+
/*
 * If it's NOT for us, propagate the PREP
 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246518 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:30:58 2013
New Revision: 246518
URL: http://svnweb.freebsd.org/changeset/base/246518

Log:
  Mesh HWMP PERR bug fixes.
  
  * When calling ieee80211_mesh_rt_flush_peer, the rt->rt_dest argument
should not be passed because it can get freed before invalidating
the other routes that depends on it to compare with next_hop.
Use PERR_DADDR(i) instead;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:30:29 2013
(r246517)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:30:58 2013
(r246518)
@@ -1570,7 +1570,7 @@ hwmp_recv_perr(struct ieee80211vap *vap,
"PERR, unknown reason code %u\n", PERR_DFLAGS(i));
goto done; /* XXX: stats?? */
}
-   ieee80211_mesh_rt_flush_peer(vap, rt->rt_dest);
+   ieee80211_mesh_rt_flush_peer(vap, PERR_DADDR(i));
KASSERT(j < 32, ("PERR, error ndest >= 32 (%u)", j));
}
if (j == 0) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246517 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:30:29 2013
New Revision: 246517
URL: http://svnweb.freebsd.org/changeset/base/246517

Log:
  Mesh bug: debug infomartion showing swapped SA and DA address.
  
  * Fix bug for "forward frame from SA(%6D), DA(%6D)" where addresses where
swapped between SA and DA;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cThu Feb  7 21:29:48 2013
(r246516)
+++ head/sys/net80211/ieee80211_output.cThu Feb  7 21:30:29 2013
(r246517)
@@ -264,8 +264,8 @@ ieee80211_start(struct ifnet *ifp)
}
IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
"forward frame from DS SA(%6D), DA(%6D)\n",
-   eh->ether_dhost, ":",
-   eh->ether_shost, ":");
+   eh->ether_shost, ":",
+   eh->ether_dhost, ":");
ieee80211_mesh_proxy_check(vap, 
eh->ether_shost);
}
ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246516 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:29:48 2013
New Revision: 246516
URL: http://svnweb.freebsd.org/changeset/base/246516

Log:
  Update ddb to print mesh routing table.
  
  * Modified _db_show_vap and _db_show_com to print mesh routing table
if the 'm' modifier is specified;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_ddb.c

Modified: head/sys/net80211/ieee80211_ddb.c
==
--- head/sys/net80211/ieee80211_ddb.c   Thu Feb  7 21:29:14 2013
(r246515)
+++ head/sys/net80211/ieee80211_ddb.c   Thu Feb  7 21:29:48 2013
(r246516)
@@ -63,9 +63,9 @@ __FBSDID("$FreeBSD$");
 } while (0)
 
 static void _db_show_sta(const struct ieee80211_node *);
-static void _db_show_vap(const struct ieee80211vap *, int);
+static void _db_show_vap(const struct ieee80211vap *, int, int);
 static void _db_show_com(const struct ieee80211com *,
-   int showvaps, int showsta, int showprocs);
+   int showvaps, int showsta, int showmesh, int showprocs);
 
 static void _db_show_node_table(const char *tag,
const struct ieee80211_node_table *);
@@ -103,7 +103,7 @@ DB_SHOW_COMMAND(statab, db_show_statab)
 
 DB_SHOW_COMMAND(vap, db_show_vap)
 {
-   int i, showprocs = 0;
+   int i, showmesh = 0, showprocs = 0;
 
if (!have_addr) {
db_printf("usage: show vap \n");
@@ -113,18 +113,22 @@ DB_SHOW_COMMAND(vap, db_show_vap)
switch (modif[i]) {
case 'a':
showprocs = 1;
+   showmesh = 1;
+   break;
+   case 'm':
+   showmesh = 1;
break;
case 'p':
showprocs = 1;
break;
}
-   _db_show_vap((const struct ieee80211vap *) addr, showprocs);
+   _db_show_vap((const struct ieee80211vap *) addr, showmesh, showprocs);
 }
 
 DB_SHOW_COMMAND(com, db_show_com)
 {
const struct ieee80211com *ic;
-   int i, showprocs = 0, showvaps = 0, showsta = 0;
+   int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0;
 
if (!have_addr) {
db_printf("usage: show com \n");
@@ -133,11 +137,14 @@ DB_SHOW_COMMAND(com, db_show_com)
for (i = 0; modif[i] != '\0'; i++)
switch (modif[i]) {
case 'a':
-   showsta = showvaps = showprocs = 1;
+   showsta = showmesh = showvaps = showprocs = 1;
break;
case 's':
showsta = 1;
break;
+   case 'm':
+   showmesh = 1;
+   break;
case 'v':
showvaps = 1;
break;
@@ -147,7 +154,7 @@ DB_SHOW_COMMAND(com, db_show_com)
}
 
ic = (const struct ieee80211com *) addr;
-   _db_show_com(ic, showvaps, showsta, showprocs);
+   _db_show_com(ic, showvaps, showsta, showmesh, showprocs);
 }
 
 DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps)
@@ -178,7 +185,7 @@ DB_SHOW_ALL_COMMAND(vaps, db_show_all_va
vap->iv_ifp->if_xname, vap);
db_printf("\n");
} else
-   _db_show_com(ic, 1, 1, 1);
+   _db_show_com(ic, 1, 1, 1, 1);
}
}
 }
@@ -330,7 +337,7 @@ _db_show_tdma(const char *sep, const str
 #endif /* IEEE80211_SUPPORT_TDMA */
 
 static void
-_db_show_vap(const struct ieee80211vap *vap, int showprocs)
+_db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs)
 {
const struct ieee80211com *ic = vap->iv_ic;
int i;
@@ -341,6 +348,10 @@ _db_show_vap(const struct ieee80211vap *
db_printf("\n");
 
db_printf("\topmode %s", ieee80211_opmode_name[vap->iv_opmode]);
+#ifdef IEEE80211_SUPPORT_MESH
+   if (vap->iv_opmode == IEEE80211_M_MBSS)
+   db_printf("(%p)", vap->iv_mesh);
+#endif
db_printf(" state %s", ieee80211_state_name[vap->iv_state]);
db_printf(" ifp %p(%s)", vap->iv_ifp, vap->iv_ifp->if_xname);
db_printf("\n");
@@ -472,6 +483,10 @@ _db_show_vap(const struct ieee80211vap *
db_printf(" acl %p", vap->iv_acl);
db_printf(" as %p", vap->iv_as);
db_printf("\n");
+#ifdef IEEE80211_SUPPORT_MESH
+   if (showmesh && vap->iv_mesh != NULL)
+   _db_show_mesh(vap->iv_mesh);
+#endif
 #ifdef IEEE80211_SUPPORT_TDMA
if (vap->iv_tdma != NULL)
_db_show_tdma("\t", vap->iv_tdma, showprocs);
@@ -495,7 +510,8 @@ _db_show_vap(const struct ieee80211vap *
 }
 
 static void
-_db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, int 
showprocs)
+_db_show_com(const s

svn commit: r246515 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:29:14 2013
New Revision: 246515
URL: http://svnweb.freebsd.org/changeset/base/246515

Log:
  Mesh HWMP PREQ: fixed conditions for discarding elements.
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:28:25 2013
(r246514)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:29:14 2013
(r246515)
@@ -997,10 +997,10 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 * it will be marked below.
 */
rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID;
-   }else if ((hrtarg != NULL &&
-   HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) &&
-   ((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) ||
-   preqid >= preq->preq_id) {
+   } else if ((hrtarg != NULL &&
+   !HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0))) ||
+   (rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID &&
+   preqid >= preq->preq_id)) {
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"discard PREQ from %6D, old seqno %u <= %u,"
" or old preqid %u < %u",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246514 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:28:25 2013
New Revision: 246514
URL: http://svnweb.freebsd.org/changeset/base/246514

Log:
  Mesh HWMP: don't send an intermediate PREP for proxy entries.
  
  * The standard is unclear about what should happen in case a mesh STA (not
marked as a mesh gate) recevies a PREQ for a destination that is marked
as proxy. Solution for now is not to do intermediate reply at all, and
let the PREQ reach the mesh gate;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:27:40 2013
(r246513)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:28:25 2013
(r246514)
@@ -1133,9 +1133,11 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 
/*
 * We have a valid route to this node.
+* NB: if target is proxy dont reply.
 */
if (rttarg != NULL &&
-   (rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) {
+   rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID &&
+   !(rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) {
/*
 * Check if we can send an intermediate Path Reply,
 * i.e., Target Only bit is not set and target is not
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246513 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:27:40 2013
New Revision: 246513
URL: http://svnweb.freebsd.org/changeset/base/246513

Log:
  Mesh HWMP PREQ update: proxy reply only if mesh STA is a meshgate.
  
  * Original PREP frame is transmitted only by the target mesh STA or the
mesh STA that is the proxy target;
  * Fixed so that metric value is not over written incorrectly in
hwmp_recv_preq for when replying back with a PREP;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:26:40 2013
(r246512)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:27:40 2013
(r246513)
@@ -1017,10 +1017,12 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 
/*
 * Check if the PREQ is addressed to us.
-* or a Proxy currently supplied by us.
+* or a Proxy currently gated by us.
 */
if (IEEE80211_ADDR_EQ(vap->iv_myaddr, PREQ_TADDR(0)) ||
-   (rttarg != NULL &&
+   (ms->ms_flags & IEEE80211_MESHFLAGS_GATE &&
+   rttarg != NULL &&
+   IEEE80211_ADDR_EQ(vap->iv_myaddr, rttarg->rt_mesh_gate) &&
rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY &&
rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)) {
/*
@@ -1031,6 +1033,7 @@ hwmp_recv_preq(struct ieee80211vap *vap,
 
prep.prep_flags = 0;
prep.prep_hopcount = 0;
+   prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
IEEE80211_ADDR_COPY(prep.prep_targetaddr, vap->iv_myaddr);
if (rttarg != NULL && /* if NULL it means we are the target */
rttarg->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) {
@@ -1042,6 +1045,7 @@ hwmp_recv_preq(struct ieee80211vap *vap,
/* update proxy seqno to HWMP seqno */
rttarg->rt_ext_seq = hs->hs_seq;
prep.prep_hopcount = rttarg->rt_nhops;
+   prep.prep_metric = rttarg->rt_metric;
IEEE80211_ADDR_COPY(prep.prep_targetaddr, 
rttarg->rt_mesh_gate);
}
/*
@@ -1050,7 +1054,6 @@ hwmp_recv_preq(struct ieee80211vap *vap,
prep.prep_ttl = ms->ms_ttl;
prep.prep_targetseq = hs->hs_seq;
prep.prep_lifetime = preq->preq_lifetime;
-   prep.prep_metric = IEEE80211_MESHLMETRIC_INITIALVAL;
IEEE80211_ADDR_COPY(prep.prep_origaddr, preq->preq_origaddr);
prep.prep_origseq = preq->preq_origseq;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246512 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:26:40 2013
New Revision: 246512
URL: http://svnweb.freebsd.org/changeset/base/246512

Log:
  HWMP: ic->raw_xmit didn't always point to correct ni.
  
  This is a code re-write. ic->raw_xmit need a pointer to ieee80211_node
  for the destination node (da). I have reorganized the code so that
  a pointer to the da node is searched for in the end & in one place.
  
  * Make mesh_find_txnode public to be used by HWMP, renamed to
ieee80211_mesh_finx_txnode;
  * changed the argument from ieee80211_node to ieee80211vap for all
hwmp_send_* functions;
  * removed the 'sa' argument from hwmp_send_* functions as all HWMP frames
have the source address equal to vap->iv_myaddr;
  * Modified hwmp_send_action so that if da is MULTCAST ni=vap->iv_bss
otherwise we called ieee80211_mesh_find_txnode. Also no need to hold
a reference in this functions if da is not MULTICAST as by finding the
node it became referenced in ieee80211_find_txnode;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:26:06 2013
(r246511)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:26:40 2013
(r246512)
@@ -68,8 +68,7 @@ static void   hwmp_vattach(struct ieee8021
 static voidhwmp_vdetach(struct ieee80211vap *);
 static int hwmp_newstate(struct ieee80211vap *,
enum ieee80211_state, int);
-static int hwmp_send_action(struct ieee80211_node *,
-   const uint8_t [IEEE80211_ADDR_LEN],
+static int hwmp_send_action(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN],
uint8_t *, size_t);
 static uint8_t * hwmp_add_meshpreq(uint8_t *,
@@ -86,23 +85,20 @@ static void hwmp_rootmode_rann_cb(void *
 static voidhwmp_recv_preq(struct ieee80211vap *, struct ieee80211_node *,
const struct ieee80211_frame *,
const struct ieee80211_meshpreq_ie *);
-static int hwmp_send_preq(struct ieee80211_node *,
-   const uint8_t [IEEE80211_ADDR_LEN],
+static int hwmp_send_preq(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN],
struct ieee80211_meshpreq_ie *,
struct timeval *, struct timeval *);
 static voidhwmp_recv_prep(struct ieee80211vap *, struct ieee80211_node *,
const struct ieee80211_frame *,
const struct ieee80211_meshprep_ie *);
-static int hwmp_send_prep(struct ieee80211_node *,
-   const uint8_t [IEEE80211_ADDR_LEN],
+static int hwmp_send_prep(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN],
struct ieee80211_meshprep_ie *);
 static voidhwmp_recv_perr(struct ieee80211vap *, struct ieee80211_node *,
const struct ieee80211_frame *,
const struct ieee80211_meshperr_ie *);
-static int hwmp_send_perr(struct ieee80211_node *,
-   const uint8_t [IEEE80211_ADDR_LEN],
+static int hwmp_send_perr(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN],
struct ieee80211_meshperr_ie *);
 static voidhwmp_senderror(struct ieee80211vap *,
@@ -111,8 +107,7 @@ static void hwmp_senderror(struct ieee80
 static voidhwmp_recv_rann(struct ieee80211vap *, struct ieee80211_node *,
   const struct ieee80211_frame *,
   const struct ieee80211_meshrann_ie *);
-static int hwmp_send_rann(struct ieee80211_node *,
-   const uint8_t [IEEE80211_ADDR_LEN],
+static int hwmp_send_rann(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN],
struct ieee80211_meshrann_ie *);
 static struct ieee80211_node *
@@ -588,17 +583,30 @@ hwmp_recv_action_meshpath(struct ieee802
 }
 
 static int
-hwmp_send_action(struct ieee80211_node *ni,
-const uint8_t sa[IEEE80211_ADDR_LEN],
+hwmp_send_action(struct ieee80211vap *vap,
 const uint8_t da[IEEE80211_ADDR_LEN],
 uint8_t *ie, size_t len)
 {
-   struct ieee80211vap *vap = ni->ni_vap;
-   struct ieee80211com *ic = ni->ni_ic;
+   struct ieee80211_node *ni;
+   struct ieee80211com *ic;
struct ieee80211_bpf_params params;
struct mbuf *m;
uint8_t *frm;
 
+   if (IEEE80211_IS_MULTICAST(da)) {
+   ni = ieee80211_ref_node(vap->iv_bss);
+#ifdef IEEE80211_DEBUG_REFCNT
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
+   "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n",
+   __func__, __LINE__,
+   ni, ether_sprintf(ni->ni_macaddr),
+   ieee8021

svn commit: r246511 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:26:06 2013
New Revision: 246511
URL: http://svnweb.freebsd.org/changeset/base/246511

Log:
  Mesh gate code to transmit to all mesh gates.
  
  * Modified mesh_find_txnode to be able to handle proxy marked entries by
recursively calling itself to find the txnode towards the active mesh gate;
  * Mesh Gate: Added a new function that transmits data frames
similar to ieee80211_start;
  * Modified ieee80211_mesh_forward_to_gates so that:
   + Frames are duplicated and sent to each valid Mesh Gate;
   + Route is marked invalid before return of function, this is
 because we dont know yet which Mesh Gate is we will use;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_mesh.c

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:25:32 2013
(r246510)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:26:06 2013
(r246511)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -79,6 +80,8 @@ static intmesh_checkpseq(struct ieee802
 static struct ieee80211_node *
mesh_find_txnode(struct ieee80211vap *,
const uint8_t [IEEE80211_ADDR_LEN]);
+static voidmesh_transmit_to_gate(struct ieee80211vap *, struct mbuf *,
+   struct ieee80211_mesh_route *);
 static voidmesh_forward(struct ieee80211vap *, struct mbuf *,
const struct ieee80211_meshcntl *);
 static int mesh_input(struct ieee80211_node *, struct mbuf *, int, int);
@@ -1011,21 +1014,151 @@ mesh_find_txnode(struct ieee80211vap *va
rt = ieee80211_mesh_rt_find(vap, dest);
if (rt == NULL)
return NULL;
-   if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0 ||
-   (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY)) {
+   if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest,
-   "%s: !valid or proxy, flags 0x%x", __func__, rt->rt_flags);
+   "%s: !valid, flags 0x%x", __func__, rt->rt_flags);
/* XXX stat */
return NULL;
}
+   if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_PROXY) {
+   rt = ieee80211_mesh_rt_find(vap, rt->rt_mesh_gate);
+   if (rt == NULL) return NULL;
+   if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) {
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, dest,
+   "%s: meshgate !valid, flags 0x%x", __func__,
+   rt->rt_flags);
+   /* XXX stat */
+   return NULL;
+   }
+   }
return ieee80211_find_txnode(vap, rt->rt_nexthop);
 }
 
+static void
+mesh_transmit_to_gate(struct ieee80211vap *vap, struct mbuf *m,
+struct ieee80211_mesh_route *rt_gate)
+{
+   struct ifnet *ifp = vap->iv_ifp;
+   struct ieee80211com *ic = vap->iv_ic;
+   struct ifnet *parent = ic->ic_ifp;
+   struct ieee80211_node *ni;
+   struct ether_header *eh;
+   int error;
+
+   eh = mtod(m, struct ether_header *);
+   ni = mesh_find_txnode(vap, rt_gate->rt_dest);
+   if (ni == NULL) {
+   ifp->if_oerrors++;
+   m_freem(m);
+   return;
+   }
+
+   if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) &&
+   (m->m_flags & M_PWR_SAV) == 0) {
+   /*
+* Station in power save mode; pass the frame
+* to the 802.11 layer and continue.  We'll get
+* the frame back when the time is right.
+* XXX lose WDS vap linkage?
+*/
+   (void) ieee80211_pwrsave(ni, m);
+   ieee80211_free_node(ni);
+   return;
+   }
+
+   /* calculate priority so drivers can find the tx queue */
+   if (ieee80211_classify(ni, m)) {
+   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_OUTPUT,
+   eh->ether_dhost, NULL,
+   "%s", "classification failure");
+   vap->iv_stats.is_tx_classify++;
+   ifp->if_oerrors++;
+   m_freem(m);
+   ieee80211_free_node(ni);
+   return;
+   }
+   /*
+* Stash the node pointer.  Note that we do this after
+* any call to ieee80211_dwds_mcast because that code
+* uses any existing value for rcvif to identify the
+* interface it (might have been) received on.
+*/
+   m->m_pkthdr.rcvif = (void *)ni;
+
+   BPF_MTAP(ifp, m);   /* 802.3 tx */
+
+   /*
+* Check if A-MPDU tx aggregation is setup or if we
+* should try to enable it.  The sta must be associated
+* with HT and A-

svn commit: r246510 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:25:32 2013
New Revision: 246510
URL: http://svnweb.freebsd.org/changeset/base/246510

Log:
  Send frames to mesh gate if 11s discovery fails.
  
  * Send frames that have no path to a known valid Mesh Gate;
  * Added the function ieee80211_mesh_forward_to_gates that sends the frame
to the first found Mesh Gate in the forwarding information;
  * If we try to discover again while we are discovering queue frame,
the discovery callout will send the frames either to mesh gates
or discards them silently;
  * Queue frame also if we try to discover to frequently;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:24:52 2013
(r246509)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:25:32 2013
(r246510)
@@ -1839,12 +1839,11 @@ hwmp_rediscover_cb(void *arg)
hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
if (hr->hr_preqretries >=
ieee80211_hwmp_maxpreq_retries) {
-   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
-   rt->rt_dest, NULL, "%s",
-   "no valid path , max number of discovery, send GATE");
-   /* TODO: send to known gates */
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY,
+   rt->rt_dest, "%s",
+   "max number of discovery, send queued frames to GATE");
+   ieee80211_mesh_forward_to_gates(vap, rt);
vap->iv_stats.is_mesh_fwd_nopath++;
-   rt->rt_flags = 0; /* Mark invalid */
return ; /* XXX: flush queue? */
}
 
@@ -1914,6 +1913,12 @@ hwmp_discover(struct ieee80211vap *vap,
}
hr = IEEE80211_MESH_ROUTE_PRIV(rt,
struct ieee80211_hwmp_route);
+   if (rt->rt_flags & IEEE80211_MESHRT_FLAGS_DISCOVER) {
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP, dest,
+   "%s", "already discovering queue frame until path 
found");
+   sendpreq = 1;
+   goto done;
+   }
if ((rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0) {
if (hr->hr_lastdiscovery != 0 &&
(ticks - hr->hr_lastdiscovery <
@@ -1921,7 +1926,7 @@ hwmp_discover(struct ieee80211vap *vap,
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
dest, NULL, "%s",
"too frequent discovery requeust");
-   /* XXX: stats? */
+   sendpreq = 1;
goto done;
}
hr->hr_lastdiscovery = ticks;

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:24:52 2013
(r246509)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:25:32 2013
(r246510)
@@ -1022,6 +1022,71 @@ mesh_find_txnode(struct ieee80211vap *va
 }
 
 /*
+ * Forward the queued frames to known valid mesh gates.
+ * Assume destination to be outside the MBSS (i.e. proxy entry),
+ * If no valid mesh gates are known silently discard queued frames.
+ * If there is no 802.2 path route will be timedout.
+ */
+void
+ieee80211_mesh_forward_to_gates(struct ieee80211vap *vap,
+struct ieee80211_mesh_route *rt_dest)
+{
+   struct ieee80211com *ic = vap->iv_ic;
+   struct ieee80211_mesh_state *ms = vap->iv_mesh;
+   struct ifnet *ifp = vap->iv_ifp;
+   struct ieee80211_mesh_route *rt_gate;
+   struct ieee80211_mesh_gate_route *gr = NULL, *gr_next;
+   struct mbuf *m, *next;
+   int gates_found = 0;
+
+   KASSERT( rt_dest->rt_flags == IEEE80211_MESHRT_FLAGS_DISCOVER,
+   ("Route is not marked with IEEE80211_MESHRT_FLAGS_DISCOVER"));
+
+   /* XXX: send to more than one valid mash gate */
+   MESH_RT_LOCK(ms);
+   TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, gr_next) {
+   rt_gate = gr->gr_route;
+   if (rt_gate == NULL) {
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_HWMP,
+   rt_dest->rt_dest,
+   "mesh gate with no path %6D",
+   gr->gr_addr, ":");
+   continue;
+   }
+   gates_found = 1;
+   /* convert route to a proxy route */
+   rt_dest->rt_flags = IEEE80211_MESHRT_FLAGS_PROXY |
+   IEEE80211_MESHRT_FLAG

svn commit: r246509 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:24:52 2013
New Revision: 246509
URL: http://svnweb.freebsd.org/changeset/base/246509

Log:
  Mark root mesh as gate when mesh gate flag set.
  
  * Add function ieee80211_mesh_mark_gate in ieee80211_mesh.h;
  * When received a proactive PREQ or RANN with corresponding mesh gate
flag set, create a new entry in the known mesh gate list;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:24:20 2013
(r246508)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:24:52 2013
(r246509)
@@ -1092,6 +1092,16 @@ hwmp_recv_preq(struct ieee80211vap *vap,
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"root mesh station @ %6D", preq->preq_origaddr, ":");
 
+   /* Check if root is a mesh gate, mark it */
+   if (preq->preq_flags & IEEE80211_MESHPREQ_FLAGS_GATE) {
+   struct ieee80211_mesh_gate_route *gr;
+
+   rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE;
+   gr = ieee80211_mesh_mark_gate(vap, preq->preq_origaddr,
+   rtorig);
+   gr->gr_lastseq = 0; /* NOT GANN */
+   }
+
/*
 * Reply with a PREP if we don't have a path to the root
 * or if the root sent us a proactive PREQ.
@@ -1745,6 +1755,15 @@ hwmp_recv_rann(struct ieee80211vap *vap,
}
}
hr = IEEE80211_MESH_ROUTE_PRIV(rt, struct ieee80211_hwmp_route);
+   /* Check if root is a mesh gate, mark it */
+   if (rann->rann_flags & IEEE80211_MESHRANN_FLAGS_GATE) {
+   struct ieee80211_mesh_gate_route *gr;
+
+   rt->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE;
+   gr = ieee80211_mesh_mark_gate(vap, rann->rann_addr,
+   rt);
+   gr->gr_lastseq = 0; /* NOT GANN */
+   }
/* discovery timeout */
ieee80211_mesh_rt_update(rt,
ticks_to_msecs(ieee80211_hwmp_roottimeout));

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:24:20 2013
(r246508)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:24:52 2013
(r246509)
@@ -854,6 +854,43 @@ mesh_rt_cleanup_cb(void *arg)
mesh_rt_cleanup_cb, vap);
 }
 
+/*
+ * Mark a mesh STA as gate and return a pointer to it.
+ * If this is first time, we create a new gate route.
+ * Always update the path route to this mesh gate.
+ */
+struct ieee80211_mesh_gate_route *
+ieee80211_mesh_mark_gate(struct ieee80211vap *vap, const uint8_t *addr,
+struct ieee80211_mesh_route *rt)
+{
+   struct ieee80211_mesh_state *ms = vap->iv_mesh;
+   struct ieee80211_mesh_gate_route *gr = NULL, *next;
+   int found = 0;
+
+   MESH_RT_LOCK(ms);
+   TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) {
+   if (IEEE80211_ADDR_EQ(gr->gr_addr, addr)) {
+   found = 1;
+   break;
+   }
+   }
+
+   if (!found) {
+   /* New mesh gate add it to known table. */
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, addr,
+   "%s", "stored new gate information from pro-PREQ.");
+   gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)),
+   M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO);
+   IEEE80211_ADDR_COPY(gr->gr_addr, addr);
+   TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next);
+   }
+   gr->gr_route = rt;
+   /* TODO: link from path route to gate route */
+   MESH_RT_UNLOCK(ms);
+
+   return gr;
+}
+
 
 /*
  * Helper function to note the Mesh Peer Link FSM change.

Modified: head/sys/net80211/ieee80211_mesh.h
==
--- head/sys/net80211/ieee80211_mesh.h  Thu Feb  7 21:24:20 2013
(r246508)
+++ head/sys/net80211/ieee80211_mesh.h  Thu Feb  7 21:24:52 2013
(r246509)
@@ -566,6 +566,9 @@ voidieee80211_mesh_init_neighbor(struc
   const struct ieee80211_scanparams *);
 void   ieee80211_mesh_update_beacon(struct ieee80211vap *,
struct ieee80211_beacon_offsets *);
+struct ieee80211_mesh_gate_route *
+   ieee80211_mesh_mark_gate(struct ieee80211vap *,
+   const uint8_t *, struct ieee80211_mesh_route *);
 
 /*
  * Return non-zero if proxy operation is enabled.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.o

svn commit: r246508 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:24:20 2013
New Revision: 246508
URL: http://svnweb.freebsd.org/changeset/base/246508

Log:
  Propagate GANN frames, and store know gate info.
  
  * Modified mesh_recv_action_meshgate to do following:
  + if mesh STA already knows the mesh gate of the recevied GANN frame
  + if mesh gate is know, check seq number according to 802.11 standard
  + if mesh gate is not know, add it to the list of known mesh gates
  + if forwarding is enabled and ttl >= 1 then propagate the GANN frame;
  * Declare a new malloc type M_80211_MESH_GT_RT;
  * Declare a struct to store GANN information, ieee80211_mesh_gate_route. And
add it as a TAILQ list to ieee80211_mesh_state;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:24:10 2013
(r246507)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:24:20 2013
(r246508)
@@ -171,7 +171,8 @@ MALLOC_DEFINE(M_80211_MESH_PERR, "80211p
 /* The longer one of the lifetime should be stored as new lifetime */
 #define MESH_ROUTE_LIFETIME_MAX(a, b)  (a > b ? a : b)
 
-MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh", "802.11s routing table");
+MALLOC_DEFINE(M_80211_MESH_RT, "80211mesh_rt", "802.11s routing table");
+MALLOC_DEFINE(M_80211_MESH_GT_RT, "80211mesh_gt", "802.11s known gates table");
 
 /*
  * Helper functions to manipulate the Mesh routing table.
@@ -670,6 +671,7 @@ mesh_vattach(struct ieee80211vap *vap)
ms->ms_seq = 0;
ms->ms_flags = (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_FWD);
ms->ms_ttl = IEEE80211_MESH_DEFAULT_TTL;
+   TAILQ_INIT(&ms->ms_known_gates);
TAILQ_INIT(&ms->ms_routes);
mtx_init(&ms->ms_rt_lock, "MBSS", "802.11s routing table", MTX_DEF);
callout_init(&ms->ms_cleantimer, CALLOUT_MPSAFE);
@@ -2370,18 +2372,78 @@ mesh_recv_action_meshgate(struct ieee802
const uint8_t *frm, const uint8_t *efrm)
 {
struct ieee80211vap *vap = ni->ni_vap;
+   struct ieee80211_mesh_state *ms = vap->iv_mesh;
+   struct ieee80211_mesh_gate_route *gr, *next;
struct ieee80211_mesh_route *rt_gate;
+   struct ieee80211_meshgann_ie pgann;
+   int found = 0;
const struct ieee80211_meshgann_ie *ie =
(const struct ieee80211_meshgann_ie *)
(frm+2); /* action + code */
 
-   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr,
-   "%s", "received GANN from meshgate");
+   if (IEEE80211_ADDR_EQ(vap->iv_myaddr, ie->gann_addr))
+   return 0;
+
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ni->ni_macaddr,
+   "received GANN, meshgate: %6D (seq %u)", ie->gann_addr, ":",
+   ie->gann_seq);
+
+   if (ms == NULL)
+   return (0);
+   MESH_RT_LOCK(ms);
+   TAILQ_FOREACH_SAFE(gr, &ms->ms_known_gates, gr_next, next) {
+   if (!IEEE80211_ADDR_EQ(gr->gr_addr, ie->gann_addr))
+   continue;
+   if (ie->gann_seq <= gr->gr_lastseq) {
+   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
+   ni->ni_macaddr, NULL,
+   "GANN old seqno %u <= %u",
+   ie->gann_seq, gr->gr_lastseq);
+   MESH_RT_UNLOCK(ms);
+   return (0);
+   }
+   /* corresponding mesh gate found & GANN accepted */
+   found = 1;
+   break;
+
+   }
+   if (found == 0) {
+   /* this GANN is from a new mesh Gate add it to known table. */
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie->gann_addr,
+   "stored new GANN information, seq %u.", ie->gann_seq);
+   gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)),
+   M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO);
+   IEEE80211_ADDR_COPY(gr->gr_addr, ie->gann_addr);
+   TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next);
+   }
+   gr->gr_lastseq = ie->gann_seq;
 
-   rt_gate = ieee80211_mesh_rt_find(vap, ie->gann_addr);
+   /* check if we have a path to this gate */
+   rt_gate = mesh_rt_find_locked(ms, gr->gr_addr);
if (rt_gate != NULL &&
-   rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)
+   rt_gate->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) {
+   gr->gr_route = rt_gate;
rt_gate->rt_flags |= IEEE80211_MESHRT_FLAGS_GATE;
+   }
+
+   MESH_RT_UNLOCK(ms);
+
+   /* popagate only if decremented ttl >= 1 && forwarding is enabled */
+   if ((ie->gann_ttl - 1) < 1 &&
+   !(ms->ms_flags & IEEE80211_MESHFLAGS_FWD))
+   return 0;
+   pgann.gann_flags = ie->gann_flags; /* Re

svn commit: r246507 - head/bin/sh

2013-02-07 Thread Jilles Tjoelker
Author: jilles
Date: Thu Feb  7 21:24:10 2013
New Revision: 246507
URL: http://svnweb.freebsd.org/changeset/base/246507

Log:
  sh: Fix a comment.

Modified:
  head/bin/sh/parser.h

Modified: head/bin/sh/parser.h
==
--- head/bin/sh/parser.hThu Feb  7 21:23:43 2013(r246506)
+++ head/bin/sh/parser.hThu Feb  7 21:24:10 2013(r246507)
@@ -39,7 +39,7 @@
 #define CTLENDVAR '\371'
 #define CTLBACKQ '\372'
 #define CTLQUOTE 01/* ored with CTLBACKQ code if in quotes */
-/* CTLBACKQ | CTLQUOTE == '\205' */
+/* CTLBACKQ | CTLQUOTE == '\373' */
 #defineCTLARI  '\374'
 #defineCTLENDARI '\375'
 #defineCTLQUOTEMARK '\376'
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246506 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:23:43 2013
New Revision: 246506
URL: http://svnweb.freebsd.org/changeset/base/246506

Log:
  Mesh update: add base Mesh Gate functionality.
  
  A Mesh Gate should transmit a Mesh Action frame containing
  ieee80211_meshgann_ie as its only information element periodically
  every ieee80211_mesh_gateint ms. Unless the mesh gate is also configure
  as a ROOT, then these frames should not be send.
  This is according to 802.11 2012 standard;
  
  * Introduce new SYSCTL net.wlan.mesh.gateint, with 10s default;
  * Add two new functions mesh_gatemode_setup and mesh_gatemode_cb. This
is similar to how HWMP setups up a callout;
  * Add two new action handlers mesh_recv_action_meshgate and
mesh_send_action_meshgate;
  * Added ieee80211_add_meshgate to ieee80211_mesh.h;
  * Modified mesh_send_action to look similar to hwmp_send_action. This is
because we need to send out broadcast management frames.
  * Introduced a new flag for mesh state IEEE80211_MESHFLAGS_ROOT. This flag
is now set by HWMP code when a mesh STA is configured as a ROOT. This
is then checked by mesh_gatemode_cb before scheduling a new callout;
  * Added to new field to ieee80211_mesh_state:
  + struct callout  ms_gatetimer
  + ieee80211_mesh_seq  ms_gateseq;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:23:03 2013
(r246505)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:23:43 2013
(r246506)
@@ -805,19 +805,23 @@ static void
 hwmp_rootmode_setup(struct ieee80211vap *vap)
 {
struct ieee80211_hwmp_state *hs = vap->iv_hwmp;
+   struct ieee80211_mesh_state *ms = vap->iv_mesh;
 
switch (hs->hs_rootmode) {
case IEEE80211_HWMP_ROOTMODE_DISABLED:
callout_drain(&hs->hs_roottimer);
+   ms->ms_flags &= ~IEEE80211_MESHFLAGS_ROOT;
break;
case IEEE80211_HWMP_ROOTMODE_NORMAL:
case IEEE80211_HWMP_ROOTMODE_PROACTIVE:
callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rootint,
hwmp_rootmode_cb, vap);
+   ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT;
break;
case IEEE80211_HWMP_ROOTMODE_RANN:
callout_reset(&hs->hs_roottimer, ieee80211_hwmp_rannint,
hwmp_rootmode_rann_cb, vap);
+   ms->ms_flags |= IEEE80211_MESHFLAGS_ROOT;
break;
}
 }

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:23:03 2013
(r246505)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:23:43 2013
(r246506)
@@ -68,6 +68,8 @@ static intmesh_select_proto_metric(stru
 static voidmesh_vattach(struct ieee80211vap *);
 static int mesh_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidmesh_rt_cleanup_cb(void *);
+static voidmesh_gatemode_setup(struct ieee80211vap *);
+static voidmesh_gatemode_cb(void *);
 static voidmesh_linkchange(struct ieee80211_node *,
enum ieee80211_mesh_mlstate);
 static voidmesh_checkid(void *, struct ieee80211_node *);
@@ -99,6 +101,10 @@ uint32_tmesh_airtime_calc(struct ieee80
  */
 static SYSCTL_NODE(_net_wlan, OID_AUTO, mesh, CTLFLAG_RD, 0,
 "IEEE 802.11s parameters");
+static int ieee80211_mesh_gateint = -1;
+SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, gateint, CTLTYPE_INT | CTLFLAG_RW,
+&ieee80211_mesh_gateint, 0, ieee80211_sysctl_msecs_ticks, "I",
+"mesh gate interval (ms)");
 static int ieee80211_mesh_retrytimeout = -1;
 SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, retrytimeout, CTLTYPE_INT | CTLFLAG_RW,
 &ieee80211_mesh_retrytimeout, 0, ieee80211_sysctl_msecs_ticks, "I",
@@ -133,11 +139,13 @@ staticieee80211_recv_action_func mesh_r
 static ieee80211_recv_action_func mesh_recv_action_meshpeering_confirm;
 static ieee80211_recv_action_func mesh_recv_action_meshpeering_close;
 static ieee80211_recv_action_func mesh_recv_action_meshlmetric;
+static ieee80211_recv_action_func mesh_recv_action_meshgate;
 
 static ieee80211_send_action_func mesh_send_action_meshpeering_open;
 static ieee80211_send_action_func mesh_send_action_meshpeering_confirm;
 static ieee80211_send_action_func mesh_send_action_meshpeering_close;
 static ieee80211_send_action_func mesh_send_action_meshlmetric;
+static ieee80211_send_action_func mesh_send_action_meshgate;
 
 static const struct ieee80211_mesh_proto_metric mesh_metric_airtime = {
.mpm_descr  = "AIRTIME",
@@ -498,6 +506,48 @@ mesh_select_proto_metric(struct ieee8021
 #undef N
 
 static

svn commit: r246505 - head/sbin/ifconfig

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:23:03 2013
New Revision: 246505
URL: http://svnweb.freebsd.org/changeset/base/246505

Log:
  Mark a mesh path to a mesh gate with a 'G'.
  
  Approved by:  adrian (mentor)

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cThu Feb  7 21:22:14 2013
(r246504)
+++ head/sbin/ifconfig/ifieee80211.cThu Feb  7 21:23:03 2013
(r246505)
@@ -4025,7 +4025,9 @@ list_mesh(int s)
(rt->imr_flags & IEEE80211_MESHRT_FLAGS_VALID) ?
'V' : '!',
(rt->imr_flags & IEEE80211_MESHRT_FLAGS_PROXY) ?
-   'P' : ' ');
+   'P' :
+   (rt->imr_flags & IEEE80211_MESHRT_FLAGS_GATE) ?
+   'G' :' ');
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246504 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:22:14 2013
New Revision: 246504
URL: http://svnweb.freebsd.org/changeset/base/246504

Log:
  Start accepting IEEE80211_ACTION_MESH_GANN frames;
  
  * Add IEEE80211_ACTION_MESH_GANN Action frame verification in
ieee80211_parse_action;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_input.c

Modified: head/sys/net80211/ieee80211_input.c
==
--- head/sys/net80211/ieee80211_input.c Thu Feb  7 21:21:40 2013
(r246503)
+++ head/sys/net80211/ieee80211_input.c Thu Feb  7 21:22:14 2013
(r246504)
@@ -776,6 +776,10 @@ ieee80211_parse_action(struct ieee80211_
/* verify something */
break;
case IEEE80211_ACTION_MESH_GANN:
+   IEEE80211_VERIFY_LENGTH(efrm - frm,
+   sizeof(struct ieee80211_meshgann_ie),
+   return EINVAL);
+   break;
case IEEE80211_ACTION_MESH_CC:
case IEEE80211_ACTION_MESH_MCCA_SREQ:
case IEEE80211_ACTION_MESH_MCCA_SREP:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246503 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:21:40 2013
New Revision: 246503
URL: http://svnweb.freebsd.org/changeset/base/246503

Log:
  Mesh: management mesh action frames are to be discarded
   when not peered.
  
  * Modified ieee80211_recv_action to check if neighbour is peered for
IEEE80211_ACTION_CAT_MESH frames, if not frame is discarded. This is
according to IEEE802.11 2012 standard;
  * Removed duplicate checks in each hwmp_recv_* handlers because HWMP
is a subtype of mesh action;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_action.c
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_action.c
==
--- head/sys/net80211/ieee80211_action.cThu Feb  7 21:21:05 2013
(r246502)
+++ head/sys/net80211/ieee80211_action.cThu Feb  7 21:21:40 2013
(r246503)
@@ -228,6 +228,7 @@ ieee80211_recv_action(struct ieee80211_n
 {
 #defineN(a)(sizeof(a) / sizeof(a[0]))
ieee80211_recv_action_func *f = recv_inval;
+   struct ieee80211vap *vap = ni->ni_vap;
const struct ieee80211_action *ia =
(const struct ieee80211_action *) frm;
 
@@ -245,6 +246,15 @@ ieee80211_recv_action(struct ieee80211_n
f = meshpl_recv_action[ia->ia_action];
break;
case IEEE80211_ACTION_CAT_MESH:
+   if (ni == vap->iv_bss ||
+   ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED) {
+   IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_MESH,
+   ni->ni_macaddr, NULL,
+   "peer link not yet established (%d), cat %s act %u",
+   ni->ni_mlstate, "mesh action", ia->ia_action);
+   vap->iv_stats.is_mesh_nolink++;
+   break;
+   }
if (ia->ia_action < N(meshaction_recv_action))
f = meshaction_recv_action[ia->ia_action];
break;

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:21:05 2013
(r246502)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:21:40 2013
(r246503)
@@ -914,9 +914,6 @@ hwmp_recv_preq(struct ieee80211vap *vap,
ieee80211_hwmp_seq preqid;  /* last seen preqid for orig */
uint32_t metric = 0;
 
-   if (ni == vap->iv_bss ||
-   ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-   return;
/*
 * Ignore PREQs from us. Could happen because someone forward it
 * back to us.
@@ -1233,10 +1230,6 @@ hwmp_recv_prep(struct ieee80211vap *vap,
int is_encap;
struct ieee80211_node *ni_encap;
 
-   if (ni == vap->iv_bss ||
-   ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-   return;
-
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"received PREP, orig %6D, targ %6D", prep->prep_origaddr, ":",
prep->prep_targetaddr, ":");
@@ -1505,10 +1498,6 @@ hwmp_recv_perr(struct ieee80211vap *vap,
struct ieee80211_meshperr_ie *pperr = NULL;
int i, j = 0, forward = 0;
 
-   if (ni == vap->iv_bss ||
-   ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED)
-   return;
-
IEEE80211_NOTE(vap, IEEE80211_MSG_HWMP, ni,
"received PERR from %6D", wh->i_addr2, ":");
 
@@ -1712,9 +1701,7 @@ hwmp_recv_rann(struct ieee80211vap *vap,
struct ieee80211_meshrann_ie prann;
uint32_t metric = 0;
 
-   if (ni == vap->iv_bss ||
-   ni->ni_mlstate != IEEE80211_NODE_MESH_ESTABLISHED ||
-   IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
+   if (IEEE80211_ADDR_EQ(rann->rann_addr, vap->iv_myaddr))
return;
 
rt = ieee80211_mesh_rt_find(vap, rann->rann_addr);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246502 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:21:05 2013
New Revision: 246502
URL: http://svnweb.freebsd.org/changeset/base/246502

Log:
  Update in ieee80211_action.c for mesh code handlers.
  
  * Removed meshlm_send_action and hwmp_send_action. Introduced one common
for all Mesh Action frames meshaction_send_action. According to 802.11
standard Link Metric and HWMP are all under Mesh Action category;
  * Did similar changes to recv_action part;
  * The size of meshaction_*_action is set to 12. This is to make room for
the rest of Mesh Action category subtypes;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_action.c

Modified: head/sys/net80211/ieee80211_action.c
==
--- head/sys/net80211/ieee80211_action.cThu Feb  7 21:20:28 2013
(r246501)
+++ head/sys/net80211/ieee80211_action.cThu Feb  7 21:21:05 2013
(r246502)
@@ -67,10 +67,8 @@ static ieee80211_send_action_func *meshp
send_inval, send_inval, send_inval, send_inval,
send_inval, send_inval, send_inval, send_inval,
 };
-static ieee80211_send_action_func *meshlm_send_action[4] = {
+static ieee80211_send_action_func *meshaction_send_action[12] = {
send_inval, send_inval, send_inval, send_inval,
-};
-static ieee80211_send_action_func *hwmp_send_action[8] = {
send_inval, send_inval, send_inval, send_inval,
send_inval, send_inval, send_inval, send_inval,
 };
@@ -100,18 +98,10 @@ ieee80211_send_action_register(int cat, 
meshpl_send_action[act] = f;
return 0;
case IEEE80211_ACTION_CAT_MESH:
-   switch (act) {
-   case IEEE80211_ACTION_MESH_LMETRIC:
-   if (act >= N(meshlm_send_action))
-   break;
-   meshlm_send_action[act] = f;
-   return 0;
-   case IEEE80211_ACTION_MESH_HWMP:
-   if (act >= N(hwmp_send_action))
-   break;
-   hwmp_send_action[act] = f;
-   return 0;
-   }
+   if (act >= N(meshaction_send_action))
+   break;
+   meshaction_send_action[act] = f;
+   return 0;
break;
case IEEE80211_ACTION_CAT_VENDOR:
if (act >= N(vendor_send_action))
@@ -149,16 +139,8 @@ ieee80211_send_action(struct ieee80211_n
f = meshpl_send_action[act];
break;
case IEEE80211_ACTION_CAT_MESH:
-   switch (act) {
-   case IEEE80211_ACTION_MESH_LMETRIC:
-   if (act < N(meshlm_send_action))
-   f = meshlm_send_action[act];
-   break;
-   case IEEE80211_ACTION_MESH_HWMP:
-   if (act < N(hwmp_send_action))
-   f = hwmp_send_action[act];
-   break;
-   }
+   if (act < N(meshaction_send_action))
+   f = meshaction_send_action[act];
break;
case IEEE80211_ACTION_CAT_VENDOR:
if (act < N(vendor_send_action))
@@ -188,10 +170,8 @@ static ieee80211_recv_action_func *meshp
recv_inval, recv_inval, recv_inval, recv_inval,
recv_inval, recv_inval, recv_inval, recv_inval,
 };
-static ieee80211_recv_action_func *meshlm_recv_action[4] = {
+static ieee80211_recv_action_func *meshaction_recv_action[12] = {
recv_inval, recv_inval, recv_inval, recv_inval,
-};
-static ieee80211_recv_action_func *hwmp_recv_action[8] = {
recv_inval, recv_inval, recv_inval, recv_inval,
recv_inval, recv_inval, recv_inval, recv_inval,
 };
@@ -221,19 +201,10 @@ ieee80211_recv_action_register(int cat, 
meshpl_recv_action[act] = f;
return 0;
case IEEE80211_ACTION_CAT_MESH:
-   switch (act) {
-   case IEEE80211_ACTION_MESH_LMETRIC:
-   if (act >= N(meshlm_recv_action))
-   break;
-   meshlm_recv_action[act] = f;
-   return 0;
-   case IEEE80211_ACTION_MESH_HWMP:
-   if (act >= N(hwmp_recv_action))
-   break;
-   hwmp_recv_action[act] = f;
-   return 0;
-   }
-   break;
+   if (act >= N(meshaction_recv_action))
+   break;
+   meshaction_recv_action[act] = f;
+   return 0;
case IEEE80211_ACTION_CAT_VENDOR:
if (act >= N(vendor_recv_action))
break;
@@ -274,16 +245,8 @@ ieee80211_recv_action(struct ieee80211_n
f = meshpl_recv_action[ia->ia_action];
brea

svn commit: r246501 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:20:28 2013
New Revision: 246501
URL: http://svnweb.freebsd.org/changeset/base/246501

Log:
  Update net80211 mesh struct ieee80211_meshgann_ie.
  
  * Change all field prefix from pann_ to gann_;
  * Added IEEE80211_MESHGANN_BASE_SZ macro to be used in the length field
of a GANN frame according to 802.11 standard;
  * Changed gann_seq field type to uint32_t;
  * Added a Gate Announcement interval field according to
IEEE802.11 2012 standard;
  * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211_mesh_route;
  * Added IEEE80211_MESHRT_FLAGS_GATE as flag bit to ieee80211req_mesh_route;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_ioctl.h
  head/sys/net80211/ieee80211_mesh.h

Modified: head/sys/net80211/ieee80211_ioctl.h
==
--- head/sys/net80211/ieee80211_ioctl.h Thu Feb  7 21:19:44 2013
(r246500)
+++ head/sys/net80211/ieee80211_ioctl.h Thu Feb  7 21:20:28 2013
(r246501)
@@ -342,6 +342,7 @@ struct ieee80211req_mesh_route {
 #defineIEEE80211_MESHRT_FLAGS_DISCOVER 0x01
 #defineIEEE80211_MESHRT_FLAGS_VALID0x02
 #defineIEEE80211_MESHRT_FLAGS_PROXY0x04
+#defineIEEE80211_MESHRT_FLAGS_GATE 0x08
uint8_t imr_dest[IEEE80211_ADDR_LEN];
uint8_t imr_nexthop[IEEE80211_ADDR_LEN];
uint16_timr_nhops;

Modified: head/sys/net80211/ieee80211_mesh.h
==
--- head/sys/net80211/ieee80211_mesh.h  Thu Feb  7 21:19:44 2013
(r246500)
+++ head/sys/net80211/ieee80211_mesh.h  Thu Feb  7 21:20:28 2013
(r246501)
@@ -194,14 +194,20 @@ struct ieee80211_meshbeacont_ie {
 #endif
 
 /* Gate (GANN) Annoucement */
+/*
+ * NB: these macros used for the length in the IEs does not include 2 bytes
+ * for _ie and _len fields as is defined by the standard.
+ */
+#defineIEEE80211_MESHGANN_BASE_SZ  (15)
 struct ieee80211_meshgann_ie {
-   uint8_t pann_ie;/* IEEE80211_ELEMID_MESHGANN */
-   uint8_t pann_len;
-   uint8_t pann_flags;
-   uint8_t pann_hopcount;
-   uint8_t pann_ttl;
-   uint8_t pann_addr[IEEE80211_ADDR_LEN];
-   uint8_t pann_seq;   /* PANN Sequence Number */
+   uint8_t gann_ie;/* IEEE80211_ELEMID_MESHGANN */
+   uint8_t gann_len;
+   uint8_t gann_flags;
+   uint8_t gann_hopcount;
+   uint8_t gann_ttl;
+   uint8_t gann_addr[IEEE80211_ADDR_LEN];
+   uint32_tgann_seq;   /* GANN Sequence Number */
+   uint16_tgann_interval;  /* GANN Interval */
 } __packed;
 
 /* Root (MP) Annoucement */
@@ -423,6 +429,7 @@ struct ieee80211_mesh_route {
 #defineIEEE80211_MESHRT_FLAGS_DISCOVER 0x01/* path discovery */
 #defineIEEE80211_MESHRT_FLAGS_VALID0x02/* path discovery 
complete */
 #defineIEEE80211_MESHRT_FLAGS_PROXY0x04/* proxy entry */
+#defineIEEE80211_MESHRT_FLAGS_GATE 0x08/* mesh gate entry */
uint32_trt_lifetime;/* route timeout */
uint32_trt_lastmseq;/* last seq# seen dest */
uint32_trt_ext_seq; /* proxy seq number */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246500 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:19:44 2013
New Revision: 246500
URL: http://svnweb.freebsd.org/changeset/base/246500

Log:
  HWMP: Accept a PERR even if path is valid.
  
  * An HWMP PERR should be accepted even if path is valid. Because
we check if we recevied it from a neighbour that we use as a next hop;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:18:22 2013
(r246499)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:19:44 2013
(r246500)
@@ -1528,7 +1528,7 @@ hwmp_recv_perr(struct ieee80211vap *vap,
 */
for (i = 0; i < perr->perr_ndests; i++) {
rt = ieee80211_mesh_rt_find(vap, PERR_DADDR(i));
-   if (rt == NULL || rt->rt_flags & IEEE80211_MESHRT_FLAGS_VALID)
+   if (rt == NULL)
continue;
if (!IEEE80211_ADDR_EQ(rt->rt_nexthop, wh->i_addr2))
continue;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246499 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:18:22 2013
New Revision: 246499
URL: http://svnweb.freebsd.org/changeset/base/246499

Log:
  Add mesh debug for interarction between DS & MBSS.
  
  * Add mesh debug information when frames enter or leave the MBSS;
  * Set IEEE80211_MSG_OUTPUT bit to enable output;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:17:35 2013
(r246498)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:18:22 2013
(r246499)
@@ -1246,6 +1246,9 @@ mesh_recv_indiv_data_to_me(struct ieee80
 * All other cases: forward of MSDUs from the MBSS to DS indiv.
 * addressed according to 13.11.3.2.
 */
+   IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_OUTPUT, qwh->i_addr2,
+   "forward frame to DS, SA(%6D) DA(%6D)",
+   mc10->mc_addr6, ":", mc10->mc_addr5, ":");
}
return (0); /* process locally */
 }

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cThu Feb  7 21:17:35 2013
(r246498)
+++ head/sys/net80211/ieee80211_output.cThu Feb  7 21:18:22 2013
(r246499)
@@ -262,6 +262,10 @@ ieee80211_start(struct ifnet *ifp)
m_freem(m);
continue;
}
+   IEEE80211_DPRINTF(vap, IEEE80211_MSG_OUTPUT,
+   "forward frame from DS SA(%6D), DA(%6D)\n",
+   eh->ether_dhost, ":",
+   eh->ether_shost, ":");
ieee80211_mesh_proxy_check(vap, 
eh->ether_shost);
}
ni = ieee80211_mesh_discover(vap, eh->ether_dhost, m);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246498 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:17:35 2013
New Revision: 246498
URL: http://svnweb.freebsd.org/changeset/base/246498

Log:
  Fix mesh path flag.
  
  * A bug occurs while in discovery mode which leaves a path marked with
both Discover and Valid flag. This happens when receiving/sending
PREQ and PREP in a particular order. Solution is to assign the Valid bit
instead of oring it;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_hwmp.c

Modified: head/sys/net80211/ieee80211_hwmp.c
==
--- head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:12:55 2013
(r246497)
+++ head/sys/net80211/ieee80211_hwmp.c  Thu Feb  7 21:17:35 2013
(r246498)
@@ -995,8 +995,11 @@ hwmp_recv_preq(struct ieee80211vap *vap,
rtorig->rt_metric = metric;
rtorig->rt_nhops  = preq->preq_hopcount + 1;
ieee80211_mesh_rt_update(rtorig, preq->preq_lifetime);
-   /* path to orig is valid now */
-   rtorig->rt_flags |= IEEE80211_MESHRT_FLAGS_VALID;
+   /* Path to orig is valid now.
+* NB: we know it can't be Proxy, and if it is GATE
+* it will be marked below.
+*/
+   rtorig->rt_flags = IEEE80211_MESHRT_FLAGS_VALID;
}else if ((hrtarg != NULL &&
HWMP_SEQ_EQ(hrtarg->hr_seq, PREQ_TSEQ(0)) &&
((rtorig->rt_flags & IEEE80211_MESHRT_FLAGS_VALID) == 0)) ||
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246497 - head/sys/net80211

2013-02-07 Thread Monthadar Al Jaberi
Author: monthadar
Date: Thu Feb  7 21:12:55 2013
New Revision: 246497
URL: http://svnweb.freebsd.org/changeset/base/246497

Log:
  Stop a mesh STA from flooding with peer frames.
  
  This problem happens when using ACL policy to filter mesh STA
  but two nodes have different policy. Then one of them will try to
  peer all the time. This can also help if for any reason one of the
  peering mesh STA have problems sending/receiving peer frames.
  
  * Modified struct ieee80211_node to include two new fields:
  + struct callout ni_mlhtimer /* link mesh backoff timer */
  + uint8_t ni_mlhcnt /* link mesh holding counter */
  * Added two new sysctl (check sysctl -d for more info):
  + net.wlan.mesh.backofftimeout=5000
  + net.wlan.mesh.maxholding=2;
  * When receiving a beacon and we are in IEEE80211_NODE_MESH_IDLE
check if ni_mlhcnt >= ieee80211_mesh_maxholding, if so do not do anything;
  * In mesh_peer_timeout_cb when transitioning from IEEE80211_NODE_MESH_HOLDING
to IEEE80211_NODE_MESH_IDLE increment ni_mlhcnt, and eventually start
ieee80211_mesh_backofftimeout;
  
  Approved by:  adrian (mentor)

Modified:
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_node.h

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 19:09:10 2013
(r246496)
+++ head/sys/net80211/ieee80211_mesh.c  Thu Feb  7 21:12:55 2013
(r246497)
@@ -111,10 +111,20 @@ static int ieee80211_mesh_confirmtimeout
 SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, confirmtimeout, CTLTYPE_INT | CTLFLAG_RW,
 &ieee80211_mesh_confirmtimeout, 0, ieee80211_sysctl_msecs_ticks, "I",
 "Confirm state timeout (msec)");
+static int ieee80211_mesh_backofftimeout = -1;
+SYSCTL_PROC(_net_wlan_mesh, OID_AUTO, backofftimeout, CTLTYPE_INT | CTLFLAG_RW,
+&ieee80211_mesh_backofftimeout, 0, ieee80211_sysctl_msecs_ticks, "I",
+"Backoff timeout (msec). This is to throutles peering forever when "
+"not receving answer or is rejected by a neighbor");
 static int ieee80211_mesh_maxretries = 2;
 SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxretries, CTLTYPE_INT | CTLFLAG_RW,
 &ieee80211_mesh_maxretries, 0,
 "Maximum retries during peer link establishment");
+static int ieee80211_mesh_maxholding = 2;
+SYSCTL_INT(_net_wlan_mesh, OID_AUTO, maxholding, CTLTYPE_INT | CTLFLAG_RW,
+&ieee80211_mesh_maxholding, 0,
+"Maximum times we are allowed to transition to HOLDING state before "
+"backinoff during peer link establishment");
 
 static const uint8_t broadcastaddr[IEEE80211_ADDR_LEN] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -500,6 +510,7 @@ ieee80211_mesh_init(void)
ieee80211_mesh_retrytimeout = msecs_to_ticks(40);
ieee80211_mesh_holdingtimeout = msecs_to_ticks(40);
ieee80211_mesh_confirmtimeout = msecs_to_ticks(40);
+   ieee80211_mesh_backofftimeout = msecs_to_ticks(5000);
 
/*
 * Register action frame handlers.
@@ -1696,7 +1707,6 @@ mesh_recv_mgmt(struct ieee80211_node *ni
}
/*
 * Automatically peer with discovered nodes if possible.
-* XXX backoff on repeated failure
 */
if (ni != vap->iv_bss &&
(ms->ms_flags & IEEE80211_MESHFLAGS_AP)) {
@@ -1705,6 +1715,10 @@ mesh_recv_mgmt(struct ieee80211_node *ni
{
uint16_t args[1];
 
+   /* Wait for backoff callout to reset counter */
+   if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding)
+   return;
+
ni->ni_mlpid = mesh_generateid(vap);
if (ni->ni_mlpid == 0)
return;
@@ -2578,6 +2592,15 @@ mesh_peer_timeout_stop(struct ieee80211_
callout_drain(&ni->ni_mltimer);
 }
 
+static void
+mesh_peer_backoff_cb(void *arg)
+{
+   struct ieee80211_node *ni = (struct ieee80211_node *)arg;
+
+   /* After backoff timeout, try to peer automatically again. */
+   ni->ni_mlhcnt = 0;
+}
+
 /*
  * Mesh Peer Link Management FSM timeout handling.
  */
@@ -2625,6 +2648,11 @@ mesh_peer_timeout_cb(void *arg)
mesh_peer_timeout_setup(ni);
break;
case IEEE80211_NODE_MESH_HOLDING:
+   ni->ni_mlhcnt++;
+   if (ni->ni_mlhcnt >= ieee80211_mesh_maxholding)
+   callout_reset(&ni->ni_mlhtimer,
+   ieee80211_mesh_backofftimeout,
+   mesh_peer_backoff_cb, ni);
mesh_linkchange(ni, IEEE80211_NODE_MESH_IDLE);
break;
}
@@ -2889,6 +2917,7 @@ ieee80211_mesh_node_init(struct ieee8021
 {
ni->ni_flags |= IEEE80211_NODE_QOS;
callout_init(&ni->ni_mltimer, CALLOUT_MPS

Re: svn commit: r246085 - in head/sys: amd64/linux32 compat/linprocfs compat/linux i386/linux

2013-02-07 Thread Chagin Dmitry
On Tue, Jan 29, 2013 at 06:41:30PM +, John Baldwin wrote:
> Author: jhb
> Date: Tue Jan 29 18:41:30 2013
> New Revision: 246085
> URL: http://svnweb.freebsd.org/changeset/base/246085
> 
> Log:
>   Reduce duplication between i386/linux/linux.h and amd64/linux32/linux.h
>   by moving bits that are MI out into headers in compat/linux.
>   
>   Reviewed by:Chagin Dmitry  dmitry | gmail
>   MFC after:  2 weeks
> 
> ==
> --- head/sys/amd64/linux32/linux.hTue Jan 29 18:22:38 2013
> (r246084)
> +++ head/sys/amd64/linux32/linux.hTue Jan 29 18:41:30 2013
> (r246085)
> @@ -107,11 +107,6 @@ typedef struct {
>  /*
>   * Miscellaneous
>   */
> -#define  LINUX_NAME_MAX  255
> -#define  LINUX_MAX_UTSNAME   65
> -
> -#define  LINUX_CTL_MAXNAME   10
> -
>  #define  LINUX_AT_COUNT  16  /* Count of used aux entry 
> types.
>* Keep this synchronized with
>* elf_linux_fixup() code.
> @@ -127,11 +122,6 @@ struct l___sysctl_args
>   l_ulong __spare[4];
>  } __packed;
>  
> -/* Scheduling policies */
> -#define  LINUX_SCHED_OTHER   0
> -#define  LINUX_SCHED_FIFO1
> -#define  LINUX_SCHED_RR  2
> -
>  /* Resource limits */
>  #define  LINUX_RLIMIT_CPU0
>  #define  LINUX_RLIMIT_FSIZE  1
> @@ -265,15 +255,6 @@ struct l_statfs64 { 
>  l_int   f_spare[6];
>  } __packed;
>  
> -struct l_new_utsname {
> - charsysname[LINUX_MAX_UTSNAME];
> - charnodename[LINUX_MAX_UTSNAME];
> - charrelease[LINUX_MAX_UTSNAME];
> - charversion[LINUX_MAX_UTSNAME];
> - charmachine[LINUX_MAX_UTSNAME];
> - chardomainname[LINUX_MAX_UTSNAME];
> -} __packed;
> -
>  /*
>   * Signalling
>   */
> @@ -535,27 +516,9 @@ struct l_rt_sigframe {
>   l_handler_t sf_handler;
>  } __packed;
>  
> -extern int bsd_to_linux_signal[];
> -extern int linux_to_bsd_signal[];
>  extern struct sysentvec elf_linux_sysvec;
>  
>  /*
> - * Pluggable ioctl handlers
> - */
> -struct linux_ioctl_args;
> -struct thread;
> -
> -typedef int linux_ioctl_function_t(struct thread *, struct linux_ioctl_args 
> *);
> -
> -struct linux_ioctl_handler {
> - linux_ioctl_function_t *func;
> - int low, high;
> -};
> -
> -int  linux_ioctl_register_handler(struct linux_ioctl_handler *h);
> -int  linux_ioctl_unregister_handler(struct linux_ioctl_handler *h);
> -
> -/*
>   * open/fcntl flags
>   */
>  #define  LINUX_O_RDONLY  
> @@ -597,65 +560,6 @@ int  linux_ioctl_unregister_handler(struc
>  #define  LINUX_F_WRLCK   1
>  #define  LINUX_F_UNLCK   2
>  
> -/*
> - * posix_fadvise advice
> - */
> -#define  LINUX_POSIX_FADV_NORMAL 0
> -#define  LINUX_POSIX_FADV_RANDOM 1
> -#define  LINUX_POSIX_FADV_SEQUENTIAL 2
> -#define  LINUX_POSIX_FADV_WILLNEED   3
> -#define  LINUX_POSIX_FADV_DONTNEED   4
> -#define  LINUX_POSIX_FADV_NOREUSE5
> -
> -/*
> - * mount flags
> - */
> -#define  LINUX_MS_RDONLY 0x0001
> -#define  LINUX_MS_NOSUID 0x0002
> -#define  LINUX_MS_NODEV  0x0004
> -#define  LINUX_MS_NOEXEC 0x0008
> -#define  LINUX_MS_REMOUNT0x0020
> -
> -/*
> - * SystemV IPC defines
> - */
> -#define  LINUX_SEMOP 1
> -#define  LINUX_SEMGET2
> -#define  LINUX_SEMCTL3
> -#define  LINUX_MSGSND11
> -#define  LINUX_MSGRCV12
> -#define  LINUX_MSGGET13
> -#define  LINUX_MSGCTL14
> -#define  LINUX_SHMAT 21
> -#define  LINUX_SHMDT 22
> -#define  LINUX_SHMGET23
> -#define  LINUX_SHMCTL24
> -
> -#define  LINUX_IPC_RMID  0
> -#define  LINUX_IPC_SET   1
> -#define  LINUX_IPC_STAT  2
> -#define  LINUX_IPC_INFO  3
> -
> -#define  LINUX_SHM_LOCK  11
> -#define  LINUX_SHM_UNLOCK12
> -#define  LINUX_SHM_STAT  13
> -#define  LINUX_SHM_INFO  14
> -
> -#define  LINUX_SHM_RDONLY0x1000
> -#define  LINUX_SHM_RND   0x2000
> -#define  LINUX_SHM_REMAP 0x4000
> -
> -/* semctl commands */
> -#define  LINUX_GETPID11
> -#define  LINUX_GETVAL12
> -#define  LINUX_GETALL13
> -#define  LINUX_GETNCNT   14
> -#define  LINUX_GETZCNT   15
> -#define  LINUX_SETVAL16
> -#define  LINUX_SETALL17
> -#define  LINUX_SEM_STAT  18
> -#define  LINUX_SEM_INFO  19
> -
>  union l_semun {
>   l_int   val;
>   l_uintptr_t buf;
> @@ -667,25 +571,6 @@ union l_semun {
>  /*
>   * Soc

svn commit: r246495 - head/bin/sh

2013-02-07 Thread Xin LI
Author: delphij
Date: Thu Feb  7 19:00:54 2013
New Revision: 246495
URL: http://svnweb.freebsd.org/changeset/base/246495

Log:
  Catch TRACE parameters up with r23.  This change is only needed when
  debugging is enabled.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Thu Feb  7 18:47:25 2013(r246494)
+++ head/bin/sh/jobs.c  Thu Feb  7 19:00:54 2013(r246495)
@@ -1030,7 +1030,7 @@ dowait(int mode, struct job *job)
int wflags;
int restore_sigchld;
 
-   TRACE(("dowait(%d) called\n", block));
+   TRACE(("dowait(%d, %p) called\n", mode, job));
restore_sigchld = 0;
if ((mode & DOWAIT_SIG) != 0) {
sigfillset(&mask);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246487 - in head/contrib/libc++: include src

2013-02-07 Thread David Chisnall
Author: theraven
Date: Thu Feb  7 15:45:28 2013
New Revision: 246487
URL: http://svnweb.freebsd.org/changeset/base/246487

Log:
  Import new libc++ to head.  Various small fixes and cleanups.
  
  MFC after:2 weeks

Modified:
  head/contrib/libc++/include/__config
  head/contrib/libc++/include/algorithm
  head/contrib/libc++/include/array
  head/contrib/libc++/include/atomic
  head/contrib/libc++/include/cmath
  head/contrib/libc++/include/functional
  head/contrib/libc++/include/future
  head/contrib/libc++/include/istream
  head/contrib/libc++/include/iterator
  head/contrib/libc++/include/limits
  head/contrib/libc++/include/locale
  head/contrib/libc++/include/memory
  head/contrib/libc++/include/ostream
  head/contrib/libc++/include/random
  head/contrib/libc++/include/regex
  head/contrib/libc++/include/string
  head/contrib/libc++/include/type_traits
  head/contrib/libc++/include/vector
  head/contrib/libc++/src/chrono.cpp
  head/contrib/libc++/src/debug.cpp
  head/contrib/libc++/src/exception.cpp
  head/contrib/libc++/src/future.cpp
  head/contrib/libc++/src/hash.cpp
  head/contrib/libc++/src/locale.cpp
  head/contrib/libc++/src/string.cpp
  head/contrib/libc++/src/thread.cpp
Directory Properties:
  head/contrib/libc++/   (props changed)

Modified: head/contrib/libc++/include/__config
==
--- head/contrib/libc++/include/__configThu Feb  7 15:37:51 2013
(r246486)
+++ head/contrib/libc++/include/__configThu Feb  7 15:45:28 2013
(r246487)
@@ -66,6 +66,12 @@
 #  endif
 #endif  // _WIN32
 
+#ifdef __linux__
+#  if defined(__GNUC__) && _GNUC_VER >= 403
+#define _LIBCP_HAS_IS_BASE_OF
+#  endif
+#endif
+
 #ifdef __sun__
 # include 
 # ifdef _LITTLE_ENDIAN

Modified: head/contrib/libc++/include/algorithm
==
--- head/contrib/libc++/include/algorithm   Thu Feb  7 15:37:51 2013
(r246486)
+++ head/contrib/libc++/include/algorithm   Thu Feb  7 15:45:28 2013
(r246487)
@@ -1528,10 +1528,10 @@ copy(_InputIterator __first, _InputItera
 
 // copy_backward
 
-template 
+template 
 inline _LIBCPP_INLINE_VISIBILITY
 _OutputIterator
-__copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator 
__result)
+__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, 
_OutputIterator __result)
 {
 while (__first != __last)
 *--__result = *--__last;

Modified: head/contrib/libc++/include/array
==
--- head/contrib/libc++/include/array   Thu Feb  7 15:37:51 2013
(r246486)
+++ head/contrib/libc++/include/array   Thu Feb  7 15:45:28 2013
(r246487)
@@ -310,6 +310,7 @@ _LIBCPP_INLINE_VISIBILITY inline
 _Tp&
 get(array<_Tp, _Size>& __a) _NOEXCEPT
 {
+static_assert(_Ip < _Size, "Index out of bounds in std::get<> 
(std::array)");
 return __a[_Ip];
 }
 
@@ -318,6 +319,7 @@ _LIBCPP_INLINE_VISIBILITY inline
 const _Tp&
 get(const array<_Tp, _Size>& __a) _NOEXCEPT
 {
+static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const 
std::array)");
 return __a[_Ip];
 }
 
@@ -328,6 +330,7 @@ _LIBCPP_INLINE_VISIBILITY inline
 _Tp&&
 get(array<_Tp, _Size>&& __a) _NOEXCEPT
 {
+static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array 
&&)");
 return _VSTD::move(__a[_Ip]);
 }
 

Modified: head/contrib/libc++/include/atomic
==
--- head/contrib/libc++/include/atomic  Thu Feb  7 15:37:51 2013
(r246486)
+++ head/contrib/libc++/include/atomic  Thu Feb  7 15:45:28 2013
(r246487)
@@ -33,6 +33,7 @@ template  T kill_dependency(T y
 
 // lock-free property
 
+#define ATOMIC_BOOL_LOCK_FREE unspecified
 #define ATOMIC_CHAR_LOCK_FREE unspecified
 #define ATOMIC_CHAR16_T_LOCK_FREE unspecified
 #define ATOMIC_CHAR32_T_LOCK_FREE unspecified
@@ -41,6 +42,7 @@ template  T kill_dependency(T y
 #define ATOMIC_INT_LOCK_FREE unspecified
 #define ATOMIC_LONG_LOCK_FREE unspecified
 #define ATOMIC_LLONG_LOCK_FREE unspecified
+#define ATOMIC_POINTER_LOCK_FREE unspecified
 
 // flag type and operations
 
@@ -472,6 +474,7 @@ template 
 
 // Atomics for standard typedef types
 
+typedef atomic   atomic_bool;
 typedef atomic   atomic_char;
 typedef atomicatomic_schar;
 typedef atomic  atomic_uchar;
@@ -1454,6 +1457,7 @@ atomic_signal_fence(memory_order __m) _N
 
 // Atomics for standard typedef types
 
+typedef atomic   atomic_bool;
 typedef atomic   atomic_char;
 typedef atomicatomic_schar;
 typedef atomic  atomic_uchar;
@@ -1499,14 +1503,16 @@ typedef atomic atomic_uintmax
 
 // lock-free property
 
-#define ATOMIC_CHAR_LOCK_FREE 0
-#define ATOMIC_CHAR16_T_LOCK_FREE 0
-#define ATOMIC_CHAR32_T_LOCK_FREE 0
-#define ATOM

svn commit: r246486 - head/bin/ps

2013-02-07 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  7 15:37:51 2013
New Revision: 246486
URL: http://svnweb.freebsd.org/changeset/base/246486

Log:
  Document P_PPTRACE.
  
  MFC after:2 weeks

Modified:
  head/bin/ps/ps.1

Modified: head/bin/ps/ps.1
==
--- head/bin/ps/ps.1Thu Feb  7 15:36:24 2013(r246485)
+++ head/bin/ps/ps.1Thu Feb  7 15:37:51 2013(r246486)
@@ -29,7 +29,7 @@
 .\" @(#)ps.1   8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2012
+.Dd February 7, 2013
 .Dt PS 1
 .Os
 .Sh NAME
@@ -323,6 +323,7 @@ the include file
 .It Dv "P_INMEM" Ta No "0x1000" Ta "Loaded into memory"
 .It Dv "P_SWAPPINGOUT" Ta No "0x2000" Ta "Process is being swapped out"
 .It Dv "P_SWAPPINGIN" Ta No "0x4000" Ta "Process is being swapped in"
+.It Dv "P_PPTRACE" Ta No "0x8000" Ta "Vforked child issued 
ptrace(PT_TRACEME)"
 .El
 .It Cm label
 The MAC label of the process.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246485 - head/lib/libc/sys

2013-02-07 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  7 15:36:24 2013
New Revision: 246485
URL: http://svnweb.freebsd.org/changeset/base/246485

Log:
  Document the detail of interaction between vfork and PT_TRACEME.
  
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/ptrace.2

Modified: head/lib/libc/sys/ptrace.2
==
--- head/lib/libc/sys/ptrace.2  Thu Feb  7 15:34:22 2013(r246484)
+++ head/lib/libc/sys/ptrace.2  Thu Feb  7 15:36:24 2013(r246485)
@@ -2,7 +2,7 @@
 .\"$NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
 .\"
 .\" This file is in the public domain.
-.Dd February 19, 2012
+.Dd February 7, 2013
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -100,6 +100,16 @@ or any of the routines built on it
 it will stop before executing the first instruction of the new image.
 Also, any setuid or setgid bits on the executable being executed will
 be ignored.
+If the child was created by
+.Xr vfork 2
+system call or
+.Xr rfork(2)
+call with the
+.Dv RFMEM
+flag specified, the debugging events are reported to the parent
+only after the
+.Xr execve 2
+is executed.
 .It Dv PT_READ_I , Dv PT_READ_D
 These requests read a single
 .Vt int
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246484 - in head/sys: kern sys

2013-02-07 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  7 15:34:22 2013
New Revision: 246484
URL: http://svnweb.freebsd.org/changeset/base/246484

Log:
  When vforked child is traced, the debugging events are not generated
  until child performs exec().  The behaviour is reasonable when a
  debugger is the real parent, because the parent is stopped until
  exec(), and sending a debugging event to the debugger would deadlock
  both parent and child.
  
  On the other hand, when debugger is not the parent of the vforked
  child, not sending debugging signals makes it impossible to debug
  across vfork.
  
  Fix the issue by declining generating debug signals only when vfork()
  was done and child called ptrace(PT_TRACEME).  Set a new process flag
  P_PPTRACE from the attach code for PT_TRACEME, if P_PPWAIT flag is
  set, which indicates that the process was created with vfork() and
  still did not execed. Check P_PPTRACE from issignal(), instead of
  refusing the trace outright for the P_PPWAIT case.  The scope of
  P_PPTRACE is exactly contained in the scope of P_PPWAIT.
  
  Found and tested by:  zont
  Reviewed by:  pluknet
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_exit.c
  head/sys/kern/kern_sig.c
  head/sys/kern/sys_process.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Thu Feb  7 15:22:50 2013(r246483)
+++ head/sys/kern/kern_exec.c   Thu Feb  7 15:34:22 2013(r246484)
@@ -640,7 +640,7 @@ interpret:
 */
p->p_flag |= P_EXEC;
if (p->p_pptr && (p->p_flag & P_PPWAIT)) {
-   p->p_flag &= ~P_PPWAIT;
+   p->p_flag &= ~(P_PPWAIT | P_PPTRACE);
cv_broadcast(&p->p_pwait);
}
 

Modified: head/sys/kern/kern_exit.c
==
--- head/sys/kern/kern_exit.c   Thu Feb  7 15:22:50 2013(r246483)
+++ head/sys/kern/kern_exit.c   Thu Feb  7 15:34:22 2013(r246484)
@@ -266,7 +266,7 @@ exit1(struct thread *td, int rv)
PROC_LOCK(p);
rv = p->p_xstat;/* Event handler could change exit status */
stopprofclock(p);
-   p->p_flag &= ~(P_TRACED | P_PPWAIT);
+   p->p_flag &= ~(P_TRACED | P_PPWAIT | P_PPTRACE);
 
/*
 * Stop the real interval timer.  If the handler is currently

Modified: head/sys/kern/kern_sig.c
==
--- head/sys/kern/kern_sig.cThu Feb  7 15:22:50 2013(r246483)
+++ head/sys/kern/kern_sig.cThu Feb  7 15:34:22 2013(r246484)
@@ -2618,7 +2618,7 @@ issignal(struct thread *td, int stop_all
sigqueue_delete(&p->p_sigqueue, sig);
continue;
}
-   if (p->p_flag & P_TRACED && (p->p_flag & P_PPWAIT) == 0) {
+   if (p->p_flag & P_TRACED && (p->p_flag & P_PPTRACE) == 0) {
/*
 * If traced, always stop.
 * Remove old signal from queue before the stop.

Modified: head/sys/kern/sys_process.c
==
--- head/sys/kern/sys_process.c Thu Feb  7 15:22:50 2013(r246483)
+++ head/sys/kern/sys_process.c Thu Feb  7 15:34:22 2013(r246484)
@@ -822,6 +822,8 @@ kern_ptrace(struct thread *td, int req, 
case PT_TRACE_ME:
/* set my trace flag and "owner" so it can read/write me */
p->p_flag |= P_TRACED;
+   if (p->p_flag & P_PPWAIT)
+   p->p_flag |= P_PPTRACE;
p->p_oppid = p->p_pptr->p_pid;
break;
 

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Thu Feb  7 15:22:50 2013(r246483)
+++ head/sys/sys/proc.h Thu Feb  7 15:34:22 2013(r246484)
@@ -636,6 +636,7 @@ struct proc {
 #defineP_INMEM 0x1000 /* Loaded into memory. */
 #defineP_SWAPPINGOUT   0x2000 /* Process is being swapped out. */
 #defineP_SWAPPINGIN0x4000 /* Process is being swapped in. */
+#defineP_PPTRACE   0x8000 /* PT_TRACEME by vforked child. */
 
 #defineP_STOPPED   (P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE)
 #defineP_SHOULDSTOP(p) ((p)->p_flag & P_STOPPED)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246482 - in head/sys: dev/bxe dev/e1000 dev/ixgbe dev/oce net ofed/drivers/net/mlx4 sys

2013-02-07 Thread Randall Stewart
Author: rrs
Date: Thu Feb  7 15:20:54 2013
New Revision: 246482
URL: http://svnweb.freebsd.org/changeset/base/246482

Log:
  This fixes a out-of-order problem with several
  of the newer drivers. The basic problem was
  that the driver was pulling the mbuf off the
  drbr ring and then when sending with xmit(), encounting
  a full transmit ring. Thus the lower layer
  xmit() function would return an error, and the
  drivers would then append the data back on to the ring.
  For TCP this is a horrible scenario sure to bring
  on a fast-retransmit.
  
  The fix is to use drbr_peek() to pull the data pointer
  but not remove it from the ring. If it fails then
  we either call the new drbr_putback or drbr_advance
  method. Advance moves it forward (we do this sometimes
  when the xmit() function frees the mbuf). When
  we succeed we always call advance. The
  putback will always copy the mbuf back to the top
  of the ring. Note that the putback *cannot* be used
  with a drbr_dequeue() only with drbr_peek(). We most
  of the time, in putback, would not need to copy it
  back since most likey the mbuf is still the same, but
  sometimes xmit() functions will change the mbuf via
  a pullup or other call. So the optimial case for
  the single consumer is to always copy it back. If
  we ever do a multiple_consumer (for lagg?) we
  will  need a test and atomic in the put back possibly
  a seperate putback_mc() in the ring buf.
  
  Reviewed by:  j...@freebsd.org, j...@freebsd.org

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixv.c
  head/sys/dev/oce/oce_if.c
  head/sys/net/if_var.h
  head/sys/ofed/drivers/net/mlx4/en_tx.c
  head/sys/sys/buf_ring.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Feb  7 15:19:12 2013(r246481)
+++ head/sys/dev/bxe/if_bxe.c   Thu Feb  7 15:20:54 2013(r246482)
@@ -9506,24 +9506,15 @@ bxe_tx_mq_start_locked(struct ifnet *ifp
 
BXE_FP_LOCK_ASSERT(fp);
 
-   if (m == NULL) {
-   /* No new work, check for pending frames. */
-   next = drbr_dequeue(ifp, fp->br);
-   } else if (drbr_needs_enqueue(ifp, fp->br)) {
-   /* Both new and pending work, maintain packet order. */
+   if (m != NULL) {
rc = drbr_enqueue(ifp, fp->br, m);
if (rc != 0) {
fp->tx_soft_errors++;
goto bxe_tx_mq_start_locked_exit;
}
-   next = drbr_dequeue(ifp, fp->br);
-   } else
-   /* New work only, nothing pending. */
-   next = m;
-
+   }
/* Keep adding entries while there are frames to send. */
-   while (next != NULL) {
-
+   while ((next = drbr_peek(ifp, fp->br)) != NULL) {
/* The transmit mbuf now belongs to us, keep track of it. */
fp->tx_mbuf_alloc++;
 
@@ -9537,23 +9528,22 @@ bxe_tx_mq_start_locked(struct ifnet *ifp
if (__predict_false(rc != 0)) {
fp->tx_encap_failures++;
/* Very Bad Frames(tm) may have been dropped. */
-   if (next != NULL) {
+   if (next == NULL) {
+   drbr_advance(ifp, fp->br);
+   } else {
+   drbr_putback(ifp, fp->br, next);
/*
 * Mark the TX queue as full and save
 * the frame.
 */
ifp->if_drv_flags |= IFF_DRV_OACTIVE;
fp->tx_frame_deferred++;
-
-   /* This may reorder frame. */
-   rc = drbr_enqueue(ifp, fp->br, next);
fp->tx_mbuf_alloc--;
}
-
/* Stop looking for more work. */
break;
}
-
+   drbr_advance(ifp, fp->br);
/* The transmit frame was enqueued successfully. */
tx_count++;
 
@@ -9574,8 +9564,6 @@ bxe_tx_mq_start_locked(struct ifnet *ifp
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
break;
}
-
-   next = drbr_dequeue(ifp, fp->br);
}
 
/* No TX packets were dequeued. */

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Thu Feb  7 15:19:12 2013(r246481)
+++ head/sys/dev/e1000/if_em.c  Thu Feb  7 15:20:54 2013(r246482)
@@ -905,22 +905,24 @@ em_mq_start_locked(struct ifnet *ifp, st
}
 
enq = 0;
-   if (m == NULL) {
-   next = dr

svn commit: r246476 - head/lib/libc/sys

2013-02-07 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  7 15:11:43 2013
New Revision: 246476
URL: http://svnweb.freebsd.org/changeset/base/246476

Log:
  Document the ERESTART translation to EINTR for devfs nodes.
  
  Based on the submission by:   jilles
  MFC after:2 weeks

Modified:
  head/lib/libc/sys/open.2

Modified: head/lib/libc/sys/open.2
==
--- head/lib/libc/sys/open.2Thu Feb  7 15:08:35 2013(r246475)
+++ head/lib/libc/sys/open.2Thu Feb  7 15:11:43 2013(r246476)
@@ -28,7 +28,7 @@
 .\" @(#)open.2 8.2 (Berkeley) 11/16/93
 .\" $FreeBSD$
 .\"
-.Dd March 25, 2011
+.Dd February 7, 2013
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -244,6 +244,17 @@ It returns \-1 on failure.
 The file pointer used to mark the current position within the
 file is set to the beginning of the file.
 .Pp
+If a sleeping open of a device node from
+.Xr devfs 5
+is interrupted by a signal, the call always fails with
+.Er EINTR ,
+even if the
+.Dv SA_RESTART
+flag is set for the signal.
+A sleeping open of a fifo (see
+.Xr mkfifo 2 )
+is restarted as normal.
+.Pp
 When a new file is created it is given the group of the directory
 which contains it.
 .Pp
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246472 - in head/sys: fs/devfs kern

2013-02-07 Thread Konstantin Belousov
Author: kib
Date: Thu Feb  7 14:53:33 2013
New Revision: 246472
URL: http://svnweb.freebsd.org/changeset/base/246472

Log:
  Stop translating the ERESTART error from the open(2) into EINTR.
  Posix requires that open(2) is restartable for SA_RESTART.
  
  For non-posix objects, in particular, devfs nodes, still disable
  automatic restart of the opens. The open call to a driver could have
  significant side effects for the hardware.
  
  Noted and reviewed by:jilles
  Discussed with:   bde
  MFC after:2 weeks

Modified:
  head/sys/fs/devfs/devfs_vnops.c
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/fs/devfs/devfs_vnops.c
==
--- head/sys/fs/devfs/devfs_vnops.c Thu Feb  7 14:49:55 2013
(r246471)
+++ head/sys/fs/devfs/devfs_vnops.c Thu Feb  7 14:53:33 2013
(r246472)
@@ -1089,8 +1089,11 @@ devfs_open(struct vop_open_args *ap)
 
vn_lock(vp, vlocked | LK_RETRY);
dev_relthread(dev, ref);
-   if (error)
+   if (error != 0) {
+   if (error == ERESTART)
+   error = EINTR;
return (error);
+   }
 
 #if 0  /* /dev/console */
KASSERT(fp != NULL, ("Could not vnode bypass device on NULL fp"));

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cThu Feb  7 14:49:55 2013
(r246471)
+++ head/sys/kern/vfs_syscalls.cThu Feb  7 14:53:33 2013
(r246472)
@@ -1106,8 +1106,6 @@ kern_openat(struct thread *td, int fd, c
goto success;
}
 
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246471 - head/share/misc

2013-02-07 Thread Achim Leubner
Author: achim
Date: Thu Feb  7 14:49:55 2013
New Revision: 246471
URL: http://svnweb.freebsd.org/changeset/base/246471

Log:
  Add myself as a src committer and my mentor relationship.
  
  Approved by:  emaste (co-mentor)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Thu Feb  7 14:45:56 2013
(r246470)
+++ head/share/misc/committers-src.dot  Thu Feb  7 14:49:55 2013
(r246471)
@@ -93,6 +93,7 @@ node [color=lightblue2, style=filled, bg
 # Current src committers go here. Try to keep things sorted.
 
 ache [label="Andrey Chernov\na...@freebsd.org\n1993/10/31"]
+achim [label="Achim Leubner\nac...@freebsd.org\n2013/01/23"]
 adrian [label="Adrian Chadd\nadr...@freebsd.org\n2000/07/03"]
 ae [label="Andrey V. Elsukov\n...@freebsd.org\n2010/06/03"]
 akiyama [label="Shunsuke Akiyama\nakiy...@freebsd.org\n2000/06/19"]
@@ -380,6 +381,7 @@ ed -> uqs
 eivind -> des
 eivind -> rwatson
 
+emaste -> achim
 emaste -> rstone
 emaste -> dteske
 emaste -> markj
@@ -616,6 +618,7 @@ sbruno -> jimharris
 
 schweikh -> dds
 
+scottl -> achim
 scottl -> jimharris
 scottl -> pjd
 scottl -> sah
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246462 - head/contrib/libcxxrt

2013-02-07 Thread David Chisnall
Author: theraven
Date: Thu Feb  7 11:08:03 2013
New Revision: 246462
URL: http://svnweb.freebsd.org/changeset/base/246462

Log:
  Fix a copy-and-paste error in libcxxrt.

Modified:
  head/contrib/libcxxrt/exception.cc

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Thu Feb  7 11:01:56 2013
(r246461)
+++ head/contrib/libcxxrt/exception.cc  Thu Feb  7 11:08:03 2013
(r246462)
@@ -1387,7 +1387,7 @@ namespace std
{
if (thread_local_handlers) { return 
pathscale::set_unexpected(f); }
 
-   return ATOMIC_SWAP(&terminateHandler, f);
+   return ATOMIC_SWAP(&unexpectedHandler, f);
}
/**
 * Sets the function that is called to terminate the program.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r246362 - head/games/fortune/datfiles

2013-02-07 Thread Slawa Olhovchenkov
On Wed, Feb 06, 2013 at 12:55:47AM +0400, Gleb Smirnoff wrote:

> J> Yes, the insta-MFC is also not appropriate, esp. for something that you 
> know
> J> is going to raise eyebrows when it is committed.  Having to debate this 
> sort
> J> of thing in public on mailing lists is also distinctly unhelpful and very
> J> distracting from productive work.  Also, I'd like to preemptively ask
> J> developers to refrain from any further commits to the fortunes datfiles for
> J> the time being as the last thing we need is a commit war over this sort of
> J> thing.
> 
> What about just moving the entire games subdirectory to ports repo?

Not fortune!
Some nice hints for beginners placed in fortune file
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r246454 - in head/sys/dev/sound: pcm usb

2013-02-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Feb  7 08:20:03 2013
New Revision: 246454
URL: http://svnweb.freebsd.org/changeset/base/246454

Log:
  Add support for mute buttons on USB audio devices and
  use the hwvol interface to adjust the mixer settings.
  
  MFC after:1 week

Modified:
  head/sys/dev/sound/pcm/mixer.c
  head/sys/dev/sound/pcm/mixer.h
  head/sys/dev/sound/usb/uaudio.c

Modified: head/sys/dev/sound/pcm/mixer.c
==
--- head/sys/dev/sound/pcm/mixer.c  Thu Feb  7 07:50:16 2013
(r246453)
+++ head/sys/dev/sound/pcm/mixer.c  Thu Feb  7 08:20:03 2013
(r246454)
@@ -893,14 +893,8 @@ mixer_hwvol_init(device_t dev)
 }
 
 void
-mixer_hwvol_mute(device_t dev)
+mixer_hwvol_mute_locked(struct snd_mixer *m)
 {
-   struct snd_mixer *m;
-   struct cdev *pdev;
-
-   pdev = mixer_get_devt(dev);
-   m = pdev->si_drv1;
-   snd_mtxlock(m->lock);
if (m->hwvol_muted) {
m->hwvol_muted = 0;
mixer_set(m, m->hwvol_mixer, m->hwvol_mute_level);
@@ -909,19 +903,26 @@ mixer_hwvol_mute(device_t dev)
m->hwvol_mute_level = mixer_get(m, m->hwvol_mixer);
mixer_set(m, m->hwvol_mixer, 0);
}
-   snd_mtxunlock(m->lock);
 }
 
 void
-mixer_hwvol_step(device_t dev, int left_step, int right_step)
+mixer_hwvol_mute(device_t dev)
 {
struct snd_mixer *m;
-   int level, left, right;
struct cdev *pdev;
 
pdev = mixer_get_devt(dev);
m = pdev->si_drv1;
snd_mtxlock(m->lock);
+   mixer_hwvol_mute_locked(m);
+   snd_mtxunlock(m->lock);
+}
+
+void
+mixer_hwvol_step_locked(struct snd_mixer *m, int left_step, int right_step)
+{
+   int level, left, right;
+
if (m->hwvol_muted) {
m->hwvol_muted = 0;
level = m->hwvol_mute_level;
@@ -929,15 +930,31 @@ mixer_hwvol_step(device_t dev, int left_
level = mixer_get(m, m->hwvol_mixer);
if (level != -1) {
left = level & 0xff;
-   right = level >> 8;
+   right = (level >> 8) & 0xff;
left += left_step * m->hwvol_step;
if (left < 0)
left = 0;
+   else if (left > 100)
+   left = 100;
right += right_step * m->hwvol_step;
if (right < 0)
right = 0;
+   else if (right > 100)
+   right = 100;
mixer_set(m, m->hwvol_mixer, left | right << 8);
}
+}
+
+void
+mixer_hwvol_step(device_t dev, int left_step, int right_step)
+{
+   struct snd_mixer *m;
+   struct cdev *pdev;
+
+   pdev = mixer_get_devt(dev);
+   m = pdev->si_drv1;
+   snd_mtxlock(m->lock);
+   mixer_hwvol_step_locked(m, left_step, right_step);
snd_mtxunlock(m->lock);
 }
 

Modified: head/sys/dev/sound/pcm/mixer.h
==
--- head/sys/dev/sound/pcm/mixer.h  Thu Feb  7 07:50:16 2013
(r246453)
+++ head/sys/dev/sound/pcm/mixer.h  Thu Feb  7 08:20:03 2013
(r246454)
@@ -40,7 +40,9 @@ int mixer_ioctl_cmd(struct cdev *i_dev, 
 int mixer_oss_mixerinfo(struct cdev *i_dev, oss_mixerinfo *mi);
 
 int mixer_hwvol_init(device_t dev);
+void mixer_hwvol_mute_locked(struct snd_mixer *m);
 void mixer_hwvol_mute(device_t dev);
+void mixer_hwvol_step_locked(struct snd_mixer *m, int l_step, int r_step);
 void mixer_hwvol_step(device_t dev, int left_step, int right_step);
 
 int mixer_busy(struct snd_mixer *m);

Modified: head/sys/dev/sound/usb/uaudio.c
==
--- head/sys/dev/sound/usb/uaudio.c Thu Feb  7 07:50:16 2013
(r246453)
+++ head/sys/dev/sound/usb/uaudio.c Thu Feb  7 08:20:03 2013
(r246454)
@@ -287,14 +287,17 @@ struct uaudio_hid {
struct usb_xfer *xfer[UAUDIO_HID_N_TRANSFER];
struct hid_location volume_up_loc;
struct hid_location volume_down_loc;
+   struct hid_location mute_loc;
uint32_t flags;
 #defineUAUDIO_HID_VALID0x0001
 #defineUAUDIO_HID_HAS_ID   0x0002
 #defineUAUDIO_HID_HAS_VOLUME_UP0x0004
 #defineUAUDIO_HID_HAS_VOLUME_DOWN  0x0008
+#defineUAUDIO_HID_HAS_MUTE 0x0010
uint8_t iface_index;
uint8_t volume_up_id;
uint8_t volume_down_id;
+   uint8_t mute_id;
 };
 
 struct uaudio_softc {
@@ -1012,6 +1015,8 @@ uaudio_attach_sub(device_t dev, kobj_cla
goto detach;
sc->sc_mixer_init = 1;
 
+   mixer_hwvol_init(dev);
+
snprintf(status, sizeof(status), "at ? %s", PCM_KLDSTRING(snd_uaudio));
 
if (pcm_register(dev, sc,
@@ -5520,9 +5525,6 @@ uaudio_hid_rx_callback(struct usb_xfer *
struct uaudio_softc *sc = usbd_x