send_update(struct interface *ifp, int urgent,
            const unsigned char *prefix, unsigned char plen)
{
    babel_interface_nfo *babel_ifp = NULL;

    if(ifp == NULL) {
	struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        struct interface *ifp_aux;
        struct babel_route *route;
        FOR_ALL_INTERFACES(vrf, ifp_aux)
            send_update(ifp_aux, urgent, prefix, plen);
        if(prefix) {
            /* Since flushupdates only deals with non-wildcard interfaces, we
               need to do this now. */
            route = find_installed_route(prefix, plen);
            if(route && route_metric(route) < INFINITY)
                satisfy_request(prefix, plen, route->src->seqno, route->src->id,
                                NULL);
        }
        return;
    }

    if(!if_up(ifp))
        return;

    babel_ifp = babel_get_if_nfo(ifp);
    if(prefix) {
        debugf(BABEL_DEBUG_COMMON,"Sending update to %s for %s.",
               ifp->name, format_prefix(prefix, plen));
        buffer_update(ifp, prefix, plen);
    } else {
        struct route_stream *routes = NULL;
        send_self_update(ifp);
        debugf(BABEL_DEBUG_COMMON,"Sending update to %s for any.", ifp->name);
        routes = route_stream(1);
        if(routes) {
            while(1) {
                struct babel_route *route = route_stream_next(routes);
                if(route == NULL)
                    break;
                buffer_update(ifp, route->src->prefix, route->src->plen);
            }
            route_stream_done(routes);
        } else {
            flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
        }
        set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval);
        babel_ifp->last_update_time = babel_now.tv_sec;
    }
    schedule_update_flush(ifp, urgent);
}
send_update(struct interface *ifp, int urgent,
            const unsigned char *prefix, unsigned char plen)
{
    babel_interface_nfo *babel_ifp = NULL;

    if(ifp == NULL) {
	struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
        struct interface *ifp_aux;
        struct babel_route *route;
        FOR_ALL_INTERFACES(vrf, ifp_aux)
            send_update(ifp_aux, urgent, prefix, plen);
        if(prefix) {
             
            route = find_installed_route(prefix, plen);
            if(route && route_metric(route) < INFINITY)
                satisfy_request(prefix, plen, route->src->seqno, route->src->id,
                                NULL);
        }
        return;
    }

    if(!if_up(ifp))
        return;

    babel_ifp = babel_get_if_nfo(ifp);
    if(prefix) {
        debugf(BABEL_DEBUG_COMMON,"Sending update to %s for %s.",
               ifp->name, format_prefix(prefix, plen));
        buffer_update(ifp, prefix, plen);
    } else {
        struct route_stream *routes = NULL;
        send_self_update(ifp);
        debugf(BABEL_DEBUG_COMMON,"Sending update to %s for any.", ifp->name);
        routes = route_stream(1);
        if(routes) {
            while(1) {
                struct babel_route *route = route_stream_next(routes);
                if(route == NULL)
                    break;
                buffer_update(ifp, route->src->prefix, route->src->plen);
            }
            route_stream_done(routes);
        } else {
            flog_err(EC_BABEL_MEMORY, "Couldn't allocate route stream.");
        }
        set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval);
        babel_ifp->last_update_time = babel_now.tv_sec;
    }
    schedule_update_flush(ifp, urgent);
}