/*
- * Copyright (c) 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "meta-flow.h"
-#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <netinet/icmp6.h>
const struct mf_field *
mf_from_id(enum mf_field_id id)
{
- assert((unsigned int) id < MFF_N_IDS);
+ ovs_assert((unsigned int) id < MFF_N_IDS);
return &mf_fields[id];
}
nxm_init_add_field(const struct mf_field *mf, uint32_t header)
{
if (header) {
- assert(!mf_from_nxm_header__(header));
+ ovs_assert(!mf_from_nxm_header__(header));
add_nxm_field(header, mf);
if (mf->maskable != MFM_NONE) {
add_nxm_field(NXM_MAKE_WILD_HEADER(header), mf);
uint8_t mac[ETH_ADDR_LEN],
uint8_t mask[ETH_ADDR_LEN])
{
- assert(mf->n_bytes == ETH_ADDR_LEN);
+ ovs_assert(mf->n_bytes == ETH_ADDR_LEN);
switch (sscanf(s, ETH_ADDR_SCAN_FMT"/"ETH_ADDR_SCAN_FMT,
ETH_ADDR_SCAN_ARGS(mac), ETH_ADDR_SCAN_ARGS(mask))){
{
int prefix;
- assert(mf->n_bytes == sizeof *ip);
+ ovs_assert(mf->n_bytes == sizeof *ip);
if (sscanf(s, IP_SCAN_FMT"/"IP_SCAN_FMT,
IP_SCAN_ARGS(ip), IP_SCAN_ARGS(mask)) == IP_SCAN_COUNT * 2) {
const char *name, *netmask;
int retval;
- assert(mf->n_bytes == sizeof *value);
+ ovs_assert(mf->n_bytes == sizeof *value);
name = strtok_r(str, "/", &save_ptr);
retval = name ? lookup_ipv6(name, value) : EINVAL;
{
uint16_t port;
- assert(mf->n_bytes == sizeof(ovs_be16));
+ ovs_assert(mf->n_bytes == sizeof(ovs_be16));
if (*s == '-') {
return xasprintf("%s: negative values not supported for %s",
s, mf->name);
mf_parse(const struct mf_field *mf, const char *s,
union mf_value *value, union mf_value *mask)
{
- if (!strcasecmp(s, "any") || !strcmp(s, "*")) {
+ if (!strcmp(s, "*")) {
memset(value, 0, mf->n_bytes);
memset(mask, 0, mf->n_bytes);
return NULL;
return mf_from_frag_string(s, &value->u8, &mask->u8);
case MFS_TNL_FLAGS:
- assert(mf->n_bytes == sizeof(ovs_be16));
+ ovs_assert(mf->n_bytes == sizeof(ovs_be16));
return mf_from_tun_flags_string(s, &value->be16, &mask->be16);
}
NOT_REACHED();
unsigned long long int integer;
int i;
- assert(mf->n_bytes <= 8);
+ ovs_assert(mf->n_bytes <= 8);
integer = 0;
for (i = 0; i < mf->n_bytes; i++) {