static void ipf_print_reass_packet(const char *es, const void *pkt) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(10, 10); if (!VLOG_DROP_WARN(&rl)) { struct ds ds = DS_EMPTY_INITIALIZER; ds_put_hex_dump(&ds, pkt, 128, 0, false); VLOG_WARN("%s\n%s", es, ds_cstr(&ds)); ds_destroy(&ds); } }
/* Given NXM/OXM value 'value' and mask 'mask', each 'width' bytes long, checks * for any 1-bit in the value where there is a 0-bit in the mask. Returns 0 if * none, otherwise an error code. */ static enum ofperr check_mask_consistency(const uint8_t *p, const struct mf_field *mf) { unsigned int width = mf->n_bytes; const uint8_t *value = p + 4; const uint8_t *mask = p + 4 + width; unsigned int i; for (i = 0; i < width; i++) { if (value[i] & ~mask[i]) { if (!VLOG_DROP_WARN(&rl)) { char *s = nx_match_to_string(p, width * 2 + 4); VLOG_WARN_RL(&rl, "Rejecting NXM/OXM entry %s with 1-bits in " "value for bits wildcarded by the mask.", s); free(s); } return OFPERR_OFPBMC_BAD_WILDCARDS; } } return 0; }
/* Given NXM/OXM value 'value' and mask 'mask', each 'width' bytes long, * checks for any 1-bit in the value where there is a 0-bit in the mask. If it * finds one, logs a warning. */ static void check_mask_consistency(const uint8_t *p, const struct mf_field *mf) { unsigned int width = mf->n_bytes; const uint8_t *value = p + 4; const uint8_t *mask = p + 4 + width; unsigned int i; for (i = 0; i < width; i++) { if (value[i] & ~mask[i]) { if (!VLOG_DROP_WARN(&rl)) { char *s = nx_match_to_string(p, width * 2 + 4); VLOG_WARN_RL(&rl, "NXM/OXM entry %s has 1-bits in value for " "bits wildcarded by the mask. (Future versions " "of OVS may report this as an OpenFlow error.)", s); break; } } } }