+ if (tnl_cfg->ip_dst) {
+ smap_add_format(args, "remote_ip", IP_FMT, IP_ARGS(tnl_cfg->ip_dst));
+ } else if (tnl_cfg->ip_dst_flow) {
+ smap_add(args, "remote_ip", "flow");
+ }
+
+ if (tnl_cfg->ip_src) {
+ smap_add_format(args, "local_ip", IP_FMT, IP_ARGS(tnl_cfg->ip_src));
+ } else if (tnl_cfg->ip_src_flow) {
+ smap_add(args, "local_ip", "flow");
+ }
+
+ if (tnl_cfg->in_key_flow && tnl_cfg->out_key_flow) {
+ smap_add(args, "key", "flow");
+ } else if (tnl_cfg->in_key_present && tnl_cfg->out_key_present
+ && tnl_cfg->in_key == tnl_cfg->out_key) {
+ smap_add_format(args, "key", "%"PRIu64, ntohll(tnl_cfg->in_key));
+ } else {
+ if (tnl_cfg->in_key_flow) {
+ smap_add(args, "in_key", "flow");
+ } else if (tnl_cfg->in_key_present) {
+ smap_add_format(args, "in_key", "%"PRIu64,
+ ntohll(tnl_cfg->in_key));
+ }
+
+ if (tnl_cfg->out_key_flow) {
+ smap_add(args, "out_key", "flow");
+ } else if (tnl_cfg->out_key_present) {
+ smap_add_format(args, "out_key", "%"PRIu64,
+ ntohll(tnl_cfg->out_key));
+ }
+ }
+
+ if (tnl_cfg->ttl_inherit) {
+ smap_add(args, "ttl", "inherit");
+ } else if (tnl_cfg->ttl != DEFAULT_TTL) {
+ smap_add_format(args, "ttl", "%"PRIu8, tnl_cfg->ttl);
+ }
+
+ if (tnl_cfg->tos_inherit) {
+ smap_add(args, "tos", "inherit");
+ } else if (tnl_cfg->tos) {
+ smap_add_format(args, "tos", "0x%x", tnl_cfg->tos);
+ }
+
+ if (tnl_cfg->dst_port) {
+ uint16_t dst_port = ntohs(tnl_cfg->dst_port);
+ const char *type = netdev_get_type(dev);
+
+ if ((!strcmp("vxlan", type) && dst_port != VXLAN_DST_PORT) ||
+ (!strcmp("lisp", type) && dst_port != LISP_DST_PORT)) {
+ smap_add_format(args, "dst_port", "%d", dst_port);
+ }