#include "dynamic-string.h"
#include "flow.h"
#include "netlink.h"
+#include "openvswitch/tunnel.h"
#include "packets.h"
#include "timeval.h"
#include "util.h"
void
format_odp_flow_key(struct ds *ds, const struct odp_flow_key *key)
{
- ds_put_format(ds, "tun_id%#"PRIx32" in_port%d tci(",
- ntohl(key->tun_id), key->in_port);
+ ds_put_format(ds, "tun_id%#"PRIx64" in_port%d tci(",
+ ntohll(key->tun_id), key->in_port);
if (key->dl_tci) {
ds_put_format(ds, "vlan%"PRIu16",pcp%d",
vlan_tci_to_vid(key->dl_tci),
switch ((enum odp_action_type) type) {
case ODPAT_OUTPUT: return 4;
- case ODPAT_CONTROLLER: return 4;
+ case ODPAT_CONTROLLER: return 8;
case ODPAT_SET_DL_TCI: return 2;
case ODPAT_STRIP_VLAN: return 0;
case ODPAT_SET_DL_SRC: return ETH_ADDR_LEN;
case ODPAT_SET_NW_TOS: return 1;
case ODPAT_SET_TP_SRC: return 2;
case ODPAT_SET_TP_DST: return 2;
- case ODPAT_SET_TUNNEL: return 4;
+ case ODPAT_SET_TUNNEL: return 8;
case ODPAT_SET_PRIORITY: return 4;
case ODPAT_POP_PRIORITY: return 0;
case ODPAT_DROP_SPOOFED_ARP: return 0;
static void
format_generic_odp_action(struct ds *ds, const struct nlattr *a)
{
+ size_t len = nl_attr_get_size(a);
+
ds_put_format(ds, "action%"PRId16, nl_attr_type(a));
- if (a->nla_len) {
+ if (len) {
const uint8_t *unspec;
unsigned int i;
unspec = nl_attr_get(a);
- for (i = 0; i < a->nla_len; i++) {
+ for (i = 0; i < len; i++) {
ds_put_char(ds, i ? ' ': '(');
ds_put_format(ds, "%02x", unspec[i]);
}
const uint8_t *eth;
ovs_be32 ip;
- if (nl_attr_get_size(a) != odp_action_len(a->nla_len)) {
- ds_put_format(ds, "***bad action: length is %zu, expected %d*** ",
- nl_attr_get_size(a), odp_action_len(a->nla_len));
+ 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;
}
ds_put_format(ds, "%"PRIu16, nl_attr_get_u32(a));
break;
case ODPAT_CONTROLLER:
- ds_put_format(ds, "ctl(%"PRIu32")", nl_attr_get_u32(a));
+ ds_put_format(ds, "ctl(%"PRIu64")", nl_attr_get_u64(a));
break;
case ODPAT_SET_TUNNEL:
- ds_put_format(ds, "set_tunnel(%#"PRIx32")",
- ntohl(nl_attr_get_be32(a)));
+ ds_put_format(ds, "set_tunnel(%#"PRIx64")",
+ ntohll(nl_attr_get_be64(a)));
break;
case ODPAT_SET_DL_TCI:
ds_put_format(ds, "set_tci(vid=%"PRIu16",pcp=%d)",
void
format_odp_actions(struct ds *ds, const struct nlattr *actions,
- unsigned int actions_len)
+ size_t actions_len)
{
if (actions_len) {
const struct nlattr *a;
ds_put_cstr(ds, ", actions:");
format_odp_actions(ds, f->actions, f->actions_len);
}
+
+void
+format_odp_port_type(struct ds *ds, const struct odp_port *p)
+{
+ if (!strcmp(p->type, "gre")
+ || !strcmp(p->type, "ipsec_gre")
+ || !strcmp(p->type, "capwap")) {
+ const struct tnl_port_config *config;
+
+ config = (struct tnl_port_config *)p->config;
+
+ ds_put_format(ds, " (%s: remote_ip="IP_FMT,
+ p->type, IP_ARGS(&config->daddr));
+
+ if (config->saddr) {
+ ds_put_format(ds, ", local_ip="IP_FMT, IP_ARGS(&config->saddr));
+ }
+
+ if (config->in_key) {
+ ds_put_format(ds, ", in_key=%#"PRIx64, ntohll(config->in_key));
+ }
+
+ ds_put_cstr(ds, ")");
+ } else if (!strcmp(p->type, "patch")) {
+ ds_put_format(ds, " (%s: peer=%s)", p->type, (char *)p->config);
+ } else if (strcmp(p->type, "system")) {
+ ds_put_format(ds, " (%s)", p->type);
+ }
+}
\f
void
odp_flow_key_from_flow(struct odp_flow_key *key, const struct flow *flow)