1
#ifndef _IP_SET_COMMENT_H
2
#define _IP_SET_COMMENT_H
4
/* Copyright (C) 2013 Oliver Smith <oliver@8.c.9.b.0.7.4.0.1.0.0.2.ip6.arpa>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
14
ip_set_comment_uget(struct nlattr *tb)
20
ip_set_init_comment(struct ip_set_comment *comment,
21
const struct ip_set_ext *ext)
23
size_t len = ext->comment ? strlen(ext->comment) : 0;
25
if (unlikely(comment->str)) {
31
if (unlikely(len > IPSET_MAX_COMMENT_SIZE))
32
len = IPSET_MAX_COMMENT_SIZE;
33
comment->str = kzalloc(len + 1, GFP_ATOMIC);
34
if (unlikely(!comment->str))
36
strlcpy(comment->str, ext->comment, len + 1);
40
ip_set_put_comment(struct sk_buff *skb, struct ip_set_comment *comment)
44
return nla_put_string(skb, IPSET_ATTR_COMMENT, comment->str);
48
ip_set_comment_free(struct ip_set_comment *comment)
50
if (unlikely(!comment->str))