diff -Nru openvswitch-1.4.0/debian/changelog openvswitch-1.4.0/debian/changelog --- openvswitch-1.4.0/debian/changelog 2012-09-08 07:05:49.000000000 +0000 +++ openvswitch-1.4.0/debian/changelog 2013-02-06 09:46:14.000000000 +0000 @@ -1,3 +1,15 @@ +openvswitch (1.4.0-1ubuntu1.4) precise-proposed; urgency=low + + * Fix compatibility with 3.5 kernel (LP: #1116382): + - d/p/000*.patch: Cherry picked fixes from upstream VCS for kernel 3.5 + support, including removing the _mod suffix from DKMS built modules. + - d/dkms.conf.in,rule.modules: Drop _mod suffix from built modules. + * Ensure DKMS modules are automatically re-built with kernel upgrades + (LP: #962189): + - d/dkms.conf.in: Use AUTOINSTALL=yes. + + -- James Page Wed, 06 Feb 2013 09:41:27 +0000 + openvswitch (1.4.0-1ubuntu1.3) precise-proposed; urgency=low * debian/patches/lp1044318-Reset-upper-layer-protocol-info.patch: Cherry diff -Nru openvswitch-1.4.0/debian/dkms.conf.in openvswitch-1.4.0/debian/dkms.conf.in --- openvswitch-1.4.0/debian/dkms.conf.in 2012-09-08 07:05:49.000000000 +0000 +++ openvswitch-1.4.0/debian/dkms.conf.in 2013-02-06 09:07:07.000000000 +0000 @@ -1,9 +1,10 @@ PACKAGE_NAME="openvswitch" PACKAGE_VERSION="__VERSION__" -MAKE="./configure --with-linux=/usr/src/linux-headers-`uname -r` ; make -C datapath/linux" -BUILT_MODULE_NAME[0]=openvswitch_mod -BUILT_MODULE_NAME[1]=brcompat_mod +MAKE="./configure --with-linux='${kernel_source_dir}' && make -C datapath/linux" +BUILT_MODULE_NAME[0]=openvswitch +BUILT_MODULE_NAME[1]=brcompat BUILT_MODULE_LOCATION[0]=datapath/linux/ BUILT_MODULE_LOCATION[1]=datapath/linux/ DEST_MODULE_LOCATION[0]=/kernel/drivers/net/openvswitch/ DEST_MODULE_LOCATION[1]=/kernel/drivers/net/openvswitch/ +AUTOINSTALL=yes diff -Nru openvswitch-1.4.0/debian/patches/0001-datapath-Remove-custom-version-of-ipv6_skip_exthdr.patch openvswitch-1.4.0/debian/patches/0001-datapath-Remove-custom-version-of-ipv6_skip_exthdr.patch --- openvswitch-1.4.0/debian/patches/0001-datapath-Remove-custom-version-of-ipv6_skip_exthdr.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0001-datapath-Remove-custom-version-of-ipv6_skip_exthdr.patch 2013-02-06 09:22:34.000000000 +0000 @@ -0,0 +1,254 @@ +From 7308fe04b4c7a17186731e1eda490e82a7590f1c Mon Sep 17 00:00:00 2001 +From: Jesse Gross +Date: Thu, 1 Dec 2011 16:09:05 -0800 +Subject: [PATCH 1/8] datapath: Remove custom version of ipv6_skip_exthdr(). + +We currently have a version of ipv6_skip_exthdr() which is +identical to the main one with the addition of fragment reporting. +We can propose our version for upstream and then use it directly +without duplication. + +Signed-off-by: Jesse Gross +Acked-by: Ben Pfaff +--- + datapath/flow.c | 70 ++++------------------------ + datapath/linux/Modules.mk | 1 + + datapath/linux/compat/exthdrs_core.c | 48 +++++++++++++++++++ + datapath/linux/compat/include/linux/ipv6.h | 8 ++++ + datapath/tunnel.c | 3 +- + lib/flow.c | 13 ++++-- + 6 files changed, 76 insertions(+), 67 deletions(-) + create mode 100644 datapath/linux/compat/exthdrs_core.c + +--- a/datapath/flow.c ++++ b/datapath/flow.c +@@ -128,66 +128,6 @@ u64 ovs_flow_used_time(unsigned long flo + (offsetof(struct sw_flow_key, field) + \ + FIELD_SIZEOF(struct sw_flow_key, field)) + +-/** +- * skip_exthdr - skip any IPv6 extension headers +- * @skb: skbuff to parse +- * @start: offset of first extension header +- * @nexthdrp: Initially, points to the type of the extension header at @start. +- * This function updates it to point to the extension header at the final +- * offset. +- * @frag: Points to the @frag member in a &struct sw_flow_key. This +- * function sets an appropriate %OVS_FRAG_TYPE_* value. +- * +- * This is based on ipv6_skip_exthdr() but adds the updates to *@frag. +- * +- * When there is more than one fragment header, this version reports whether +- * the final fragment header that it examines is a first fragment. +- * +- * Returns the final payload offset, or -1 on error. +- */ +-static int skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp, +- u8 *frag) +-{ +- u8 nexthdr = *nexthdrp; +- +- while (ipv6_ext_hdr(nexthdr)) { +- struct ipv6_opt_hdr _hdr, *hp; +- int hdrlen; +- +- if (nexthdr == NEXTHDR_NONE) +- return -1; +- hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr); +- if (hp == NULL) +- return -1; +- if (nexthdr == NEXTHDR_FRAGMENT) { +- __be16 _frag_off, *fp; +- fp = skb_header_pointer(skb, +- start+offsetof(struct frag_hdr, +- frag_off), +- sizeof(_frag_off), +- &_frag_off); +- if (fp == NULL) +- return -1; +- +- if (ntohs(*fp) & ~0x7) { +- *frag = OVS_FRAG_TYPE_LATER; +- break; +- } +- *frag = OVS_FRAG_TYPE_FIRST; +- hdrlen = 8; +- } else if (nexthdr == NEXTHDR_AUTH) +- hdrlen = (hp->hdrlen+2)<<2; +- else +- hdrlen = ipv6_optlen(hp); +- +- nexthdr = hp->nexthdr; +- start += hdrlen; +- } +- +- *nexthdrp = nexthdr; +- return start; +-} +- + static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key, + int *key_lenp) + { +@@ -196,6 +136,7 @@ static int parse_ipv6hdr(struct sk_buff + int payload_ofs; + struct ipv6hdr *nh; + uint8_t nexthdr; ++ __be16 frag_off; + int err; + + *key_lenp = SW_FLOW_KEY_OFFSET(ipv6.label); +@@ -215,10 +156,17 @@ static int parse_ipv6hdr(struct sk_buff + key->ipv6.addr.src = nh->saddr; + key->ipv6.addr.dst = nh->daddr; + +- payload_ofs = skip_exthdr(skb, payload_ofs, &nexthdr, &key->ip.frag); ++ payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off); + if (unlikely(payload_ofs < 0)) + return -EINVAL; + ++ if (frag_off) { ++ if (frag_off & htons(~0x7)) ++ key->ip.frag = OVS_FRAG_TYPE_LATER; ++ else ++ key->ip.frag = OVS_FRAG_TYPE_FIRST; ++ } ++ + nh_len = payload_ofs - nh_ofs; + skb_set_transport_header(skb, nh_ofs + nh_len); + key->ip.proto = nexthdr; +--- a/datapath/linux/Modules.mk ++++ b/datapath/linux/Modules.mk +@@ -1,6 +1,7 @@ + openvswitch_sources += \ + linux/compat/addrconf_core-openvswitch.c \ + linux/compat/dev-openvswitch.c \ ++ linux/compat/exthdrs_core.c \ + linux/compat/flex_array.c \ + linux/compat/genetlink-openvswitch.c \ + linux/compat/ip_output-openvswitch.c \ +--- /dev/null ++++ b/datapath/linux/compat/exthdrs_core.c +@@ -0,0 +1,48 @@ ++#include ++#include ++ ++/* This function is upstream but not the version which supplies the ++ * fragment offset. We plan to propose the extended version. ++ */ ++int rpl_ipv6_skip_exthdr(const struct sk_buff *skb, int start, ++ u8 *nexthdrp, __be16 *frag_offp) ++{ ++ u8 nexthdr = *nexthdrp; ++ ++ *frag_offp = 0; ++ ++ while (ipv6_ext_hdr(nexthdr)) { ++ struct ipv6_opt_hdr _hdr, *hp; ++ int hdrlen; ++ ++ if (nexthdr == NEXTHDR_NONE) ++ return -1; ++ hp = skb_header_pointer(skb, start, sizeof(_hdr), &_hdr); ++ if (hp == NULL) ++ return -1; ++ if (nexthdr == NEXTHDR_FRAGMENT) { ++ __be16 _frag_off, *fp; ++ fp = skb_header_pointer(skb, ++ start+offsetof(struct frag_hdr, ++ frag_off), ++ sizeof(_frag_off), ++ &_frag_off); ++ if (fp == NULL) ++ return -1; ++ ++ *frag_offp = *fp; ++ if (ntohs(*frag_offp) & ~0x7) ++ break; ++ hdrlen = 8; ++ } else if (nexthdr == NEXTHDR_AUTH) ++ hdrlen = (hp->hdrlen+2)<<2; ++ else ++ hdrlen = ipv6_optlen(hp); ++ ++ nexthdr = hp->nexthdr; ++ start += hdrlen; ++ } ++ ++ *nexthdrp = nexthdr; ++ return start; ++} +--- a/datapath/linux/compat/include/linux/ipv6.h ++++ b/datapath/linux/compat/include/linux/ipv6.h +@@ -2,6 +2,7 @@ + #define __LINUX_IPV6_WRAPPER_H 1 + + #include_next ++#include + + #ifndef HAVE_SKBUFF_HEADER_HELPERS + static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) +@@ -10,4 +11,11 @@ static inline struct ipv6hdr *ipv6_hdr(c + } + #endif + ++/* This function is upstream but not the version which supplies the ++ * fragment offset. We plan to propose the extended version. ++ */ ++#define ipv6_skip_exthdr rpl_ipv6_skip_exthdr ++extern int rpl_ipv6_skip_exthdr(const struct sk_buff *skb, int start, ++ u8 *nexthdrp, __be16 *frag_offp); ++ + #endif +--- a/datapath/tunnel.c ++++ b/datapath/tunnel.c +@@ -538,6 +538,7 @@ static bool ipv6_should_icmp(struct sk_b + int addr_type; + int payload_off = (u8 *)(old_ipv6h + 1) - skb->data; + u8 nexthdr = ipv6_hdr(skb)->nexthdr; ++ __be16 frag_off; + + /* Check source address is valid. */ + addr_type = ipv6_addr_type(&old_ipv6h->saddr); +@@ -549,7 +550,7 @@ static bool ipv6_should_icmp(struct sk_b + return false; + + /* Don't respond to ICMP error messages. */ +- payload_off = ipv6_skip_exthdr(skb, payload_off, &nexthdr); ++ payload_off = ipv6_skip_exthdr(skb, payload_off, &nexthdr, &frag_off); + if (payload_off < 0) + return false; + +--- a/lib/flow.c ++++ b/lib/flow.c +@@ -203,11 +203,14 @@ parse_ipv6(struct ofpbuf *packet, struct + } + + /* We only process the first fragment. */ +- flow->nw_frag = FLOW_NW_FRAG_ANY; +- if ((frag_hdr->ip6f_offlg & IP6F_OFF_MASK) != htons(0)) { +- flow->nw_frag |= FLOW_NW_FRAG_LATER; +- nexthdr = IPPROTO_FRAGMENT; +- break; ++ if (frag_hdr->ip6f_offlg != htons(0)) { ++ if ((frag_hdr->ip6f_offlg & IP6F_OFF_MASK) == htons(0)) { ++ flow->nw_frag = FLOW_NW_FRAG_ANY; ++ } else { ++ flow->nw_frag |= FLOW_NW_FRAG_LATER; ++ nexthdr = IPPROTO_FRAGMENT; ++ break; ++ } + } + } + } +--- a/datapath/Makefile.in ++++ b/datapath/Makefile.in +@@ -217,7 +217,8 @@ openvswitch_sources = actions.c checksum + vport-capwap.c vport-generic.c vport-gre.c \ + vport-internal_dev.c vport-netdev.c vport-patch.c \ + linux/compat/addrconf_core-openvswitch.c \ +- linux/compat/dev-openvswitch.c linux/compat/flex_array.c \ ++ linux/compat/dev-openvswitch.c \ ++ linux/compat/exthdrs_core.c linux/compat/flex_array.c \ + linux/compat/genetlink-openvswitch.c \ + linux/compat/ip_output-openvswitch.c linux/compat/kmemdup.c \ + linux/compat/netdevice.c linux/compat/reciprocal_div.c \ diff -Nru openvswitch-1.4.0/debian/patches/0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch openvswitch-1.4.0/debian/patches/0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch --- openvswitch-1.4.0/debian/patches/0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch 2013-02-06 09:02:32.000000000 +0000 @@ -0,0 +1,29 @@ +From cc8629615390dda688444b3d5d303d2d2f8402bc Mon Sep 17 00:00:00 2001 +From: Simon Horman +Date: Thu, 19 Apr 2012 16:38:39 +0900 +Subject: [PATCH 2/8] datapath: Use ETH_ALEN instead of VLAN_ETH_ALEN + +VLAN_ETH_ALEN will be removed in version 3.5 of the Linux kernel. + +Signed-off-by: Simon Horman +Signed-off-by: Jesse Gross +--- + datapath/linux/compat/include/linux/if_vlan.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h +index 326abb2..492e497 100644 +--- a/datapath/linux/compat/include/linux/if_vlan.h ++++ b/datapath/linux/compat/include/linux/if_vlan.h +@@ -30,7 +30,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) + veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); + + /* Move the mac addresses to the beginning of the new header. */ +- memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); ++ memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); + skb->mac_header -= VLAN_HLEN; + + /* first, the ethernet type */ +-- +1.7.10.4 + diff -Nru openvswitch-1.4.0/debian/patches/0003-datapath-Stop-using-NLA_PUT.patch openvswitch-1.4.0/debian/patches/0003-datapath-Stop-using-NLA_PUT.patch --- openvswitch-1.4.0/debian/patches/0003-datapath-Stop-using-NLA_PUT.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0003-datapath-Stop-using-NLA_PUT.patch 2013-02-06 09:02:55.000000000 +0000 @@ -0,0 +1,243 @@ +From 600f2152ef8e34e489b2668c9a1b470e2123ad2d Mon Sep 17 00:00:00 2001 +From: "David S. Miller" +Date: Mon, 2 Apr 2012 13:25:21 -0700 +Subject: [PATCH 3/8] datapath: Stop using NLA_PUT*(). + +These macros contain a hidden goto, and are thus extremely error +prone and make code hard to audit. + +Signed-off-by: David S. Miller +[jesse: Additional transformations for code not upstream.] +Signed-off-by: Jesse Gross + +Conflicts: + datapath/flow.c +--- + datapath/brcompat.c | 18 +++++++++------- + datapath/datapath.c | 57 +++++++++++++++++++++++++++++---------------------- + datapath/flow.c | 23 +++++++++++++-------- + datapath/tunnel.c | 31 ++++++++++++++++------------ + 4 files changed, 75 insertions(+), 54 deletions(-) + +--- a/datapath/brcompat.c ++++ b/datapath/brcompat.c +@@ -62,10 +62,12 @@ static struct sk_buff *brc_make_request( + goto error; + + genlmsg_put(skb, 0, 0, &brc_genl_family, 0, op); +- if (bridge) +- NLA_PUT_STRING(skb, BRC_GENL_A_DP_NAME, bridge); +- if (port) +- NLA_PUT_STRING(skb, BRC_GENL_A_PORT_NAME, port); ++ ++ if (bridge && nla_put_string(skb, BRC_GENL_A_DP_NAME, bridge)) ++ goto nla_put_failure; ++ if (port && nla_put_string(skb, BRC_GENL_A_PORT_NAME, port)) ++ goto nla_put_failure; ++ + return skb; + + nla_put_failure: +@@ -284,8 +286,9 @@ static int brc_get_fdb_entries(struct ne + request = brc_make_request(BRC_GENL_C_FDB_QUERY, dev->name, NULL); + if (!request) + return -ENOMEM; +- NLA_PUT_U64(request, BRC_GENL_A_FDB_COUNT, maxnum); +- NLA_PUT_U64(request, BRC_GENL_A_FDB_SKIP, offset); ++ if (nla_put_u64(request, BRC_GENL_A_FDB_COUNT, maxnum) || ++ nla_put_u64(request, BRC_GENL_A_FDB_SKIP, offset)) ++ goto nla_put_failure; + + rtnl_unlock(); + reply = brc_send_command(request, attrs); +@@ -396,7 +399,8 @@ static int brc_genl_query(struct sk_buff + err = -ENOMEM; + goto err; + } +- NLA_PUT_U32(ans_skb, BRC_GENL_A_MC_GROUP, brc_mc_group.id); ++ if (nla_put_u32(ans_skb, BRC_GENL_A_MC_GROUP, brc_mc_group.id)) ++ goto nla_put_failure; + + genlmsg_end(ans_skb, data); + return genlmsg_reply(ans_skb, info); +--- a/datapath/datapath.c ++++ b/datapath/datapath.c +@@ -171,17 +171,17 @@ static int dp_fill_ifinfo(struct sk_buff + hdr->ifi_flags = port->ops->get_dev_flags(port); + hdr->ifi_change = 0; + +- NLA_PUT_STRING(skb, IFLA_IFNAME, port->ops->get_name(port)); +- NLA_PUT_U32(skb, IFLA_MASTER, get_dpifindex(dp)); +- NLA_PUT_U32(skb, IFLA_MTU, port->ops->get_mtu(port)); ++ if (nla_put_string(skb, IFLA_IFNAME, port->ops->get_name(port)) || ++ nla_put_u32(skb, IFLA_MASTER, get_dpifindex(dp)) || ++ nla_put_u32(skb, IFLA_MTU, port->ops->get_mtu(port)) || + #ifdef IFLA_OPERSTATE +- NLA_PUT_U8(skb, IFLA_OPERSTATE, +- port->ops->is_running(port) +- ? port->ops->get_operstate(port) +- : IF_OPER_DOWN); ++ nla_put_u8(skb, IFLA_OPERSTATE, ++ port->ops->is_running(port) ? ++ port->ops->get_operstate(port) : ++ IF_OPER_DOWN) || + #endif +- +- NLA_PUT(skb, IFLA_ADDRESS, ETH_ALEN, port->ops->get_addr(port)); ++ nla_put(skb, IFLA_ADDRESS, ETH_ALEN, port->ops->get_addr(port))) ++ goto nla_put_failure; + + return nlmsg_end(skb, nlh); + +@@ -894,15 +894,18 @@ static int ovs_flow_cmd_fill_info(struct + tcp_flags = flow->tcp_flags; + spin_unlock_bh(&flow->lock); + +- if (used) +- NLA_PUT_U64(skb, OVS_FLOW_ATTR_USED, ovs_flow_used_time(used)); ++ if (used && ++ nla_put_u64(skb, OVS_FLOW_ATTR_USED, ovs_flow_used_time(used))) ++ goto nla_put_failure; + +- if (stats.n_packets) +- NLA_PUT(skb, OVS_FLOW_ATTR_STATS, +- sizeof(struct ovs_flow_stats), &stats); ++ if (stats.n_packets && ++ nla_put(skb, OVS_FLOW_ATTR_STATS, ++ sizeof(struct ovs_flow_stats), &stats)) ++ goto nla_put_failure; + +- if (tcp_flags) +- NLA_PUT_U8(skb, OVS_FLOW_ATTR_TCP_FLAGS, tcp_flags); ++ if (tcp_flags && ++ nla_put_u8(skb, OVS_FLOW_ATTR_TCP_FLAGS, tcp_flags)) ++ goto nla_put_failure; + + /* If OVS_FLOW_ATTR_ACTIONS doesn't fit, skip dumping the actions if + * this is the first flow to be dumped into 'skb'. This is unusual for +@@ -1287,7 +1290,8 @@ static int ovs_dp_cmd_fill_info(struct d + goto nla_put_failure; + + get_dp_stats(dp, &dp_stats); +- NLA_PUT(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats), &dp_stats); ++ if (nla_put(skb, OVS_DP_ATTR_STATS, sizeof(struct ovs_dp_stats), &dp_stats)) ++ goto nla_put_failure; + + return genlmsg_end(skb, ovs_header); + +@@ -1624,17 +1628,20 @@ static int ovs_vport_cmd_fill_info(struc + + ovs_header->dp_ifindex = get_dpifindex(vport->dp); + +- NLA_PUT_U32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no); +- NLA_PUT_U32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type); +- NLA_PUT_STRING(skb, OVS_VPORT_ATTR_NAME, vport->ops->get_name(vport)); +- NLA_PUT_U32(skb, OVS_VPORT_ATTR_UPCALL_PID, vport->upcall_pid); ++ if (nla_put_u32(skb, OVS_VPORT_ATTR_PORT_NO, vport->port_no) || ++ nla_put_u32(skb, OVS_VPORT_ATTR_TYPE, vport->ops->type) || ++ nla_put_string(skb, OVS_VPORT_ATTR_NAME, vport->ops->get_name(vport)) || ++ nla_put_u32(skb, OVS_VPORT_ATTR_UPCALL_PID, vport->upcall_pid)) ++ goto nla_put_failure; + + ovs_vport_get_stats(vport, &vport_stats); +- NLA_PUT(skb, OVS_VPORT_ATTR_STATS, sizeof(struct ovs_vport_stats), +- &vport_stats); ++ if (nla_put(skb, OVS_VPORT_ATTR_STATS, sizeof(struct ovs_vport_stats), ++ &vport_stats)) ++ goto nla_put_failure; + +- NLA_PUT(skb, OVS_VPORT_ATTR_ADDRESS, ETH_ALEN, +- vport->ops->get_addr(vport)); ++ if (nla_put(skb, OVS_VPORT_ATTR_ADDRESS, ETH_ALEN, ++ vport->ops->get_addr(vport))) ++ goto nla_put_failure; + + err = ovs_vport_get_options(vport, skb); + if (err == -EMSGSIZE) +--- a/datapath/flow.c ++++ b/datapath/flow.c +@@ -1181,14 +1181,17 @@ int ovs_flow_to_nlattrs(const struct sw_ + struct ovs_key_ethernet *eth_key; + struct nlattr *nla, *encap; + +- if (swkey->phy.priority) +- NLA_PUT_U32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority); ++ if (swkey->phy.priority && ++ nla_put_u32(skb, OVS_KEY_ATTR_PRIORITY, swkey->phy.priority)) ++ goto nla_put_failure; + +- if (swkey->phy.tun_id != cpu_to_be64(0)) +- NLA_PUT_BE64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun_id); ++ if (swkey->phy.tun_id != cpu_to_be64(0) && ++ nla_put_be64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun_id)) ++ goto nla_put_failure; + +- if (swkey->phy.in_port != USHRT_MAX) +- NLA_PUT_U32(skb, OVS_KEY_ATTR_IN_PORT, swkey->phy.in_port); ++ if (swkey->phy.in_port != DP_MAX_PORTS && ++ nla_put_u32(skb, OVS_KEY_ATTR_IN_PORT, swkey->phy.in_port)) ++ goto nla_put_failure; + + nla = nla_reserve(skb, OVS_KEY_ATTR_ETHERNET, sizeof(*eth_key)); + if (!nla) +@@ -1198,8 +1201,9 @@ int ovs_flow_to_nlattrs(const struct sw_ + memcpy(eth_key->eth_dst, swkey->eth.dst, ETH_ALEN); + + if (swkey->eth.tci || swkey->eth.type == htons(ETH_P_8021Q)) { +- NLA_PUT_BE16(skb, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_P_8021Q)); +- NLA_PUT_BE16(skb, OVS_KEY_ATTR_VLAN, swkey->eth.tci); ++ if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, htons(ETH_P_8021Q)) || ++ nla_put_be16(skb, OVS_KEY_ATTR_VLAN, swkey->eth.tci)) ++ goto nla_put_failure; + encap = nla_nest_start(skb, OVS_KEY_ATTR_ENCAP); + if (!swkey->eth.tci) + goto unencap; +@@ -1210,7 +1214,8 @@ int ovs_flow_to_nlattrs(const struct sw_ + if (swkey->eth.type == htons(ETH_P_802_2)) + goto unencap; + +- NLA_PUT_BE16(skb, OVS_KEY_ATTR_ETHERTYPE, swkey->eth.type); ++ if (nla_put_be16(skb, OVS_KEY_ATTR_ETHERTYPE, swkey->eth.type)) ++ goto nla_put_failure; + + if (swkey->eth.type == htons(ETH_P_IP)) { + struct ovs_key_ipv4 *ipv4_key; +--- a/datapath/tunnel.c ++++ b/datapath/tunnel.c +@@ -1539,19 +1539,24 @@ int ovs_tnl_get_options(const struct vpo + const struct tnl_vport *tnl_vport = tnl_vport_priv(vport); + const struct tnl_mutable_config *mutable = rcu_dereference_rtnl(tnl_vport->mutable); + +- NLA_PUT_U32(skb, OVS_TUNNEL_ATTR_FLAGS, mutable->flags & TNL_F_PUBLIC); +- NLA_PUT_BE32(skb, OVS_TUNNEL_ATTR_DST_IPV4, mutable->key.daddr); ++ if (nla_put_u32(skb, OVS_TUNNEL_ATTR_FLAGS, ++ mutable->flags & TNL_F_PUBLIC) || ++ nla_put_be32(skb, OVS_TUNNEL_ATTR_DST_IPV4, mutable->key.daddr)) ++ goto nla_put_failure; + +- if (!(mutable->flags & TNL_F_IN_KEY_MATCH)) +- NLA_PUT_BE64(skb, OVS_TUNNEL_ATTR_IN_KEY, mutable->key.in_key); +- if (!(mutable->flags & TNL_F_OUT_KEY_ACTION)) +- NLA_PUT_BE64(skb, OVS_TUNNEL_ATTR_OUT_KEY, mutable->out_key); +- if (mutable->key.saddr) +- NLA_PUT_BE32(skb, OVS_TUNNEL_ATTR_SRC_IPV4, mutable->key.saddr); +- if (mutable->tos) +- NLA_PUT_U8(skb, OVS_TUNNEL_ATTR_TOS, mutable->tos); +- if (mutable->ttl) +- NLA_PUT_U8(skb, OVS_TUNNEL_ATTR_TTL, mutable->ttl); ++ if (!(mutable->flags & TNL_F_IN_KEY_MATCH) && ++ nla_put_be64(skb, OVS_TUNNEL_ATTR_IN_KEY, mutable->key.in_key)) ++ goto nla_put_failure; ++ if (!(mutable->flags & TNL_F_OUT_KEY_ACTION) && ++ nla_put_be64(skb, OVS_TUNNEL_ATTR_OUT_KEY, mutable->out_key)) ++ goto nla_put_failure; ++ if (mutable->key.saddr && ++ nla_put_be32(skb, OVS_TUNNEL_ATTR_SRC_IPV4, mutable->key.saddr)) ++ goto nla_put_failure; ++ if (mutable->tos && nla_put_u8(skb, OVS_TUNNEL_ATTR_TOS, mutable->tos)) ++ goto nla_put_failure; ++ if (mutable->ttl && nla_put_u8(skb, OVS_TUNNEL_ATTR_TTL, mutable->ttl)) ++ goto nla_put_failure; + + return 0; + diff -Nru openvswitch-1.4.0/debian/patches/0004-datapath-Backport-nla_put_be-functions.patch openvswitch-1.4.0/debian/patches/0004-datapath-Backport-nla_put_be-functions.patch --- openvswitch-1.4.0/debian/patches/0004-datapath-Backport-nla_put_be-functions.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0004-datapath-Backport-nla_put_be-functions.patch 2013-02-06 09:02:32.000000000 +0000 @@ -0,0 +1,65 @@ +From 86edd687ebecedcc5610234ff25514bd1def2e74 Mon Sep 17 00:00:00 2001 +From: Jesse Gross +Date: Mon, 2 Apr 2012 13:41:20 -0700 +Subject: [PATCH 4/8] datapath: Backport nla_put_be* functions. + +Linux 3.5 replaces the NLA_PUT_* functions with non-macro version, +which required adding the endian-typed versions. This backports +those functions and drops the macro backports. + +Signed-off-by: Jesse Gross +--- + datapath/linux/compat/include/net/netlink.h | 30 +++++++++++++-------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h +index 8bd6baa..14041e2 100644 +--- a/datapath/linux/compat/include/net/netlink.h ++++ b/datapath/linux/compat/include/net/netlink.h +@@ -29,21 +29,6 @@ + #define NLA_NESTED NLA_UNSPEC + #endif + +-#ifndef NLA_PUT_BE16 +-#define NLA_PUT_BE16(skb, attrtype, value) \ +- NLA_PUT_TYPE(skb, __be16, attrtype, value) +-#endif /* !NLA_PUT_BE16 */ +- +-#ifndef NLA_PUT_BE32 +-#define NLA_PUT_BE32(skb, attrtype, value) \ +- NLA_PUT_TYPE(skb, __be32, attrtype, value) +-#endif /* !NLA_PUT_BE32 */ +- +-#ifndef NLA_PUT_BE64 +-#define NLA_PUT_BE64(skb, attrtype, value) \ +- NLA_PUT_TYPE(skb, __be64, attrtype, value) +-#endif /* !NLA_PUT_BE64 */ +- + #ifndef HAVE_NLA_GET_BE16 + /** + * nla_get_be16 - return payload of __be16 attribute +@@ -100,6 +85,21 @@ static inline __be64 nla_get_be64(const struct nlattr *nla) + } + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,5,0) ++static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value) ++{ ++ return nla_put(skb, attrtype, sizeof(__be16), &value); ++} ++static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value) ++{ ++ return nla_put(skb, attrtype, sizeof(__be32), &value); ++} ++static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value) ++{ ++ return nla_put(skb, attrtype, sizeof(__be64), &value); ++} ++#endif ++ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) + /** + * nla_type - attribute type +-- +1.7.10.4 + diff -Nru openvswitch-1.4.0/debian/patches/0005-datapath-Support-for-kernel-3.3.patch openvswitch-1.4.0/debian/patches/0005-datapath-Support-for-kernel-3.3.patch --- openvswitch-1.4.0/debian/patches/0005-datapath-Support-for-kernel-3.3.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0005-datapath-Support-for-kernel-3.3.patch 2013-02-06 09:02:32.000000000 +0000 @@ -0,0 +1,127 @@ +From b0142878ddeb1e932dc62667b681ebfdbb27a47a Mon Sep 17 00:00:00 2001 +From: Pravin B Shelar +Date: Fri, 23 Mar 2012 10:50:08 -0700 +Subject: [PATCH 5/8] datapath: Support for kernel 3.3 + +Signed-off-by: Pravin B Shelar +Acked-by: Jesse Gross + +Conflicts: + datapath/linux/compat/include/linux/etherdevice.h +--- + datapath/datapath.c | 4 ++-- + datapath/linux/compat/include/linux/genetlink.h | 6 +++--- + datapath/linux/compat/include/linux/if_vlan.h | 7 ++++--- + datapath/linux/compat/include/net/dst.h | 8 ++++++++ + datapath/tunnel.c | 2 +- + 5 files changed, 18 insertions(+), 9 deletions(-) + +diff --git a/datapath/datapath.c b/datapath/datapath.c +index 2d7b8bb..38bb10a 100644 +--- a/datapath/datapath.c ++++ b/datapath/datapath.c +@@ -59,8 +59,8 @@ + #include "vport-internal_dev.h" + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \ +- LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0) +-#error Kernels before 2.6.18 or after 3.2 are not supported by this version of Open vSwitch. ++ LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) ++#error Kernels before 2.6.18 or after 3.3 are not supported by this version of Open vSwitch. + #endif + + int (*ovs_dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd); +diff --git a/datapath/linux/compat/include/linux/genetlink.h b/datapath/linux/compat/include/linux/genetlink.h +index f7b96d9..8b894be 100644 +--- a/datapath/linux/compat/include/linux/genetlink.h ++++ b/datapath/linux/compat/include/linux/genetlink.h +@@ -1,18 +1,18 @@ + #ifndef __GENETLINK_WRAPPER_H + #define __GENETLINK_WRAPPER_H 1 + ++#include + #include_next + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) + #ifdef CONFIG_PROVE_LOCKING +-/* No version of the kernel has this function, but our locking scheme depends +- * on genl_mutex so for clarity we use it where appropriate. */ + static inline int lockdep_genl_is_held(void) + { + return 1; + } + #endif ++#endif + +-/* This is also not upstream yet. */ + #ifndef genl_dereference + #include + +diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h +index 492e497..dc4b15e 100644 +--- a/datapath/linux/compat/include/linux/if_vlan.h ++++ b/datapath/linux/compat/include/linux/if_vlan.h +@@ -1,8 +1,9 @@ + #ifndef __LINUX_IF_VLAN_WRAPPER_H + #define __LINUX_IF_VLAN_WRAPPER_H 1 + +-#include_next + #include ++#include ++#include_next + + /* + * The behavior of __vlan_put_tag() has changed over time: +@@ -54,8 +55,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) + #define VLAN_TAG_PRESENT VLAN_CFI_MASK + #endif + +-/* This function is not exported from kernel. OVS Upstreaming patch will +- * fix that. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) + static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr) + { + __be16 proto; +@@ -88,4 +88,5 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vh + */ + skb->protocol = htons(ETH_P_802_2); + } ++#endif + #endif /* linux/if_vlan.h wrapper */ +diff --git a/datapath/linux/compat/include/net/dst.h b/datapath/linux/compat/include/net/dst.h +index f481a9d..9d9e616 100644 +--- a/datapath/linux/compat/include/net/dst.h ++++ b/datapath/linux/compat/include/net/dst.h +@@ -1,8 +1,16 @@ + #ifndef __NET_DST_WRAPPER_H + #define __NET_DST_WRAPPER_H 1 + ++#include + #include_next + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) && \ ++ LINUX_VERSION_CODE > KERNEL_VERSION(3,0,20) ++ ++#define dst_get_neighbour_noref dst_get_neighbour ++ ++#endif ++ + #ifndef HAVE_SKB_DST_ACCESSOR_FUNCS + + static inline void skb_dst_drop(struct sk_buff *skb) +diff --git a/datapath/tunnel.c b/datapath/tunnel.c +index a6bfbda..872dc56 100644 +--- a/datapath/tunnel.c ++++ b/datapath/tunnel.c +@@ -109,7 +109,7 @@ static unsigned int multicast_ports __read_mostly; + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0) + static struct hh_cache *rt_hh(struct rtable *rt) + { +- struct neighbour *neigh = dst_get_neighbour(&rt->dst); ++ struct neighbour *neigh = dst_get_neighbour_noref(&rt->dst); + if (!neigh || !(neigh->nud_state & NUD_CONNECTED) || + !neigh->hh.hh_len) + return NULL; +-- +1.7.10.4 + diff -Nru openvswitch-1.4.0/debian/patches/0006-Bump-up-the-supported-kernel-versions-to-include-3.5.patch openvswitch-1.4.0/debian/patches/0006-Bump-up-the-supported-kernel-versions-to-include-3.5.patch --- openvswitch-1.4.0/debian/patches/0006-Bump-up-the-supported-kernel-versions-to-include-3.5.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0006-Bump-up-the-supported-kernel-versions-to-include-3.5.patch 2013-02-06 09:02:32.000000000 +0000 @@ -0,0 +1,32 @@ +From 4dbf00dfdb9b6ef2870b736192458c85d086230c Mon Sep 17 00:00:00 2001 +From: Kyle Mestery +Date: Tue, 7 Aug 2012 18:48:21 -0400 +Subject: [PATCH 6/8] Bump up the supported kernel versions to include 3.5.x. + +Signed-off-by: Kyle Mestery +Signed-off-by: Jesse Gross + +Conflicts: + datapath/datapath.c +--- + datapath/datapath.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/datapath/datapath.c b/datapath/datapath.c +index 38bb10a..9864ce6 100644 +--- a/datapath/datapath.c ++++ b/datapath/datapath.c +@@ -59,8 +59,8 @@ + #include "vport-internal_dev.h" + + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) || \ +- LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0) +-#error Kernels before 2.6.18 or after 3.3 are not supported by this version of Open vSwitch. ++ LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0) ++#error Kernels before 2.6.18 or after 3.5 are not supported by this version of Open vSwitch. + #endif + + int (*ovs_dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd); +-- +1.7.10.4 + diff -Nru openvswitch-1.4.0/debian/patches/0007-datapath-Remove-all-inclusions-of-asm-system.h.patch openvswitch-1.4.0/debian/patches/0007-datapath-Remove-all-inclusions-of-asm-system.h.patch --- openvswitch-1.4.0/debian/patches/0007-datapath-Remove-all-inclusions-of-asm-system.h.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0007-datapath-Remove-all-inclusions-of-asm-system.h.patch 2013-02-06 09:02:32.000000000 +0000 @@ -0,0 +1,31 @@ +From 76a11cd7d0e00b023f459a64015141e8d8182442 Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Fri, 25 May 2012 11:05:32 -0700 +Subject: [PATCH 7/8] datapath: Remove all #inclusions of asm/system.h + +Remove all #inclusions of asm/system.h preparatory to splitting and killing +it. Performed with the following command: + +perl -p -i -e 's!^#\s*include\s*.*\n!!' `grep -Irl '^#\s*include\s*' *` + +Signed-off-by: David Howells +Signed-off-by: Jesse Gross +--- + datapath/datapath.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/datapath/datapath.c b/datapath/datapath.c +index 9864ce6..78bbfae 100644 +--- a/datapath/datapath.c ++++ b/datapath/datapath.c +@@ -39,7 +39,6 @@ + #include + #include + #include +-#include + #include + #include + #include +-- +1.7.10.4 + diff -Nru openvswitch-1.4.0/debian/patches/0008-datapath-omit-_mod-from-module-names.patch openvswitch-1.4.0/debian/patches/0008-datapath-omit-_mod-from-module-names.patch --- openvswitch-1.4.0/debian/patches/0008-datapath-omit-_mod-from-module-names.patch 1970-01-01 00:00:00.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/0008-datapath-omit-_mod-from-module-names.patch 2013-02-06 09:06:19.000000000 +0000 @@ -0,0 +1,339 @@ +From 1b264fc779d68acca4aacc7a55ff63085d5cf330 Mon Sep 17 00:00:00 2001 +From: Chris Wright +Date: Fri, 9 Mar 2012 09:55:45 -0800 +Subject: [PATCH 8/8] datapath: omit _mod from module names + +This renames the datapath modules: + + openvswitch_mod -> openvswitch + brcompat_mod -> brcompat + +The first makes the module name consistent with upstream, and the latter +is just for internal consistency. This makes tools, and documentation +refer to a common module name regardless if it's coming from upstream +linux or built from datapath/ as part of a local build. + +Signed-off-by: Chris Wright +Signed-off-by: Jesse Gross + +Conflicts: + NEWS + utilities/ovs-ctl.in +--- + INSTALL.Linux | 14 ++++---- + INSTALL.XenServer | 2 +- + INSTALL.bridge | 4 +-- + NEWS | 2 ++ + datapath/brcompat.c | 4 +-- + datapath/compat.h | 8 ++--- + datapath/linux/Kbuild.in | 4 +-- + datapath/linux/Makefile.main.in | 2 +- + datapath/linux/compat/genetlink-brcompat.c | 2 +- + datapath/vport-netdev.c | 2 +- + debian/dkms.conf.in | 4 +-- + utilities/ovs-ctl.8 | 4 +-- + utilities/ovs-ctl.in | 49 ++++++++++++++-------------- + vswitchd/ovs-brcompatd.8.in | 2 +- + vswitchd/ovs-brcompatd.c | 2 +- + xenserver/openvswitch-xen.spec | 8 ++--- + 16 files changed, 58 insertions(+), 55 deletions(-) + +--- a/INSTALL.Linux ++++ b/INSTALL.Linux +@@ -199,16 +199,16 @@ Prerequisites section, follow the proced + + 6. If you built kernel modules, you may load them with "insmod", e.g.: + +- % insmod datapath/linux/openvswitch_mod.ko ++ % insmod datapath/linux/openvswitch.ko + + You may need to specify a full path to insmod, e.g. /sbin/insmod. + To verify that the modules have been loaded, run "/sbin/lsmod" and +- check that openvswitch_mod is listed. ++ check that openvswitch is listed. + + If the "insmod" operation fails, look at the last few kernel log + messages (e.g. with "dmesg | tail"): + +- - The message "openvswitch_mod: exports duplicate symbol ++ - The message "openvswitch: exports duplicate symbol + br_should_route_hook (owned by bridge)" means that the bridge + module is loaded. Run "/sbin/rmmod bridge" to remove it. + +@@ -217,7 +217,7 @@ Prerequisites section, follow the proced + the kernel, rather than as a module. Open vSwitch does not + support this configuration (see "Build Requirements", above). + +- - The message "openvswitch_mod: exports duplicate symbol ++ - The message "openvswitch: exports duplicate symbol + dp_ioctl_hook (owned by ofdatapath)" means that the ofdatapath + module from the OpenFlow reference implementation is loaded. + Run "/sbin/rmmod ofdatapath" to remove it. (You might have to +@@ -227,10 +227,10 @@ Prerequisites section, follow the proced + + - Otherwise, the most likely problem is that Open vSwitch was + built for a kernel different from the one into which you are +- trying to load it. Run "modinfo" on openvswitch_mod.ko and on ++ trying to load it. Run "modinfo" on openvswitch.ko and on + a module built for the running kernel, e.g.: + +- % /sbin/modinfo openvswitch_mod.ko ++ % /sbin/modinfo openvswitch.ko + % /sbin/modinfo /lib/modules/`uname -r`/kernel/net/bridge/bridge.ko + + Compare the "vermagic" lines output by the two commands. If +@@ -240,7 +240,7 @@ Prerequisites section, follow the proced + module loading, please include the output from the "dmesg" and + "modinfo" commands mentioned above. + +- There is an optional module parameter to openvswitch_mod.ko called ++ There is an optional module parameter to openvswitch.ko called + vlan_tso that enables TCP segmentation offload over VLANs on NICs + that support it. Many drivers do not expose support for TSO on VLANs + in a way that Open vSwitch can use but there is no way to detect +--- a/INSTALL.XenServer ++++ b/INSTALL.XenServer +@@ -88,7 +88,7 @@ When Open vSwitch is installed on XenSer + /etc/init.d/openvswitch runs early in boot. It does roughly the + following: + +- * Loads the OVS kernel module, openvswitch_mod. ++ * Loads the OVS kernel module, openvswitch. + + * Starts ovsdb-server, the OVS configuration database. + +--- a/INSTALL.bridge ++++ b/INSTALL.bridge +@@ -34,9 +34,9 @@ kernel bridge module. + + 2. Load the brcompat kernel module (which was built in step 1), e.g.: + +- % insmod datapath/linux/brcompat_mod.ko ++ % insmod datapath/linux/brcompat.ko + +- (openvswitch_mod.ko should already have been loaded.) ++ (openvswitch.ko should already have been loaded.) + + 3. Start ovs-brcompatd: + +--- a/NEWS ++++ b/NEWS +@@ -116,6 +116,8 @@ v1.2.0 - 03 Aug 2011 + to simplify 802.1ag configuration. + - Performance and scalability improvements + - Bug fixes ++ - kernel modules are renamed. openvswitch_mod.ko is now ++ openvswitch.ko and brcompat_mod.ko is now brcompat.ko. + + v1.1.0 - 05 Apr 2011 + ------------------------ +--- a/datapath/brcompat.c ++++ b/datapath/brcompat.c +@@ -520,7 +520,7 @@ static int __init brc_init(void) + /* Set the bridge ioctl handler */ + brioctl_set(brc_ioctl_deviceless_stub); + +- /* Set the openvswitch_mod device ioctl handler */ ++ /* Set the openvswitch device ioctl handler */ + ovs_dp_ioctl_hook = brc_dev_ioctl; + + /* Randomize the initial sequence number. This is not a security +@@ -569,7 +569,7 @@ MODULE_LICENSE("GPL"); + /* + * In kernels 2.6.36 and later, Open vSwitch can safely coexist with + * the Linux bridge module, but it does not make sense to load both bridge and +- * brcompat_mod, so this prevents it. ++ * brcompat, so this prevents it. + */ + BRIDGE_MUTUAL_EXCLUSION; + #endif +--- a/datapath/compat.h ++++ b/datapath/compat.h +@@ -58,12 +58,12 @@ static inline void skb_clear_rxhash(stru + * exporting br_should_route_hook. Because the bridge module also exports the + * same symbol, the module loader will refuse to load both modules at the same + * time (e.g. "bridge: exports duplicate symbol br_should_route_hook (owned by +- * openvswitch_mod)"). ++ * openvswitch)"). + * + * Before Linux 2.6.36, Open vSwitch cannot safely coexist with the Linux +- * bridge module, so openvswitch_mod uses this macro in those versions. In +- * Linux 2.6.36 and later, Open vSwitch can coexist with the bridge module, but +- * it makes no sense to load both bridge and brcompat_mod, so brcompat_mod uses ++ * bridge module, so openvswitch uses this macro in those versions. In ++ * Linux 2.6.36 and later, Open vSwitch can coexist with the bridge module, ++ * but it makes no sense to load both bridge and brcompat, so brcompat uses + * this macro in those versions. + * + * The use of "typeof" here avoids the need to track changes in the type of +--- a/datapath/linux/Kbuild.in ++++ b/datapath/linux/Kbuild.in +@@ -24,10 +24,10 @@ EXTRA_CFLAGS += -include $(builddir)/kco + # right place, even though it's conceptually incorrect. + NOSTDINC_FLAGS += -I$(top_srcdir)/include -I$(srcdir)/compat -I$(srcdir)/compat/include + +-obj-m := $(patsubst %,%_mod.o,$(build_modules)) ++obj-m := $(patsubst %,%.o,$(build_modules)) + + define module_template +-$(1)_mod-y = $$(notdir $$(patsubst %.c,%.o,$($(1)_sources))) ++$(1)-y = $$(notdir $$(patsubst %.c,%.o,$($(1)_sources))) + endef + + $(foreach module,$(build_modules),$(eval $(call module_template,$(module)))) +--- a/datapath/linux/Makefile.main.in ++++ b/datapath/linux/Makefile.main.in +@@ -29,7 +29,7 @@ check: all + installcheck: + mostlyclean: + clean: +- rm -f *.o *.ko *_mod.* Module.symvers *.cmd kcompat.h.new ++ rm -f *.o *.ko *.mod.* Module.symvers *.cmd kcompat.h.new + for d in $(build_links); do if test -h $$d; then rm $$d; fi; done + distclean: clean + rm -f kcompat.h +--- a/datapath/linux/compat/genetlink-brcompat.c ++++ b/datapath/linux/compat/genetlink-brcompat.c +@@ -1,5 +1,5 @@ + /* We fix grp->id to 32 so that it doesn't collide with any of the multicast +- * groups selected by openvswitch_mod, which uses groups 16 through 31. ++ * groups selected by openvswitch, which uses groups 16 through 31. + * Collision isn't fatal--multicast listeners should check that the family is + * the one that they want and discard others--but it wastes time and memory to + * receive unwanted messages. */ +--- a/datapath/vport-netdev.c ++++ b/datapath/vport-netdev.c +@@ -423,7 +423,7 @@ const struct vport_ops ovs_netdev_vport_ + * In kernels earlier than 2.6.36, Open vSwitch cannot safely coexist with the + * Linux bridge module, because there is only a single bridge hook function and + * only a single br_port member in struct net_device, so this prevents loading +- * both bridge and openvswitch_mod at the same time. ++ * both bridge and openvswitch at the same time. + */ + BRIDGE_MUTUAL_EXCLUSION; + #endif +--- a/utilities/ovs-ctl.8 ++++ b/utilities/ovs-ctl.8 +@@ -278,8 +278,8 @@ from other errors that may occur when ru + . + .PP + By default the \fBload\-kmod\fR command attempts to load the +-openvswitch_mod kernel module. If the \fB\-\-brcompat\fR option is +-specified then the brcompat_mod kernel module is also loaded. ++openvswitch kernel module. If the \fB\-\-brcompat\fR option is ++specified then the brcompat kernel module is also loaded. + . + .SH "The ``enable\-protocol'' command" + . +--- a/utilities/ovs-ctl.in ++++ b/utilities/ovs-ctl.in +@@ -31,14 +31,15 @@ done + ## ----- ## + + insert_openvswitch_mod_if_required () { +- # If openvswitch_mod is already loaded then we're done. +- test -e /sys/module/openvswitch_mod && return 0 ++ # If openvswitch is already loaded then we're done. ++ test -e /sys/module/openvswitch -o -e /sys/module/openvswitch_mod && \ ++ return 0 + +- # Load openvswitch_mod. If that's successful then we're done. +- action "Inserting openvswitch module" modprobe openvswitch_mod && return 0 ++ # Load openvswitch. If that's successful then we're done. ++ action "Inserting openvswitch module" modprobe openvswitch && return 0 + + # If the bridge module is loaded, then that might be blocking +- # openvswitch_mod. Try to unload it, if there are no bridges. ++ # openvswitch. Try to unload it, if there are no bridges. + test -e /sys/module/bridge || return 1 + bridges=`echo /sys/class/net/*/bridge | sed 's,/sys/class/net/,,g;s,/bridge,,g'` + if test "$bridges" != "*"; then +@@ -47,13 +48,17 @@ insert_openvswitch_mod_if_required () { + fi + action "removing bridge module" rmmod bridge || return 1 + +- # Try loading openvswitch_mod again. +- action "Inserting openvswitch module" modprobe openvswitch_mod ++ # Try loading openvswitch again. ++ action "Inserting openvswitch module" modprobe openvswitch + } + + insert_brcompat_mod_if_required () { +- test -e /sys/module/brcompat_mod && return 0 +- action "Inserting brcompat module" modprobe brcompat_mod ++ if test -e /sys/module/bridge; then ++ log_warning_msg "bridge module is loaded, not loading brcompat" ++ return 1 ++ fi ++ test -e /sys/module/brcompat -o -e /sys/module/brcompat_mod && return 0 ++ action "Inserting brcompat module" modprobe brcompat + } + + insert_mod_if_required () { +@@ -282,11 +287,16 @@ force_reload_kmod () { + action "Removing datapath: $dp" ovs-dpctl del-dp "$dp" + done + ++ # try both old and new names in case this is post upgrade + if test -e /sys/module/brcompat_mod; then + action "Removing brcompat module" rmmod brcompat_mod ++ elif test -e /sys/module/brcompat; then ++ action "Removing brcompat module" rmmod brcompat + fi + if test -e /sys/module/openvswitch_mod; then + action "Removing openvswitch module" rmmod openvswitch_mod ++ elif test -e /sys/module/openvswitch; then ++ action "Removing openvswitch module" rmmod openvswitch + fi + + start +--- a/vswitchd/ovs-brcompatd.8.in ++++ b/vswitchd/ovs-brcompatd.8.in +@@ -36,7 +36,7 @@ to find it. + .so lib/leak-checker.man + . + .SH NOTES +-\fBovs\-brcompatd\fR requires the \fBbrcompat_mod.ko\fR kernel module to be ++\fBovs\-brcompatd\fR requires the \fBbrcompat.ko\fR kernel module to be + loaded. + .SH "SEE ALSO" + .BR ovs\-appctl (8), +--- a/vswitchd/ovs-brcompatd.c ++++ b/vswitchd/ovs-brcompatd.c +@@ -456,7 +456,7 @@ handle_fdb_query_cmd(struct ofpbuf *buff + uint32_t seq; + int error; + +- /* Parse the command received from brcompat_mod. */ ++ /* Parse the command received from brcompat. */ + error = parse_command(buffer, &seq, &linux_name, NULL, &count, &skip); + if (error) { + return error; +--- a/xenserver/openvswitch-xen.spec ++++ b/xenserver/openvswitch-xen.spec +@@ -38,7 +38,7 @@ License: ASL 2.0 + Release: 1 + Source: openvswitch-%{openvswitch_version}.tar.gz + Buildroot: /tmp/openvswitch-xen-rpm +-Requires: openvswitch_mod.ko.%{module_abi_version} ++Requires: openvswitch.ko.%{module_abi_version} + + %description + Open vSwitch provides standard network bridging functions augmented with +@@ -49,7 +49,7 @@ traffic. + Summary: Open vSwitch kernel module + Group: System Environment/Kernel + License: GPLv2 +-Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch_mod.ko.%{module_abi_version} ++Provides: %{name}-modules-%{kernel_flavor} = %{kernel_version}, openvswitch.ko.%{module_abi_version} + Requires: kernel-%{kernel_name} = %{kernel_version} + + %description %{module_package} +@@ -437,5 +437,5 @@ exit 0 + %exclude /usr/share/openvswitch/python/ovs/db/*.py[co] + + %files %{module_package} +-/lib/modules/%{xen_version}/extra/openvswitch/openvswitch_mod.ko +-%exclude /lib/modules/%{xen_version}/extra/openvswitch/brcompat_mod.ko ++/lib/modules/%{xen_version}/extra/openvswitch/openvswitch.ko ++%exclude /lib/modules/%{xen_version}/extra/openvswitch/brcompat.ko diff -Nru openvswitch-1.4.0/debian/patches/series openvswitch-1.4.0/debian/patches/series --- openvswitch-1.4.0/debian/patches/series 2012-09-08 07:05:49.000000000 +0000 +++ openvswitch-1.4.0/debian/patches/series 2013-02-06 09:02:39.000000000 +0000 @@ -1,3 +1,11 @@ update_odputil_key_bytes.patch fix_ftbfs_big_endian.patch lp1044318-Reset-upper-layer-protocol-info.patch +0001-datapath-Remove-custom-version-of-ipv6_skip_exthdr.patch +0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch +0003-datapath-Stop-using-NLA_PUT.patch +0004-datapath-Backport-nla_put_be-functions.patch +0005-datapath-Support-for-kernel-3.3.patch +0006-Bump-up-the-supported-kernel-versions-to-include-3.5.patch +0007-datapath-Remove-all-inclusions-of-asm-system.h.patch +0008-datapath-omit-_mod-from-module-names.patch diff -Nru openvswitch-1.4.0/debian/rules.modules openvswitch-1.4.0/debian/rules.modules --- openvswitch-1.4.0/debian/rules.modules 2012-09-08 07:05:49.000000000 +0000 +++ openvswitch-1.4.0/debian/rules.modules 2013-02-06 09:06:34.000000000 +0000 @@ -29,7 +29,7 @@ cd openvswitch && ./configure --with-linux=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) --with-build-number=$(BUILD_NUMBER) cd openvswitch && $(MAKE) -C datapath/linux install -d -m755 $(DSTDIR) - install -m644 openvswitch/datapath/linux/*_mod.ko $(DSTDIR)/ + install -m644 openvswitch/datapath/linux/*.ko $(DSTDIR)/ dh_installmodules dh_installdocs dh_installchangelogs