Commit d7a5c32442ed3d528b9ddfd3d5b837bad0ffa9da
Committed by
David S. Miller
1 parent
829e17a1a6
Exists in
master
and in
7 other branches
[NETFILTER]: nfnetlink_log: remove useless prefix length limitation
There is no reason for limiting netlink attributes in size. Signed-off-by: Patrick McHardy <kaber@trash.net>
Showing 2 changed files with 10 additions and 11 deletions Side-by-side Diff
include/linux/netfilter/nfnetlink_log.h
net/netfilter/nfnetlink_log.c
... | ... | @@ -408,7 +408,7 @@ |
408 | 408 | const struct net_device *indev, |
409 | 409 | const struct net_device *outdev, |
410 | 410 | const struct nf_loginfo *li, |
411 | - const char *prefix) | |
411 | + const char *prefix, unsigned int plen) | |
412 | 412 | { |
413 | 413 | unsigned char *old_tail; |
414 | 414 | struct nfulnl_msg_packet_hdr pmsg; |
... | ... | @@ -432,12 +432,8 @@ |
432 | 432 | |
433 | 433 | NFA_PUT(inst->skb, NFULA_PACKET_HDR, sizeof(pmsg), &pmsg); |
434 | 434 | |
435 | - if (prefix) { | |
436 | - int slen = strlen(prefix); | |
437 | - if (slen > NFULNL_PREFIXLEN) | |
438 | - slen = NFULNL_PREFIXLEN; | |
439 | - NFA_PUT(inst->skb, NFULA_PREFIX, slen, prefix); | |
440 | - } | |
435 | + if (prefix) | |
436 | + NFA_PUT(inst->skb, NFULA_PREFIX, plen, prefix); | |
441 | 437 | |
442 | 438 | if (indev) { |
443 | 439 | tmp_uint = htonl(indev->ifindex); |
... | ... | @@ -601,6 +597,7 @@ |
601 | 597 | const struct nf_loginfo *li; |
602 | 598 | unsigned int qthreshold; |
603 | 599 | unsigned int nlbufsiz; |
600 | + unsigned int plen; | |
604 | 601 | |
605 | 602 | if (li_user && li_user->type == NF_LOG_TYPE_ULOG) |
606 | 603 | li = li_user; |
... | ... | @@ -616,6 +613,10 @@ |
616 | 613 | return; |
617 | 614 | } |
618 | 615 | |
616 | + plen = 0; | |
617 | + if (prefix) | |
618 | + plen = strlen(prefix); | |
619 | + | |
619 | 620 | /* all macros expand to constant values at compile time */ |
620 | 621 | /* FIXME: do we want to make the size calculation conditional based on |
621 | 622 | * what is actually present? way more branches and checks, but more |
... | ... | @@ -630,7 +631,7 @@ |
630 | 631 | #endif |
631 | 632 | + NFA_SPACE(sizeof(u_int32_t)) /* mark */ |
632 | 633 | + NFA_SPACE(sizeof(u_int32_t)) /* uid */ |
633 | - + NFA_SPACE(NFULNL_PREFIXLEN) /* prefix */ | |
634 | + + NFA_SPACE(plen) /* prefix */ | |
634 | 635 | + NFA_SPACE(sizeof(struct nfulnl_msg_packet_hw)) |
635 | 636 | + NFA_SPACE(sizeof(struct nfulnl_msg_packet_timestamp)); |
636 | 637 | |
... | ... | @@ -701,7 +702,7 @@ |
701 | 702 | inst->qlen++; |
702 | 703 | |
703 | 704 | __build_packet_message(inst, skb, data_len, pf, |
704 | - hooknum, in, out, li, prefix); | |
705 | + hooknum, in, out, li, prefix, plen); | |
705 | 706 | |
706 | 707 | /* timer_pending always called within inst->lock, so there |
707 | 708 | * is no chance of a race here */ |