bool vr_unknown_uc_flood(struct vr_interface *ingress_vif, struct vr_nexthop *ingress_nh) { if (!ingress_vif) return false; if (vif_is_virtual(ingress_vif)) { return ((ingress_vif->vif_flags & VIF_FLAG_UNKNOWN_UC_FLOOD) != 0); } else if (vif_is_fabric(ingress_vif) && ingress_nh) { return ((ingress_nh->nh_flags & NH_FLAG_UNKNOWN_UC_FLOOD) != 0); } return false; }
static void vr_flush_entry(struct vrouter *router, struct vr_flow_entry *fe, struct vr_flow_md *flmd, struct vr_forwarding_md *fmd) { struct vr_list_node *head; struct vr_packet_node *pnode; struct vr_packet *pkt; struct vr_interface *vif; head = fe->fe_hold_list.node_p; fe->fe_hold_list.node_p = NULL; while (head) { pnode = (struct vr_packet_node *)head; if (fmd) { fmd->fmd_outer_src_ip = pnode->pl_outer_src_ip; fmd->fmd_label = pnode->pl_label; } pkt = pnode->pl_packet; /* * this is only a security check and not a catch all check. one note * of caution. please do not access pkt->vp_if till the if block is * succesfully bypassed */ vif = __vrouter_get_interface(router, pnode->pl_vif_idx); if (!vif || (pkt->vp_if != vif)) { vr_pfree(pkt, VP_DROP_INVALID_IF); goto loop_continue; } if (!pkt->vp_nh) { if (vif_is_fabric(pkt->vp_if) && fmd && (fmd->fmd_label >= 0)) { pkt->vp_nh = __vrouter_get_label(router, fmd->fmd_label); } } vr_flow_action(router, fe, flmd->flmd_index, pkt, pnode->pl_proto, fmd); loop_continue: head = pnode->pl_node.node_n; vr_free(pnode); } return; }
static inline void vr_get_flow_key(struct vr_flow_key *key, uint16_t vlan, struct vr_packet *pkt, unsigned int sip, unsigned int dip, unsigned char proto, unsigned short sport, unsigned short dport) { unsigned short nh_id; /* copy both source and destinations */ key->key_src_ip = sip; key->key_dest_ip = dip; key->key_proto = proto; key->key_zero = 0; if (vif_is_fabric(pkt->vp_if) && pkt->vp_nh) { nh_id = pkt->vp_nh->nh_id; } else if (vif_is_service(pkt->vp_if)) { nh_id = vif_vrf_table_get_nh(pkt->vp_if, vlan); } else { nh_id = pkt->vp_if->vif_nh_id; } key->key_nh_id = nh_id; switch (proto) { case VR_IP_PROTO_TCP: case VR_IP_PROTO_UDP: case VR_IP_PROTO_ICMP: key->key_src_port = sport; key->key_dst_port = dport; break; default: key->key_src_port = key->key_dst_port = 0; break; } return; }