ovn/controller/pinctrl.c
static long long int
ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra)
{
    if (time_msec() < ra->next_announce) {
        return ra->next_announce;
    }

    uint64_t packet_stub[128 / 8];
    struct dp_packet packet;
    dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub);
    compose_nd_ra(&packet, ra->config->eth_src, ra->config->eth_dst,
            &ra->config->ipv6_src, &ra->config->ipv6_dst,
            255, ra->config->mo_flags, htons(IPV6_ND_RA_LIFETIME), 0, 0,
            ra->config->mtu);

    for (int i = 0; i < ra->config->prefixes.n_ipv6_addrs; i++) {
        ovs_be128 addr;
        memcpy(&addr, &ra->config->prefixes.ipv6_addrs[i].addr, sizeof addr);
        packet_put_ra_prefix_opt(&packet,
            ra->config->prefixes.ipv6_addrs[i].plen,
            ra->config->la_flags, htonl(IPV6_ND_RA_OPT_PREFIX_VALID_LIFETIME),
            htonl(IPV6_ND_RA_OPT_PREFIX_PREFERRED_LIFETIME), addr);
    }

    uint64_t ofpacts_stub[4096 / 8];
    struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(ofpacts_stub);

    /* Set MFF_LOG_DATAPATH and MFF_LOG_INPORT. */
    uint32_t dp_key = ra->metadata;
    uint32_t port_key = ra->port_key;
    put_load(dp_key, MFF_LOG_DATAPATH, 0, 64, &ofpacts);
    put_load(port_key, MFF_LOG_INPORT, 0, 32, &ofpacts);
    put_load(1, MFF_LOG_FLAGS, MLF_LOCAL_ONLY_BIT, 1, &ofpacts);
    struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(&ofpacts);
    resubmit->in_port = OFPP_CONTROLLER;
    resubmit->table_id = OFTABLE_LOG_INGRESS_PIPELINE;

    struct ofputil_packet_out po = {
        .packet = dp_packet_data(&packet),
        .packet_len = dp_packet_size(&packet),
        .buffer_id = UINT32_MAX,
        .ofpacts = ofpacts.data,
        .ofpacts_len = ofpacts.size,
    };

    match_set_in_port(&po.flow_metadata, OFPP_CONTROLLER);
    enum ofp_version version = rconn_get_version(swconn);
    enum ofputil_protocol proto = ofputil_protocol_from_ofp_version(version);
    queue_msg(swconn, ofputil_encode_packet_out(&po, proto));
    dp_packet_uninit(&packet);
    ofpbuf_uninit(&ofpacts);

    ra->next_announce = ipv6_ra_calc_next_announce(ra->config->min_interval,
            ra->config->max_interval);

    return ra->next_announce;
}
/* Called with in the pinctrl_handler thread context. */
Called with in the pinctrl_handler thread context.
Called with in the pinctrl_handler thread context .
static long long int
ipv6_ra_send(struct rconn *swconn, struct ipv6_ra_state *ra)
{
    if (time_msec() < ra->next_announce) {
        return ra->next_announce;
    }
    uint64_t packet_stub[128 / 8];
    struct dp_packet packet;
    dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub);
    compose_nd_ra(&packet, ra->config->eth_src, ra->config->eth_dst,
            &ra->config->ipv6_src, &ra->config->ipv6_dst,
            255, ra->config->mo_flags, htons(IPV6_ND_RA_LIFETIME), 0, 0,
            ra->config->mtu);
    for (int i = 0; i < ra->config->prefixes.n_ipv6_addrs; i++) {
        ovs_be128 addr;
        memcpy(&addr, &ra->config->prefixes.ipv6_addrs[i].addr, sizeof addr);
        packet_put_ra_prefix_opt(&packet,
            ra->config->prefixes.ipv6_addrs[i].plen,
            ra->config->la_flags, htonl(IPV6_ND_RA_OPT_PREFIX_VALID_LIFETIME),
            htonl(IPV6_ND_RA_OPT_PREFIX_PREFERRED_LIFETIME), addr);
    }
    uint64_t ofpacts_stub[4096 / 8];
    struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER(ofpacts_stub);
    uint32_t dp_key = ra->metadata;
    uint32_t port_key = ra->port_key;
    put_load(dp_key, MFF_LOG_DATAPATH, 0, 64, &ofpacts);
    put_load(port_key, MFF_LOG_INPORT, 0, 32, &ofpacts);
    put_load(1, MFF_LOG_FLAGS, MLF_LOCAL_ONLY_BIT, 1, &ofpacts);
    struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(&ofpacts);
    resubmit->in_port = OFPP_CONTROLLER;
    resubmit->table_id = OFTABLE_LOG_INGRESS_PIPELINE;
    struct ofputil_packet_out po = {
        .packet = dp_packet_data(&packet),
        .packet_len = dp_packet_size(&packet),
        .buffer_id = UINT32_MAX,
        .ofpacts = ofpacts.data,
        .ofpacts_len = ofpacts.size,
    };
    match_set_in_port(&po.flow_metadata, OFPP_CONTROLLER);
    enum ofp_version version = rconn_get_version(swconn);
    enum ofputil_protocol proto = ofputil_protocol_from_ofp_version(version);
    queue_msg(swconn, ofputil_encode_packet_out(&po, proto));
    dp_packet_uninit(&packet);
    ofpbuf_uninit(&ofpacts);
    ra->next_announce = ipv6_ra_calc_next_announce(ra->config->min_interval,
            ra->config->max_interval);
    return ra->next_announce;
}
static long long int ipv6_ra_send ( struct rconn * swconn , struct ipv6_ra_state * ra ) { if ( time_msec ( ) < ra -> next_announce ) { return ra -> next_announce ; } uint64_t packet_stub [ 128 / 8 ] ; struct dp_packet packet ; dp_packet_use_stub ( & packet , packet_stub , sizeof packet_stub ) ; compose_nd_ra ( & packet , ra -> config -> eth_src , ra -> config -> eth_dst , & ra -> config -> ipv6_src , & ra -> config -> ipv6_dst , 255 , ra -> config -> mo_flags , htons ( IPV6_ND_RA_LIFETIME ) , 0 , 0 , ra -> config -> mtu ) ; for ( int i = 0 ; i < ra -> config -> prefixes . n_ipv6_addrs ; i ++ ) { ovs_be128 addr ; memcpy ( & addr , & ra -> config -> prefixes . ipv6_addrs [ i ] . addr , sizeof addr ) ; packet_put_ra_prefix_opt ( & packet , ra -> config -> prefixes . ipv6_addrs [ i ] . plen , ra -> config -> la_flags , htonl ( IPV6_ND_RA_OPT_PREFIX_VALID_LIFETIME ) , htonl ( IPV6_ND_RA_OPT_PREFIX_PREFERRED_LIFETIME ) , addr ) ; } uint64_t ofpacts_stub [ 4096 / 8 ] ; struct ofpbuf ofpacts = OFPBUF_STUB_INITIALIZER ( ofpacts_stub ) ; uint32_t dp_key = ra -> metadata ; uint32_t port_key = ra -> port_key ; put_load ( dp_key , MFF_LOG_DATAPATH , 0 , 64 , & ofpacts ) ; put_load ( port_key , MFF_LOG_INPORT , 0 , 32 , & ofpacts ) ; put_load ( 1 , MFF_LOG_FLAGS , MLF_LOCAL_ONLY_BIT , 1 , & ofpacts ) ; struct ofpact_resubmit * resubmit = ofpact_put_RESUBMIT ( & ofpacts ) ; resubmit -> in_port = OFPP_CONTROLLER ; resubmit -> table_id = OFTABLE_LOG_INGRESS_PIPELINE ; struct ofputil_packet_out po = { . packet = dp_packet_data ( & packet ) , . packet_len = dp_packet_size ( & packet ) , . buffer_id = UINT32_MAX , . ofpacts = ofpacts . data , . ofpacts_len = ofpacts . size , } ; match_set_in_port ( & po . flow_metadata , OFPP_CONTROLLER ) ; enum ofp_version version = rconn_get_version ( swconn ) ; enum ofputil_protocol proto = ofputil_protocol_from_ofp_version ( version ) ; queue_msg ( swconn , ofputil_encode_packet_out ( & po , proto ) ) ; dp_packet_uninit ( & packet ) ; ofpbuf_uninit ( & ofpacts ) ; ra -> next_announce = ipv6_ra_calc_next_announce ( ra -> config -> min_interval , ra -> config -> max_interval ) ; return ra -> next_announce ; }
Called with in the pinctrl_handler thread context.
Called with in the pinctrl_handler thread context .
/* Set MFF_LOG_DATAPATH and MFF_LOG_INPORT. */