NLA_PUT_BE32(skb, CTA_EXPECT_TIMEOUT, htonl(timeout));
        NLA_PUT_BE32(skb, CTA_EXPECT_ID, htonl((unsigned long)exp));
        NLA_PUT_BE32(skb, CTA_EXPECT_FLAGS, htonl(exp->flags));
+       NLA_PUT_BE32(skb, CTA_EXPECT_CLASS, htonl(exp->class));
        help = nfct_help(master);
        if (help) {
                struct nf_conntrack_helper *helper;
        [CTA_EXPECT_HELP_NAME]  = { .type = NLA_NUL_STRING },
        [CTA_EXPECT_ZONE]       = { .type = NLA_U16 },
        [CTA_EXPECT_FLAGS]      = { .type = NLA_U32 },
+       [CTA_EXPECT_CLASS]      = { .type = NLA_U32 },
 };
 
 static int
        struct nf_conn *ct;
        struct nf_conn_help *help;
        struct nf_conntrack_helper *helper = NULL;
+       u_int32_t class = 0;
        int err = 0;
 
        /* caller guarantees that those three CTA_EXPECT_* exist */
                }
        }
 
+       if (cda[CTA_EXPECT_CLASS] && helper) {
+               class = ntohl(nla_get_be32(cda[CTA_EXPECT_CLASS]));
+               if (class > helper->expect_class_max) {
+                       err = -EINVAL;
+                       goto out;
+               }
+       }
        exp = nf_ct_expect_alloc(ct);
        if (!exp) {
                err = -ENOMEM;
                        exp->flags = 0;
        }
 
-       exp->class = 0;
+       exp->class = class;
        exp->expectfn = NULL;
        exp->master = ct;
        exp->helper = helper;