static:  Add 'mcast-route' framework.

Signed-off-by: Ben Greear <greearb@candelatech.com>
static/mcast:  Add much of the mcast-route logic to the static protocol.

fea logic is just dummied out at this point, and probably everything
needs more work.
static/mfea:  Have static module call directly to MFEA

Instead of previous idea to push this all through the RIB.
static/mfea:  Rename rib -> mfea

That better describes what is actually happening.
static/mfea:  Fix up some bugs

Template file issues, etc.
static/mcast:  Support multiple mcast routes of different distances.

This allows static routes to over-ride ones created by PIM.
Route distance is currently fixed:  static == 0, pim == 1.
Lower distance wins.

Signed-off-by: Ben Greear <greearb@candelatech.com>
static/mcast:  Support per-route distance configurable.

Default distance is 0 for static, 1 for PIM.  Static supports
over-rides, but PIM does not at this time.

Signed-off-by: Ben Greear <greearb@candelatech.com>
xorp: rib: Key for saving resolved route entries isn't pointer to IPRouteEntry any more, it's IPNet

When the connected route is deleted, it's first deleted in PolicyConnectedTable and then after that
it's propagated (as different pointer) to other tables.
If the external route is resolved to connected nexthop, and the connected nexthop is deleted,
problem occures because we can't delete the resolved nexthop, because we're searching with different pointer.

Passed all BGP and RIB tests.

Signed-off-by: Igor Maravic <igorm@etf.rs>
static-mcast:  Support multicast address distances.

Add RIB-like behaviour for multicast addresses in
the MFEA logic.  This will allow static multicast
routes to over-ride dynamic routes, for instance.

PIM currently always uses distance of 1, so if
static uses 0, it will win.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Whitespace cleanup.
static-mcast:  Add support for static multicast routes.

This adds the ability to configure static multicast routes
using the static-route module.

Example config file looks like:

interfaces {
        interface "p3p1" {
                disable: false
                default-system-config
        }
        interface "wlan0" {
                disable: false
                default-system-config
        }
}
fea {
        unicast-forwarding4 {
                disable: false
        }
}

protocols {
  static {
    route 10.2.46.91/16 {
      next-hop: 10.2.46.20
      metric: 1
    }
    mrib-route 10.2.46.0/16 {
      next-hop: 10.2.46.30
      metric: 1
    }
    mcast-route 226.0.0.1 {
      input_if: "p3p1"
      input_ip: 192.168.9.11
      output_ifs: "wlan0"
      distance: 2
    }
  }
}

plumbing {
    mfea4 {
        disable: false
        interface "p3p1" {
            vif "p3p1" {
                disable: false
            }
        }
        interface "wlan0" {
            vif "wlan0" {
                disable: false
            }
        }
        interface "register_vif" {
            vif "register_vif" {
                disable: false
            }
        }
    } /*  mfea4  */
} /* plumbing */

Signed-off-by: Ben Greear <greearb@candelatech.com>
Merge branch 'master' of dmz2:/pub/scm/xorp.ct.ben
fea: Fix compile error when no ipv6 mcast routing support.

Signed-off-by: Ben Greear <greearb@candelatech.com>
libproto: Make configured_vif_find_by_name non-const.

We need to be able to modify the returned vif to deal
with MFEA interfaces coming and going.

Signed-off-by: Ben Greear <greearb@candelatech.com>
fea: Fix assert when MFEA interfaces come and go.

And try to fix up the VIF index as needed.

Signed-off-by: Ben Greear <greearb@candelatech.com>
static-routes: Fix endless spin for mcast-routes.

The root cause was a typo that caused an endless loop.
I left in the debugging info (much of it commented out)
in case there are more problems in this area.

Signed-off-by: Ben Greear <greearb@candelatech.com>
igmp: Allow igmp to start with phantom interfaces.

Basic idea is to dummy out the interface if it doesn't
exist, creating a fake if-index as needed.  Add logic to
hopefully deal with this properly if/when the interface
appears.

Signed-off-by: Ben Greear <greearb@candelatech.com>
pim: Allow pim to start with phantom interfaces.

Basic idea is to dummy out the interface if it doesn't
exist, creating a fake if-index as needed.  Add logic to
hopefully deal with this properly if/when the interface
appears.

This is basically cut-and-paste of the same logic that
was just created for igmp.

Signed-off-by: Ben Greear <greearb@candelatech.com>
libproto: Start fake VIF index search at 1.

I think that PIM vif index of > 32 might be invalid,
and no good reason to start higher than 1 anyway.
pim: Deal better with fake VIFs.

Let fea tell us the vif index, and make the change in
the vifs-updated logic.

Add some debug logic for pim shutdown paths.

Signed-off-by:  Ben Greear <greearb@candelatech.com>