X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fodp-util.c;h=a8d561b0e64226552c6307fc31e35034a116ab54;hb=96ed775f;hp=9c63e9a4cfe0c61b644fa2a4949a3b6a4c251f9a;hpb=9ddf12cc12520acd7d09a8dfca74379faf0acf09;p=sliver-openvswitch.git diff --git a/lib/odp-util.c b/lib/odp-util.c index 9c63e9a4c..a8d561b0e 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -3309,8 +3309,20 @@ odp_put_userspace_action(uint32_t pid, nl_msg_put_u32(odp_actions, OVS_USERSPACE_ATTR_PID, pid); if (userdata) { userdata_ofs = odp_actions->size + NLA_HDRLEN; - nl_msg_put_unspec(odp_actions, OVS_USERSPACE_ATTR_USERDATA, - userdata, userdata_size); + + /* The OVS kernel module before OVS 1.11 and the upstream Linux kernel + * module before Linux 3.10 required the userdata to be exactly 8 bytes + * long: + * + * - The kernel rejected shorter userdata with -ERANGE. + * + * - The kernel silently dropped userdata beyond the first 8 bytes. + * + * Thus, for maximum compatibility, always put at least 8 bytes. (We + * separately disable features that required more than 8 bytes.) */ + memcpy(nl_msg_put_unspec_zero(odp_actions, OVS_USERSPACE_ATTR_USERDATA, + MAX(8, userdata_size)), + userdata, userdata_size); } else { userdata_ofs = 0; }