@@ -1128,9 +1128,9 @@ static int
11281128ctnetlink_create_conntrack (struct nlattr * cda [],
11291129 struct nf_conntrack_tuple * otuple ,
11301130 struct nf_conntrack_tuple * rtuple ,
1131- struct nf_conn * master_ct ,
11321131 u32 pid ,
1133- int report )
1132+ int report ,
1133+ u8 u3 )
11341134{
11351135 struct nf_conn * ct ;
11361136 int err = - EINVAL ;
@@ -1241,7 +1241,22 @@ ctnetlink_create_conntrack(struct nlattr *cda[],
12411241#endif
12421242
12431243 /* setup master conntrack: this is a confirmed expectation */
1244- if (master_ct ) {
1244+ if (cda [CTA_TUPLE_MASTER ]) {
1245+ struct nf_conntrack_tuple master ;
1246+ struct nf_conntrack_tuple_hash * master_h ;
1247+ struct nf_conn * master_ct ;
1248+
1249+ err = ctnetlink_parse_tuple (cda , & master , CTA_TUPLE_MASTER , u3 );
1250+ if (err < 0 )
1251+ goto err ;
1252+
1253+ master_h = __nf_conntrack_find (& init_net , & master );
1254+ if (master_h == NULL ) {
1255+ err = - ENOENT ;
1256+ goto err ;
1257+ }
1258+ master_ct = nf_ct_tuplehash_to_ctrack (master_h );
1259+ nf_conntrack_get (& master_ct -> ct_general );
12451260 __set_bit (IPS_EXPECTED_BIT , & ct -> status );
12461261 ct -> master = master_ct ;
12471262 }
@@ -1289,39 +1304,15 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
12891304 h = __nf_conntrack_find (& init_net , & rtuple );
12901305
12911306 if (h == NULL ) {
1292- struct nf_conntrack_tuple master ;
1293- struct nf_conntrack_tuple_hash * master_h = NULL ;
1294- struct nf_conn * master_ct = NULL ;
1295-
1296- if (cda [CTA_TUPLE_MASTER ]) {
1297- err = ctnetlink_parse_tuple (cda ,
1298- & master ,
1299- CTA_TUPLE_MASTER ,
1300- u3 );
1301- if (err < 0 )
1302- goto out_unlock ;
1303-
1304- master_h = __nf_conntrack_find (& init_net , & master );
1305- if (master_h == NULL ) {
1306- err = - ENOENT ;
1307- goto out_unlock ;
1308- }
1309- master_ct = nf_ct_tuplehash_to_ctrack (master_h );
1310- nf_conntrack_get (& master_ct -> ct_general );
1311- }
1312-
13131307 err = - ENOENT ;
13141308 if (nlh -> nlmsg_flags & NLM_F_CREATE )
13151309 err = ctnetlink_create_conntrack (cda ,
13161310 & otuple ,
13171311 & rtuple ,
1318- master_ct ,
13191312 NETLINK_CB (skb ).pid ,
1320- nlmsg_report (nlh ));
1313+ nlmsg_report (nlh ),
1314+ u3 );
13211315 spin_unlock_bh (& nf_conntrack_lock );
1322- if (err < 0 && master_ct )
1323- nf_ct_put (master_ct );
1324-
13251316 return err ;
13261317 }
13271318 /* implicit 'else' */
0 commit comments