void flow_format(struct ds *ds, const struct flow *flow) { ds_put_format(ds, "priority:%"PRIu32 ",tunnel:%#"PRIx64 ",metadata:%#"PRIx64 ",in_port:%04"PRIx16, flow->skb_priority, ntohll(flow->tun_id), ntohll(flow->metadata), flow->in_port); ds_put_format(ds, ",tci("); if (flow->vlan_tci) { ds_put_format(ds, "vlan:%"PRIu16",pcp:%d", vlan_tci_to_vid(flow->vlan_tci), vlan_tci_to_pcp(flow->vlan_tci)); } else { ds_put_char(ds, '0'); } ds_put_format(ds, ") mac("ETH_ADDR_FMT"->"ETH_ADDR_FMT ") type:%04"PRIx16, ETH_ADDR_ARGS(flow->dl_src), ETH_ADDR_ARGS(flow->dl_dst), ntohs(flow->dl_type)); if (flow->dl_type == htons(ETH_TYPE_IPV6)) { ds_put_format(ds, " label:%#"PRIx32" proto:%"PRIu8" tos:%#"PRIx8 " ttl:%"PRIu8" ipv6(", ntohl(flow->ipv6_label), flow->nw_proto, flow->nw_tos, flow->nw_ttl); print_ipv6_addr(ds, &flow->ipv6_src); ds_put_cstr(ds, "->"); print_ipv6_addr(ds, &flow->ipv6_dst); ds_put_char(ds, ')'); } else { ds_put_format(ds, " proto:%"PRIu8" tos:%#"PRIx8" ttl:%"PRIu8 " ip("IP_FMT"->"IP_FMT")", flow->nw_proto, flow->nw_tos, flow->nw_ttl, IP_ARGS(&flow->nw_src), IP_ARGS(&flow->nw_dst)); } if (flow->nw_frag) { ds_put_format(ds, " frag(%s)", flow->nw_frag == FLOW_NW_FRAG_ANY ? "first" : flow->nw_frag == (FLOW_NW_FRAG_ANY | FLOW_NW_FRAG_LATER) ? "later" : "<error>"); } if (flow->tp_src || flow->tp_dst) { ds_put_format(ds, " port(%"PRIu16"->%"PRIu16")", ntohs(flow->tp_src), ntohs(flow->tp_dst)); } if (!eth_addr_is_zero(flow->arp_sha) || !eth_addr_is_zero(flow->arp_tha)) { ds_put_format(ds, " arp_ha("ETH_ADDR_FMT"->"ETH_ADDR_FMT")", ETH_ADDR_ARGS(flow->arp_sha), ETH_ADDR_ARGS(flow->arp_tha)); } }
void ip_format_masked(ovs_be32 ip, ovs_be32 mask, struct ds *s) { ds_put_format(s, IP_FMT, IP_ARGS(&ip)); if (mask != htonl(UINT32_MAX)) { if (ip_is_cidr(mask)) { ds_put_format(s, "/%d", ip_count_cidr_bits(mask)); } else { ds_put_format(s, "/"IP_FMT, IP_ARGS(&mask)); } } }
void flow_print(FILE *stream, const struct flow *flow) { fprintf(stream, "port %04x vlan-vid %04x vlan-pcp %02x src-mac "ETH_ADDR_FMT" " "dst-mac "ETH_ADDR_FMT" frm-type %04x ip-tos %02x ip-proto %02x " "src-ip "IP_FMT" dst-ip "IP_FMT" tp-src %d tp-dst %d", ntohs(flow->in_port), ntohs(flow->dl_vlan), flow->dl_vlan_pcp, ETH_ADDR_ARGS(flow->dl_src), ETH_ADDR_ARGS(flow->dl_dst), ntohs(flow->dl_type), flow->nw_tos, flow->nw_proto, IP_ARGS(&flow->nw_src), IP_ARGS(&flow->nw_dst), ntohs(flow->tp_src), ntohs(flow->tp_dst)); }
static void lex_token_format_value(const union mf_subvalue *value, enum lex_format format, struct ds *s) { switch (format) { case LEX_F_DECIMAL: ds_put_format(s, "%"PRIu64, ntohll(value->integer)); break; case LEX_F_HEXADECIMAL: mf_format_subvalue(value, s); break; case LEX_F_IPV4: ds_put_format(s, IP_FMT, IP_ARGS(value->ipv4)); break; case LEX_F_IPV6: ipv6_format_addr(&value->ipv6, s); break; case LEX_F_ETHERNET: ds_put_format(s, ETH_ADDR_FMT, ETH_ADDR_ARGS(value->mac)); break; default: OVS_NOT_REACHED(); } }
static void discovery_status_cb(struct status_reply *sr, void *d_) { struct discovery *d = d_; status_reply_put(sr, "accept-remote=%s", d->s->accept_controller_re); status_reply_put(sr, "n-changes=%d", d->n_changes); if (d->dhcp) { status_reply_put(sr, "state=%s", dhclient_get_state(d->dhcp)); status_reply_put(sr, "state-elapsed=%u", dhclient_get_state_elapsed(d->dhcp)); if (dhclient_is_bound(d->dhcp)) { uint32_t ip = dhclient_get_ip(d->dhcp); uint32_t netmask = dhclient_get_netmask(d->dhcp); uint32_t router = dhclient_get_router(d->dhcp); const struct dhcp_msg *cfg = dhclient_get_config(d->dhcp); uint32_t dns_server; char *domain_name; int i; status_reply_put(sr, "ip="IP_FMT, IP_ARGS(&ip)); status_reply_put(sr, "netmask="IP_FMT, IP_ARGS(&netmask)); if (router) { status_reply_put(sr, "router="IP_FMT, IP_ARGS(&router)); } for (i = 0; dhcp_msg_get_ip(cfg, DHCP_CODE_DNS_SERVER, i, &dns_server); i++) { status_reply_put(sr, "dns%d="IP_FMT, i, IP_ARGS(&dns_server)); } domain_name = dhcp_msg_get_string(cfg, DHCP_CODE_DOMAIN_NAME); if (domain_name) { status_reply_put(sr, "domain=%s", domain_name); free(domain_name); } status_reply_put(sr, "lease-remaining=%u", dhclient_get_lease_remaining(d->dhcp)); } } }
static int ptcp_accept(int fd, const struct sockaddr *sa, size_t sa_len, struct stream **streamp) { const struct sockaddr_in *sin = (const struct sockaddr_in *) sa; char name[128]; if (sa_len == sizeof(struct sockaddr_in) && sin->sin_family == AF_INET) { sprintf(name, "tcp:"IP_FMT, IP_ARGS(&sin->sin_addr)); sprintf(strchr(name, '\0'), ":%"PRIu16, ntohs(sin->sin_port)); } else { strcpy(name, "tcp"); } return new_tcp_stream(name, fd, 0, sin, streamp); }
static int ptcp_open(const char *name, char *suffix, struct pstream **pstreamp, uint8_t dscp) { char bound_name[128]; int fd; struct sockaddr_in sin; fd = inet_open_passive(SOCK_STREAM, suffix, -1, &sin, dscp); if (fd < 0) { return -fd; } sprintf(bound_name, "ptcp%"PRIu16":"IP_FMT, ntohs(sin.sin_port), IP_ARGS(&sin.sin_addr.s_addr)); return new_fd_pstream(bound_name, fd, ptcp_accept, NULL, pstreamp); }
void ofl_structs_oxm_tlv_print(FILE *stream, struct ofl_match_tlv *f) { uint8_t field = OXM_FIELD(f->header); switch (field) { case OFPXMT_OFB_IN_PORT: fprintf(stream, "in_port=\"%d\"", *((uint32_t*) f->value)); break; case OFPXMT_OFB_IN_PHY_PORT: fprintf(stream, "in_phy_port=\"%d\"", *((uint32_t*) f->value)); break; case OFPXMT_OFB_VLAN_VID: { uint16_t v = *((uint16_t *) f->value); if (v == OFPVID_NONE) fprintf(stream, "vlan_vid= none"); else if (v == OFPVID_PRESENT && OXM_HASMASK(f->header)) fprintf(stream, "vlan_vid= any"); else fprintf(stream, "vlan_vid=\"%d\"",v & VLAN_VID_MASK); break; } case OFPXMT_OFB_VLAN_PCP: fprintf(stream, "vlan_pcp=\"%d\"", *f->value & 0x7); break; case OFPXMT_OFB_ETH_TYPE: fprintf(stream, "eth_type=\"0x%x\"", *((uint16_t *) f->value)); break; case OFPXMT_OFB_TCP_SRC: fprintf(stream, "tcp_src=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_TCP_DST: fprintf(stream, "tcp_dst=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_UDP_SRC: fprintf(stream, "udp_src=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_UDP_DST: fprintf(stream, "udp_dst=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_SCTP_SRC: fprintf(stream, "sctp_src=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_SCTP_DST: fprintf(stream, "sctp_dst=\"%d\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_ETH_SRC: fprintf(stream, "eth_src=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", eth_src_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } break; case OFPXMT_OFB_ETH_DST: fprintf(stream, "eth_dst=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", eth_dst_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } break; case OFPXMT_OFB_IPV4_DST: fprintf(stream, "ipv4_dst=\""IP_FMT"\"", IP_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", ipv4_dst_mask=\""IP_FMT"\"", IP_ARGS(f->value + 4)); } break; case OFPXMT_OFB_IPV4_SRC: fprintf(stream, "ipv4_src=\""IP_FMT"\"", IP_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", ipv4_src_mask=\""IP_FMT"\"", IP_ARGS(f->value + 4)); } break; case OFPXMT_OFB_IP_PROTO: fprintf(stream, "ip_proto=\"%d\"", *f->value); break; case OFPXMT_OFB_IP_DSCP: fprintf(stream, "ip_dscp=\"%d\"", *f->value & 0x3f); break; case OFPXMT_OFB_IP_ECN: fprintf(stream, "ip_ecn=\"%d\"", *f->value & 0x3); break; case OFPXMT_OFB_ICMPV4_TYPE: fprintf(stream, "icmpv4_type= \"%d\"", *f->value); break; case OFPXMT_OFB_ICMPV4_CODE: fprintf(stream, "icmpv4_code=\"%d\"", *f->value); break; case OFPXMT_OFB_ARP_SHA: fprintf(stream, "arp_sha=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", arp_sha_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } break; case OFPXMT_OFB_ARP_THA: fprintf(stream, "arp_tha=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", arp_tha_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } break; case OFPXMT_OFB_ARP_SPA: fprintf(stream, "arp_spa=\""IP_FMT"\"", IP_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", arp_sha_mask=\""IP_FMT"\"", IP_ARGS(f->value + 4)); } break; case OFPXMT_OFB_ARP_TPA: fprintf(stream, "arp_tpa=\""IP_FMT"\"", IP_ARGS(f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", arp_tpa_mask=\""IP_FMT"\"", IP_ARGS(f->value + 4)); } break; case OFPXMT_OFB_ARP_OP: fprintf(stream, "arp_op=\"0x%x\"", *((uint16_t*) f->value)); break; case OFPXMT_OFB_IPV6_SRC: { char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); fprintf(stream, "nw_src_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)) { inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, ", nw_src_ipv6_mask=\"%s\"", addr_str); } break; } case OFPXMT_OFB_IPV6_DST: { char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); fprintf(stream, "nw_dst_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)) { inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, ", nw_dst_ipv6_mask=\"%s\"", addr_str); } break; } case OFPXMT_OFB_IPV6_ND_TARGET: { char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); fprintf(stream, "ipv6_nd_target=\"%s\"", addr_str); break; } case OFPXMT_OFB_IPV6_ND_SLL: fprintf(stream, "ipv6_nd_sll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); break; case OFPXMT_OFB_IPV6_ND_TLL: fprintf(stream, "ipv6_nd_tll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); break; case OFPXMT_OFB_IPV6_FLABEL: fprintf(stream, "ipv6_flow_label=\"%d\"", *((uint32_t*) f->value) & 0x000fffff); if (OXM_HASMASK(f->header)) { fprintf(stream, ", ipv6_flow_label_mask=\"%d\"", *((uint32_t*) (f->value+4))); } break; case OFPXMT_OFB_ICMPV6_TYPE: fprintf(stream, "icmpv6_type=\"%d\"", *f->value); break; case OFPXMT_OFB_ICMPV6_CODE: fprintf(stream, "icmpv6_code=\"%d\"", *f->value); break; case OFPXMT_OFB_MPLS_LABEL: fprintf(stream, "mpls_label=\"%d\"",((uint32_t) *f->value) & 0x000fffff); break; case OFPXMT_OFB_MPLS_TC: fprintf(stream, "mpls_tc=\"%d\"", *f->value & 0x3); break; case OFPXMT_OFB_MPLS_BOS: fprintf(stream, "mpls_bos=\"%d\"", *f->value & 0xfe); break; case OFPXMT_OFB_METADATA: fprintf(stream, "metadata=\"0x%llx\"", *((uint64_t*) f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", metadata_mask=\"0x%llx\"", *((uint64_t*)(f->value+8))); } break; case OFPXMT_OFB_PBB_ISID : fprintf(stream, "pbb_isid=\"%d\"", *((uint32_t*) f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", pbb_isid_mask=\"%d\"", *((uint32_t*)(f->value+4))); } break; case OFPXMT_OFB_TUNNEL_ID: fprintf(stream, "tunnel_id=\"%lld\"", *((uint64_t*) f->value)); if (OXM_HASMASK(f->header)) { fprintf(stream, ", tunnel_id_mask=\"%lld\"", *((uint64_t*)(f->value+8))); } break; case OFPXMT_OFB_IPV6_EXTHDR: fprintf(stream, "ext_hdr=\""); ofl_ipv6_ext_hdr_print(stream, *((uint16_t*) f->value)); fprintf(stream, "\""); if (OXM_HASMASK(f->header)) { fprintf(stream, ", ext_hdr_mask=\"0x%x\"", *((uint16_t*)(f->value+4))); } break; default: fprintf(stream, "unknown type %d", field); } }
static void print_netflow(struct ofpbuf *buf) { const struct netflow_v5_header *hdr; int i; hdr = ofpbuf_try_pull(buf, sizeof *hdr); if (!hdr) { printf("truncated NetFlow packet header\n"); return; } printf("header: v%"PRIu16", " "uptime %"PRIu32", " "now %"PRIu32".%09"PRIu32", " "seq %"PRIu32", " "engine %"PRIu8",%"PRIu8, ntohs(hdr->version), ntohl(hdr->sysuptime), ntohl(hdr->unix_secs), ntohl(hdr->unix_nsecs), ntohl(hdr->flow_seq), hdr->engine_type, hdr->engine_id); if (hdr->sampling_interval != htons(0)) { printf(", interval %"PRIu16, ntohs(hdr->sampling_interval)); } putchar('\n'); for (i = 0; i < ntohs(hdr->count); i++) { struct netflow_v5_record *rec; rec = ofpbuf_try_pull(buf, sizeof *rec); if (!rec) { printf("truncated NetFlow records\n"); return; } printf("seq %"PRIu32": "IP_FMT" > "IP_FMT, ntohl(hdr->flow_seq), IP_ARGS(rec->src_addr), IP_ARGS(rec->dst_addr)); printf(", if %"PRIu16" > %"PRIu16, ntohs(rec->input), ntohs(rec->output)); printf(", %"PRIu32" pkts, %"PRIu32" bytes", ntohl(rec->packet_count), ntohl(rec->byte_count)); switch (rec->ip_proto) { case IPPROTO_TCP: printf(", TCP %"PRIu16" > %"PRIu16, ntohs(rec->src_port), ntohs(rec->dst_port)); if (rec->tcp_flags) { struct ds s = DS_EMPTY_INITIALIZER; packet_format_tcp_flags(&s, rec->tcp_flags); printf(" %s", ds_cstr(&s)); ds_destroy(&s); } break; case IPPROTO_UDP: printf(", UDP %"PRIu16" > %"PRIu16, ntohs(rec->src_port), ntohs(rec->dst_port)); break; case IPPROTO_ICMP: printf(", ICMP %"PRIu16":%"PRIu16, ntohs(rec->dst_port) >> 8, ntohs(rec->dst_port) & 0xff); if (rec->src_port != htons(0)) { printf(", src_port=%"PRIu16, ntohs(rec->src_port)); } break; default: printf(", proto %"PRIu8, rec->ip_proto); break; } if (rec->ip_proto != IPPROTO_TCP && rec->tcp_flags != 0) { printf(", flags %"PRIx8, rec->tcp_flags); } if (rec->ip_proto != IPPROTO_TCP && rec->ip_proto != IPPROTO_UDP && rec->ip_proto != IPPROTO_ICMP) { if (rec->src_port != htons(0)) { printf(", src_port %"PRIu16, ntohs(rec->src_port)); } if (rec->dst_port != htons(0)) { printf(", dst_port %"PRIu16, ntohs(rec->dst_port)); } } if (rec->ip_tos) { printf(", TOS %"PRIx8, rec->ip_tos); } printf(", time %"PRIu32"...%"PRIu32, ntohl(rec->init_time), ntohl(rec->used_time)); if (rec->nexthop != htonl(0)) { printf(", nexthop "IP_FMT, IP_ARGS(rec->nexthop)); } if (rec->src_as != htons(0) || rec->dst_as != htons(0)) { printf(", AS %"PRIu16" > %"PRIu16, ntohs(rec->src_as), ntohs(rec->dst_as)); } if (rec->src_mask != 0 || rec->dst_mask != 0) { printf(", mask %"PRIu8" > %"PRIu8, rec->src_mask, rec->dst_mask); } if (rec->pad1) { printf(", pad1 %"PRIu8, rec->pad1); } if (rec->pad[0] || rec->pad[1]) { printf(", pad %"PRIu8", %"PRIu8, rec->pad[0], rec->pad[1]); } putchar('\n'); } if (buf->size) { printf("%zu extra bytes after last record\n", buf->size); } }
void print_oxm_tlv(FILE *stream, struct ofl_match_tlv *f, size_t *size){ if (f->header == OXM_OF_IN_PORT){ fprintf(stream, "in_port=%d",*((uint32_t*) f->value)); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IN_PHY_PORT){ fprintf(stream, "in_phy_port=%d",*((uint32_t*) f->value)); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_VLAN_VID){ if ((uint16_t) *f->value == OFPVID_NONE) fprintf(stream, "vlan_vid= none"); else if ((uint16_t) *f->value == OFPVID_PRESENT) fprintf(stream, "vlan_vid= present"); else fprintf(stream, "vlan_vid= %d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_VLAN_PCP){ fprintf(stream, "vlan_pcp= %d", *f->value & 0x7); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ETH_TYPE){ uint16_t *v = (uint16_t *) f->value; fprintf(stream, "eth_type=0x"); fprintf(stream,"%x", *v); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_TCP_SRC){ fprintf(stream, "tcp_src=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_TCP_DST){ fprintf(stream, "tcp_dst=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_UDP_SRC){ fprintf(stream, "udp_src=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_UDP_DST){ fprintf(stream, "udp_dst=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_SCTP_SRC){ fprintf(stream, "sctp_src=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_SCTP_DST){ fprintf(stream, "sctp_dst=%d",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ETH_SRC || f->header == OXM_OF_ETH_SRC_W){ fprintf(stream, "eth_src=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, "eth_src_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ETH_DST || f->header == OXM_OF_ETH_DST_W){ fprintf(stream, "eth_dst=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, "eth_dst_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV4_SRC || f->header == OXM_OF_IPV4_SRC_W){ fprintf(stream, "ipv4_src=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, "ipv4_src_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IP_PROTO){ fprintf(stream, "ip_proto= %d", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IP_DSCP){ fprintf(stream, "ip_dscp= %d", *f->value & 0x3f); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IP_ECN){ fprintf(stream, "ip_ecn= %d", *f->value & 0x3); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ICMPV4_TYPE){ fprintf(stream, "icmpv4_type= %d", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ICMPV4_CODE){ fprintf(stream, "icmpv4_code= %d", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV4_DST || f->header == OXM_OF_IPV4_DST_W){ fprintf(stream, "ipv4_dst=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, "ipv4_dst_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ARP_SPA || f->header == OXM_OF_ARP_SPA_W ){ fprintf(stream, "arp_sha=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, "arp_sha_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ARP_TPA || f->header == OXM_OF_ARP_TPA_W){ fprintf(stream, "arp_tpa=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, "arp_tpa_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ARP_OP){ uint16_t *v = (uint16_t *) f->value; fprintf(stream, "arp_op=0x"); fprintf(stream,"%x", *v); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_SRC || f->header == OXM_OF_IPV6_SRC_W ){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "nw_src_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)){ *size -= 16; inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, "nw_src_ipv6_mask=\"%s\"", addr_str); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_DST || f->header == OXM_OF_IPV6_DST_W){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "nw_dst_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)){ *size -= 16; inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, "nw_dst_ipv6_mask=\"%s\"", addr_str); } if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_ND_TARGET){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "ipv6_nd_target=\"%s\"", addr_str); if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_ND_SLL){ fprintf(stream, "ipv6_nd_sll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_ND_TLL){ fprintf(stream, "ipv6_nd_tll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_IPV6_FLABEL){ uint32_t mask = 0xfffff; fprintf(stream, "ipv6_flow_label=%x",((uint32_t) *f->value) & mask ); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ICMPV6_TYPE){ fprintf(stream, "icmpv6_type= %d", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_ICMPV6_CODE){ fprintf(stream, "icmpv6_code= %d", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_MPLS_LABEL){ uint32_t mask = 0xfffff; fprintf(stream, "mpls_label=%x",((uint32_t) *f->value) & mask ); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_MPLS_TC){ fprintf(stream, "mpls_tc= %d", *f->value & 0x3); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (f->header == OXM_OF_METADATA || f->header == OXM_OF_METADATA_W){ fprintf(stream, "metadata= %lld", (uint64_t) *f->value); *size -= 12; if (OXM_HASMASK(f->header)){ fprintf(stream, "metadata_mask= %lld", (uint64_t) *(f->value + 8)); *size -= 8; } if (*size > 4) fprintf(stream, ", "); } }
void format_odp_action(struct ds *ds, const struct nlattr *a) { const uint8_t *eth; ovs_be32 ip; if (nl_attr_get_size(a) != odp_action_len(nl_attr_type(a))) { ds_put_format(ds, "bad length %zu, expected %d for: ", nl_attr_get_size(a), odp_action_len(nl_attr_type(a))); format_generic_odp_action(ds, a); return; } switch (nl_attr_type(a)) { case OVS_ACTION_ATTR_OUTPUT: ds_put_format(ds, "%"PRIu16, nl_attr_get_u32(a)); break; case OVS_ACTION_ATTR_USERSPACE: ds_put_format(ds, "userspace(%"PRIu64")", nl_attr_get_u64(a)); break; case OVS_ACTION_ATTR_SET_TUNNEL: ds_put_format(ds, "set_tunnel(%#"PRIx64")", ntohll(nl_attr_get_be64(a))); break; case OVS_ACTION_ATTR_PUSH_VLAN: ds_put_format(ds, "push_vlan(vid=%"PRIu16",pcp=%d)", vlan_tci_to_vid(nl_attr_get_be16(a)), vlan_tci_to_pcp(nl_attr_get_be16(a))); break; case OVS_ACTION_ATTR_POP_VLAN: ds_put_format(ds, "pop_vlan"); break; case OVS_ACTION_ATTR_SET_DL_SRC: eth = nl_attr_get_unspec(a, ETH_ADDR_LEN); ds_put_format(ds, "set_dl_src("ETH_ADDR_FMT")", ETH_ADDR_ARGS(eth)); break; case OVS_ACTION_ATTR_SET_DL_DST: eth = nl_attr_get_unspec(a, ETH_ADDR_LEN); ds_put_format(ds, "set_dl_dst("ETH_ADDR_FMT")", ETH_ADDR_ARGS(eth)); break; case OVS_ACTION_ATTR_SET_NW_SRC: ip = nl_attr_get_be32(a); ds_put_format(ds, "set_nw_src("IP_FMT")", IP_ARGS(&ip)); break; case OVS_ACTION_ATTR_SET_NW_DST: ip = nl_attr_get_be32(a); ds_put_format(ds, "set_nw_dst("IP_FMT")", IP_ARGS(&ip)); break; case OVS_ACTION_ATTR_SET_NW_TOS: ds_put_format(ds, "set_nw_tos(%"PRIu8")", nl_attr_get_u8(a)); break; case OVS_ACTION_ATTR_SET_TP_SRC: ds_put_format(ds, "set_tp_src(%"PRIu16")", ntohs(nl_attr_get_be16(a))); break; case OVS_ACTION_ATTR_SET_TP_DST: ds_put_format(ds, "set_tp_dst(%"PRIu16")", ntohs(nl_attr_get_be16(a))); break; case OVS_ACTION_ATTR_SET_PRIORITY: ds_put_format(ds, "set_priority(%#"PRIx32")", nl_attr_get_u32(a)); break; case OVS_ACTION_ATTR_POP_PRIORITY: ds_put_cstr(ds, "pop_priority"); break; default: format_generic_odp_action(ds, a); break; } }
int pxe_init(IP4_t * myaddr, int * sendsize) { pxenv_t * pxe; pxe_t * pxe2; t_PXENV_GET_CACHED_INFO * pxe_cache; t_PXENV_UNDI_GET_INFORMATION * pxe_info; bios_pxe(); if (pxe_op != PXE_VN) return(1); /* Find PXENV+ structure */ pxe = (pxenv_t *)((uintptr_t)((pxe_seg << 4) + pxe_off)); /* Find !PXE structure */ pxe2 = (pxe_t *)((uintptr_t)((pxe->PXEPtr.segment << 4) + pxe->PXEPtr.offset)); #ifndef SILENT printf("PXE version: %d.%d entry: %x:%x\n", pxe->Version >> 8, pxe->Version & 0xFF, pxe2->EntryPointSP.segment, pxe2->EntryPointSP.offset); #endif /* Save the PXE entry point */ pxe_seg = pxe2->EntryPointSP.segment; pxe_off = pxe2->EntryPointSP.offset; /* Get UNDI info */ bzero (pxebuf, sizeof(pxebuf)); pxe_info = (t_PXENV_UNDI_GET_INFORMATION *)pxebuf; pxe_op = (uint16_t)PXENV_UNDI_GET_INFORMATION; pxe_addr = (uint16_t *)pxe_info; if (pxe_call() != 0) { #ifndef SILENT printf("PXE get UNDI info failed\n"); #endif return(1); } #ifndef SILENT printf("pxe0 at 0x%x irq %d\n", pxe_info->BaseIo, pxe_info->IntNumber); #endif *sendsize = pxe_info->TxBufCt; /* Now find our IP address */ bzero (pxebuf, sizeof(pxebuf)); pxe_cache = (t_PXENV_GET_CACHED_INFO *)pxebuf; pxe_cache->PacketType = PXENV_PACKET_TYPE_BINL_REPLY; pxe_op = (uint16_t)PXENV_GET_CACHED_INFO; pxe_addr = (uint16_t *)pxe_cache; pxe_call(); if (pxe_call() != 0) { #ifndef SILENT printf("PXE get cache failed\n"); #endif return(1); } bootp = (BOOTPLAYER *)((uintptr_t)((pxe_cache->Buffer.segment << 4) + pxe_cache->Buffer.offset)); #ifndef SILENT printf("My IP address: %d.%d.%d.%d\n", IP_ARGS(ntohl(bootp->yip))); printf("My eth address: %02x:%02x:%02x:%02x:%02x:%02x\n", bootp->CAddr[0], bootp->CAddr[1], bootp->CAddr[2], bootp->CAddr[3], bootp->CAddr[4], bootp->CAddr[5]); #endif *myaddr = ntohl(bootp->yip); return (0); }
void format_odp_action(struct ds *ds, const union odp_action *a) { switch (a->type) { case ODPAT_OUTPUT: ds_put_format(ds, "%"PRIu16, a->output.port); break; case ODPAT_OUTPUT_GROUP: ds_put_format(ds, "g%"PRIu16, a->output_group.group); break; case ODPAT_CONTROLLER: ds_put_format(ds, "ctl(%"PRIu32")", a->controller.arg); break; case ODPAT_SET_TUNNEL: ds_put_format(ds, "set_tunnel(0x%08"PRIx32")", ntohl(a->tunnel.tun_id)); break; case ODPAT_SET_VLAN_VID: ds_put_format(ds, "set_vlan(%"PRIu16")", ntohs(a->vlan_vid.vlan_vid)); break; case ODPAT_SET_VLAN_PCP: ds_put_format(ds, "set_vlan_pcp(%"PRIu8")", a->vlan_pcp.vlan_pcp); break; case ODPAT_STRIP_VLAN: ds_put_format(ds, "strip_vlan"); break; case ODPAT_SET_DL_SRC: ds_put_format(ds, "set_dl_src("ETH_ADDR_FMT")", ETH_ADDR_ARGS(a->dl_addr.dl_addr)); break; case ODPAT_SET_DL_DST: ds_put_format(ds, "set_dl_dst("ETH_ADDR_FMT")", ETH_ADDR_ARGS(a->dl_addr.dl_addr)); break; case ODPAT_SET_NW_SRC: ds_put_format(ds, "set_nw_src("IP_FMT")", IP_ARGS(&a->nw_addr.nw_addr)); break; case ODPAT_SET_NW_DST: ds_put_format(ds, "set_nw_dst("IP_FMT")", IP_ARGS(&a->nw_addr.nw_addr)); break; case ODPAT_SET_NW_TOS: ds_put_format(ds, "set_nw_tos(%"PRIu8")", a->nw_tos.nw_tos); break; case ODPAT_SET_TP_SRC: ds_put_format(ds, "set_tp_src(%"PRIu16")", ntohs(a->tp_port.tp_port)); break; case ODPAT_SET_TP_DST: ds_put_format(ds, "set_tp_dst(%"PRIu16")", ntohs(a->tp_port.tp_port)); break; case ODPAT_SET_PRIORITY: ds_put_format(ds, "set_priority(0x%"PRIx32")", a->priority.priority); break; case ODPAT_POP_PRIORITY: ds_put_cstr(ds, "pop_priority"); break; default: ds_put_format(ds, "***bad action 0x%"PRIx16"***", a->type); break; } }
void print_oxm_tlv(FILE *stream, struct ofl_match_tlv *f, size_t *size){ uint8_t field = OXM_FIELD(f->header); if (field == OFPXMT_OFB_IN_PORT){ fprintf(stream, "in_port=\"%d\"",*((uint32_t*) f->value)); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IN_PHY_PORT){ fprintf(stream, "in_phy_port=\"%d\"",*((uint32_t*) f->value)); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_VLAN_VID){ uint16_t *v = (uint16_t *) f->value; if (*v == OFPVID_NONE) fprintf(stream, "vlan_vid= none"); else if (*v == OFPVID_PRESENT && OXM_HASMASK(f->header)) fprintf(stream, "vlan_vid= any"); else fprintf(stream, "vlan_vid=\"%d\"",*v & VLAN_VID_MASK); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_VLAN_PCP){ fprintf(stream, "vlan_pcp=\"%d\"", *f->value & 0x7); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ETH_TYPE){ uint16_t *v = (uint16_t *) f->value; fprintf(stream, "eth_type="); fprintf(stream,"\"0x%x\"", *v); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_TCP_SRC){ fprintf(stream, "tcp_src=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_TCP_DST){ fprintf(stream, "tcp_dst=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_UDP_SRC){ fprintf(stream, "udp_src=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_UDP_DST){ fprintf(stream, "udp_dst=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_SCTP_SRC){ fprintf(stream, "sctp_src=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_SCTP_DST){ fprintf(stream, "sctp_dst=\"%d\"",*((uint16_t*) f->value)); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ETH_SRC){ fprintf(stream, "eth_src=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, ", eth_src_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ETH_DST){ fprintf(stream, "eth_dst=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, ", eth_dst_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV4_DST){ fprintf(stream, "ipv4_dst=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, ", ipv4_dst_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV4_SRC){ fprintf(stream, "ipv4_src=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, ", ipv4_src_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IP_PROTO){ fprintf(stream, "ip_proto=\"%d\"", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IP_DSCP){ fprintf(stream, "ip_dscp=\"%d\"", *f->value & 0x3f); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IP_ECN){ fprintf(stream, "ip_ecn=\"%d\"", *f->value & 0x3); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ICMPV4_TYPE){ fprintf(stream, "icmpv4_type= \"%d\"", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ICMPV4_CODE){ fprintf(stream, "icmpv4_code=\"%d\"", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ARP_SHA){ fprintf(stream, "arp_sha=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, ", arp_sha_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ARP_THA){ fprintf(stream, "arp_tha=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (OXM_HASMASK(f->header)){ *size -= 6; fprintf(stream, ", arp_tha_mask=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value + 6)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ARP_SPA){ fprintf(stream, "arp_spa=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, ", arp_sha_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ARP_TPA){ fprintf(stream, "arp_tpa=\""IP_FMT"\"",IP_ARGS(f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ *size -= 4; fprintf(stream, ", arp_tpa_mask=\""IP_FMT"\"",IP_ARGS(f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ARP_OP){ uint16_t *v = (uint16_t *) f->value; fprintf(stream, "arp_op=\"0x"); fprintf(stream,"%x\"", *v); *size -= 6; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_SRC){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "nw_src_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)){ *size -= 16; inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, ", nw_src_ipv6_mask=\"%s\"", addr_str); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_DST){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "nw_dst_ipv6=\"%s\"", addr_str); if (OXM_HASMASK(f->header)){ *size -= 16; inet_ntop(AF_INET6, f->value + 16, addr_str, INET6_ADDRSTRLEN); fprintf(stream, ", nw_dst_ipv6_mask=\"%s\"", addr_str); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_ND_TARGET){ char addr_str[INET6_ADDRSTRLEN]; inet_ntop(AF_INET6, f->value, addr_str, INET6_ADDRSTRLEN); *size -= 20; fprintf(stream, "ipv6_nd_target=\"%s\"", addr_str); if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_ND_SLL){ fprintf(stream, "ipv6_nd_sll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_ND_TLL){ fprintf(stream, "ipv6_nd_tll=\""ETH_ADDR_FMT"\"", ETH_ADDR_ARGS(f->value)); *size -= 10; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_FLABEL){ uint32_t mask = 0x000fffff; *size -= 8; fprintf(stream, "ipv6_flow_label=\"%d\"",*((uint32_t*) f->value) & mask ); if (OXM_HASMASK(f->header)){ uint8_t *flabel_mask = (uint8_t*) f->value + 4; *size -= 4; fprintf(stream, ", ipv6_flow_label_mask=\"%d\"",*((uint32_t*)flabel_mask)); } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ICMPV6_TYPE){ fprintf(stream, "icmpv6_type=\"%d\"", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_ICMPV6_CODE){ fprintf(stream, "icmpv6_code=\"%d\"", *f->value); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_MPLS_LABEL){ uint32_t mask = 0xfffff; fprintf(stream, "mpls_label=\"%d\"",((uint32_t) *f->value) & mask ); *size -= 8; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_MPLS_TC){ fprintf(stream, "mpls_tc=\"%d\"", *f->value & 0x3); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_MPLS_BOS){ fprintf(stream, "mpls_bos=\"%d\"", *f->value & 0xfe); *size -= 5; if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_METADATA){ fprintf(stream, "metadata=\"%lld\"", *((uint64_t*) f->value)); *size -= 12; if (OXM_HASMASK(f->header)){ fprintf(stream, ", metadata_mask=\"%lld\"", *((uint64_t*) f->value+ 8 )); *size -= 8; } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_PBB_ISID ){ fprintf(stream, "pbb_isid=\"%d\"",*((uint32_t*) f->value)); *size -= 8; if (OXM_HASMASK(f->header)){ fprintf(stream, ", pbb_isid_mask=\"%d\"", *((uint32_t*) f->value +4)); *size -= 4; } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_TUNNEL_ID){ fprintf(stream, "tunnel_id=\"%lld\"", *((uint64_t*) f->value)); *size -= 12; if (OXM_HASMASK(f->header)){ fprintf(stream, ", tunnel_id_mask=\"%lld\"", *((uint64_t*) f->value+ 8 )); *size -= 8; } if (*size > 4) fprintf(stream, ", "); } else if (field == OFPXMT_OFB_IPV6_EXTHDR){ fprintf(stream, "ext_hdr=\\"); ofl_ipv6_ext_hdr_print(stream, *((uint16_t*) f->value) ); *size -= 6; if (OXM_HASMASK(f->header)){ *size -= 2; fprintf(stream, ", ext_hdr_mask=\"0x%x\"",*((uint16_t*) f->value + 4)); } if (*size > 4) fprintf(stream, ", "); } }