Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41936
b: refs/heads/master
c: d7a5c32
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Dec 3, 2006
1 parent a7698ca commit 603b0fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 829e17a1a602572ffa3beefe582dc103ee9fb9c7
refs/heads/master: d7a5c32442ed3d528b9ddfd3d5b837bad0ffa9da
2 changes: 0 additions & 2 deletions trunk/include/linux/netfilter/nfnetlink_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ struct nfulnl_msg_packet_timestamp {
aligned_be64 usec;
};

#define NFULNL_PREFIXLEN 30 /* just like old log target */

enum nfulnl_attr_type {
NFULA_UNSPEC,
NFULA_PACKET_HDR,
Expand Down
19 changes: 10 additions & 9 deletions trunk/net/netfilter/nfnetlink_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ __build_packet_message(struct nfulnl_instance *inst,
const struct net_device *indev,
const struct net_device *outdev,
const struct nf_loginfo *li,
const char *prefix)
const char *prefix, unsigned int plen)
{
unsigned char *old_tail;
struct nfulnl_msg_packet_hdr pmsg;
Expand All @@ -432,12 +432,8 @@ __build_packet_message(struct nfulnl_instance *inst,

NFA_PUT(inst->skb, NFULA_PACKET_HDR, sizeof(pmsg), &pmsg);

if (prefix) {
int slen = strlen(prefix);
if (slen > NFULNL_PREFIXLEN)
slen = NFULNL_PREFIXLEN;
NFA_PUT(inst->skb, NFULA_PREFIX, slen, prefix);
}
if (prefix)
NFA_PUT(inst->skb, NFULA_PREFIX, plen, prefix);

if (indev) {
tmp_uint = htonl(indev->ifindex);
Expand Down Expand Up @@ -601,6 +597,7 @@ nfulnl_log_packet(unsigned int pf,
const struct nf_loginfo *li;
unsigned int qthreshold;
unsigned int nlbufsiz;
unsigned int plen;

if (li_user && li_user->type == NF_LOG_TYPE_ULOG)
li = li_user;
Expand All @@ -616,6 +613,10 @@ nfulnl_log_packet(unsigned int pf,
return;
}

plen = 0;
if (prefix)
plen = strlen(prefix);

/* all macros expand to constant values at compile time */
/* FIXME: do we want to make the size calculation conditional based on
* what is actually present? way more branches and checks, but more
Expand All @@ -630,7 +631,7 @@ nfulnl_log_packet(unsigned int pf,
#endif
+ NFA_SPACE(sizeof(u_int32_t)) /* mark */
+ NFA_SPACE(sizeof(u_int32_t)) /* uid */
+ NFA_SPACE(NFULNL_PREFIXLEN) /* prefix */
+ NFA_SPACE(plen) /* prefix */
+ NFA_SPACE(sizeof(struct nfulnl_msg_packet_hw))
+ NFA_SPACE(sizeof(struct nfulnl_msg_packet_timestamp));

Expand Down Expand Up @@ -701,7 +702,7 @@ nfulnl_log_packet(unsigned int pf,
inst->qlen++;

__build_packet_message(inst, skb, data_len, pf,
hooknum, in, out, li, prefix);
hooknum, in, out, li, prefix, plen);

/* timer_pending always called within inst->lock, so there
* is no chance of a race here */
Expand Down

0 comments on commit 603b0fe

Please sign in to comment.