glob_match: Avoid exponential behavior by not pushing duplicate states.

Cliff Frey report.
Configury to autoconf-2.59.
Fix 5a23cb3788fcade92506f930a9ef41405465e387 for --disable-stride.
Add click_relax_fence(): fence that relaxes the processor.

And move fences into a new header file, <click/machine.hh>, which should
grow over time.
Internal: Use a union and explicit fences to manage the pending list.

This is a clarity commit.
Notifier: Correct multithreading bug.

This configuration exposed the bug:

i0 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q0 :: Queue
  -> d0 :: Discard;
i1 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q1 :: Queue
  -> d1 :: Discard;
i2 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q2 :: Queue
  -> d2 :: Discard;
i3 :: InfiniteSource(LIMIT 1000000, STOP true, TIMESTAMP false, ACTIVE false)
  -> q3 :: Queue
  -> d3 :: Discard;

DriverManager(set a $(now),
  write i0.active true, write i1.active true, write i2.active true, write i3.active true,
  wait, wait, wait, wait,
  set b $(now), print $(div $(add $(i0.limit) $(i1.limit) $(i2.limit) $(i3.limit)) $(sub $b $a)))

StaticThreadSched(i0 0, d0 1, i1 1, d1 0, i2 2, d2 3, i3 3, d3 2)
RawSocket: Reduce warnings.
Script: add more handlers and a test.

With Eddie Kohler.

Signed-off-by: Cliff Frey <cliff@meraki.com>
Fix Bypass::Visitor declared as struct, friended as class
User-level driver: SIGINT gets default handling after router stops.

Before this commit, there was a race condition where SIGINT could
access a deleted router (bad).

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Array memory: Add cast() function to avoid warnings from old compilers.

g++ 4.1.2 was a problem.
Internal: Make click_fence() work on Mac llvm-gcc 4.2.1.

What a disaster! What a long time this took to find!

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
On some ABIs, "struct { char[N] }" has a size != N; so pack.

We must have "sizeof(char_array<S>) == S"! Cliff Frey, Raluca
Musaloiu-E., and others found this problem.
fromhost: Remove acquisition of dev_base_lock

FromHost() was acquiring dev_base_lock, but this is not necessary
when calling alloc_netdev(), and indeed its an error as alloc_netdev()
can sleep when allocing memory.

The low level routines handle their own synchronization so acquiring
dev_base_lock is rarely necessary.

Verified by looking at the v2.6.0 kernel sources: the difference between
dev_alloc() and alloc_netdev() is the need for locking, so place
the lock inside the dev_alloc() pre-2.6 case.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
click: FromDevice - Add support for Linux 2.6.39

The interface for netdev rx_handlers changed in 2.6.39 to return
a status code instead of a skb pointer. Change the Click element
FromDevice to build with both interfaces.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Click fixincludes: fix mangling of radix-tree.h

Kernel changes in V3.1 include changes to radix-tree.h that
matched the regular expression used, but effected other parts of
the source file. Make the regular expression more specific so that
it will only change what was intended.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Disable warning about Args::consume().

Cliff Frey points out that reasonable uses of consume() trigger the
warning. But leave the warning code in, controlled by the
CLICK_DEBUG_ARGS_USAGE symbol.
machine.hh: fix non-smp linuxmodule builds

The header for cpu_relax needs to be included.
Merge pull request #48 from clifffrey/machine-hh-fix

machine.hh: fix non-smp linuxmodule builds
Lexer: Warn if implicit "input" is used in a dangerous way.

This is valid & causes no warning: "... -> {->} -> ..."
This will cause a warning: "... -> { Idle; -> } -> ..."
To avoid the warning, add "input": "... -> { Idle; input -> output } -> ..."
Or add "[0]": "... -> { Idle; [0] -> output } -> ..."

Why? Well, implicit "input" caused confusion at Meraki when people added
spurious semicolons by mistake. This used to be an error:

Hello -> Foo
  -> Bar;
  -> Baz
  -> Quux;

But with implicit "input" it was parsed as

Hello -> Foo -> Bar;
input -> Baz -> Quux;

Figuring out the problem in such a mistaken config was harder than it
should have been.

Perhaps implicit "input" should be removed (so you'd have to at least
give a port number). But this is a smaller change.

Cliff Frey request.