On Mon, 11 Nov 2013, Jozsef Kadlecsik wrote: > On Wed, 30 Oct 2013, Vytas Dauksa wrote: > > > Introduce packet mark support with new ip,mark hash set. This includes > > userspace and kernelspace code, hash:ip,mark set tests and updates man > > page. > > Please give an example which demonstrates the usefulness of the set type. > > See my comments below about the code. [...] > > +/* Member elements */ > > +struct hash_ipmark4_elem { > > + __be32 ip; > > + __be32 mark; > > Mark is in host order, so __u32 is more appropriate. > > > +}; > > + > > +/* Common functions */ > > + > > +static inline bool > > +hash_ipmark4_data_equal(const struct hash_ipmark4_elem *ip1, > > + const struct hash_ipmark4_elem *ip2, > > + u32 *multi) > > +{ > > + return ip1->ip == ip2->ip && > > + ip1->mark == ip2->mark; > > +} > > + > > +static bool > > +hash_ipmark4_data_list(struct sk_buff *skb, > > + const struct hash_ipmark4_elem *data) > > +{ > > + if (nla_put_ipaddr4(skb, IPSET_ATTR_IP, data->ip) || > > + nla_put_net32(skb, IPSET_ATTR_MARK, data->mark)) Here a htonl conversion is required for data->mark if mark is stored in host order. Best regards, Jozsef - E-mail : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences H-1525 Budapest 114, POB. 49, Hungary -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html