X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev-vport.c;h=41689596377ef29150465170a8170cccd77fc02e;hb=aabf5352bbf7e6fdc3d8da9f7f0b2e268da6ea68;hp=7fe169e3603913c0f000077705e71f669dbe0d08;hpb=79f1cbe9f86ddfb1b5d92b80d85e09cd44768d6c;p=openvswitch diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 7fe169e3..41689596 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -162,6 +162,14 @@ netdev_vport_get_netdev_type(const struct dpif_linux_vport *vport) return (nl_attr_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]) & TNL_F_IPSEC ? "ipsec_gre" : "gre"); + case OVS_VPORT_TYPE_GRE64: + if (tnl_port_config_from_nlattr(vport->options, vport->options_len, + a)) { + break; + } + return (nl_attr_get_u32(a[OVS_TUNNEL_ATTR_FLAGS]) & TNL_F_IPSEC + ? "ipsec_gre64" : "gre64"); + case OVS_VPORT_TYPE_CAPWAP: return "capwap"; @@ -582,10 +590,10 @@ parse_tunnel_config(const char *name, const char *type, ovs_be32 saddr = htonl(0); uint32_t flags; - flags = TNL_F_DF_DEFAULT | TNL_F_PMTUD | TNL_F_HDR_CACHE; - if (!strcmp(type, "gre")) { + flags = TNL_F_DF_DEFAULT | TNL_F_HDR_CACHE; + if (!strcmp(type, "gre") || !strcmp(type, "gre64")) { is_gre = true; - } else if (!strcmp(type, "ipsec_gre")) { + } else if (!strcmp(type, "ipsec_gre") || !strcmp(type, "ipsec_gre64")) { is_gre = true; is_ipsec = true; flags |= TNL_F_IPSEC; @@ -614,8 +622,10 @@ parse_tunnel_config(const char *name, const char *type, char *endptr; int tos; tos = strtol(node->value, &endptr, 0); - if (*endptr == '\0') { + if (*endptr == '\0' && tos == (tos & IP_DSCP_MASK)) { nl_msg_put_u8(options, OVS_TUNNEL_ATTR_TOS, tos); + } else { + VLOG_WARN("%s: invalid TOS %s", name, node->value); } } } else if (!strcmp(node->key, "ttl")) { @@ -637,8 +647,8 @@ parse_tunnel_config(const char *name, const char *type, flags &= ~TNL_F_DF_DEFAULT; } } else if (!strcmp(node->key, "pmtud")) { - if (!strcmp(node->value, "false")) { - flags &= ~TNL_F_PMTUD; + if (!strcmp(node->value, "true")) { + flags |= TNL_F_PMTUD; } } else if (!strcmp(node->key, "header_cache")) { if (!strcmp(node->value, "false")) { @@ -681,10 +691,14 @@ parse_tunnel_config(const char *name, const char *type, } if (is_ipsec) { - char *file_name = xasprintf("%s/%s", ovs_rundir(), - "ovs-monitor-ipsec.pid"); - pid_t pid = read_pidfile(file_name); - free(file_name); + static pid_t pid = 0; + if (pid <= 0) { + char *file_name = xasprintf("%s/%s", ovs_rundir(), + "ovs-monitor-ipsec.pid"); + pid = read_pidfile(file_name); + free(file_name); + } + if (pid < 0) { VLOG_ERR("%s: IPsec requires the ovs-monitor-ipsec daemon", name); @@ -808,10 +822,10 @@ unparse_tunnel_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, } if (flags & TNL_F_TTL_INHERIT) { - smap_add(args, "tos", "inherit"); + smap_add(args, "ttl", "inherit"); } else if (a[OVS_TUNNEL_ATTR_TTL]) { int ttl = nl_attr_get_u8(a[OVS_TUNNEL_ATTR_TTL]); - smap_add_format(args, "tos", "%d", ttl); + smap_add_format(args, "ttl", "%d", ttl); } if (flags & TNL_F_TOS_INHERIT) { @@ -830,8 +844,8 @@ unparse_tunnel_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, if (!(flags & TNL_F_DF_DEFAULT)) { smap_add(args, "df_default", "false"); } - if (!(flags & TNL_F_PMTUD)) { - smap_add(args, "pmtud", "false"); + if (flags & TNL_F_PMTUD) { + smap_add(args, "pmtud", "true"); } return 0; @@ -964,6 +978,14 @@ netdev_vport_register(void) { "ipsec_gre", VPORT_FUNCTIONS(netdev_vport_get_drv_info) }, parse_tunnel_config, unparse_tunnel_config }, + { OVS_VPORT_TYPE_GRE64, + { "gre64", VPORT_FUNCTIONS(netdev_vport_get_drv_info) }, + parse_tunnel_config, unparse_tunnel_config }, + + { OVS_VPORT_TYPE_GRE64, + { "ipsec_gre64", VPORT_FUNCTIONS(netdev_vport_get_drv_info) }, + parse_tunnel_config, unparse_tunnel_config }, + { OVS_VPORT_TYPE_CAPWAP, { "capwap", VPORT_FUNCTIONS(netdev_vport_get_drv_info) }, parse_tunnel_config, unparse_tunnel_config },