···303303304304---------------------------305305306306-What: CONFIG_NF_CT_ACCT307307-When: 2.6.29308308-Why: Accounting can now be enabled/disabled without kernel recompilation.309309- Currently used only to set a default value for a feature that is also310310- controlled by a kernel/module/sysfs/sysctl parameter.311311-Who: Krzysztof Piotr Oledzki <ole@ans.pl>312312-313313----------------------------314314-315306What: sysfs ui for changing p4-clockmod parameters316307When: September 2009317308Why: See commits 129f8ae9b1b5be94517da76009ea956e89104ce8 and
+1-2
Documentation/kernel-parameters.txt
···15971597 [NETFILTER] Enable connection tracking flow accounting15981598 0 to disable accounting15991599 1 to enable accounting16001600- Default value depends on CONFIG_NF_CT_ACCT that is16011601- going to be removed in 2.6.29.16001600+ Default value is 0.1602160116031602 nfsaddrs= [NFS]16041603 See Documentation/filesystems/nfs/nfsroot.txt.
+2
include/linux/ip_vs.h
···1919 */2020#define IP_VS_SVC_F_PERSISTENT 0x0001 /* persistent port */2121#define IP_VS_SVC_F_HASHED 0x0002 /* hashed entry */2222+#define IP_VS_SVC_F_ONEPACKET 0x0004 /* one-packet scheduling */22232324/*2425 * Destination Server Flags···8685#define IP_VS_CONN_F_SEQ_MASK 0x0600 /* in/out sequence mask */8786#define IP_VS_CONN_F_NO_CPORT 0x0800 /* no client port set yet */8887#define IP_VS_CONN_F_TEMPLATE 0x1000 /* template, not connection */8888+#define IP_VS_CONN_F_ONE_PACKET 0x2000 /* forward only one packet */89899090#define IP_VS_SCHEDNAME_MAXLEN 169191#define IP_VS_IFNAME_MAXLEN 16
···131131 if (!nf_nat_initialized(ct, maniptype)) {132132 unsigned int ret;133133134134- if (hooknum == NF_INET_LOCAL_IN)135135- /* LOCAL_IN hook doesn't have a chain! */136136- ret = alloc_null_binding(ct, hooknum);137137- else138138- ret = nf_nat_rule_find(skb, hooknum, in, out,139139- ct);140140-134134+ ret = nf_nat_rule_find(skb, hooknum, in, out, ct);141135 if (ret != NF_ACCEPT)142136 return ret;143137 } else
+53-28
net/ipv6/netfilter/ip6t_LOG.c
···373373 printk("MARK=0x%x ", skb->mark);374374}375375376376+static void dump_mac_header(const struct nf_loginfo *info,377377+ const struct sk_buff *skb)378378+{379379+ struct net_device *dev = skb->dev;380380+ unsigned int logflags = 0;381381+382382+ if (info->type == NF_LOG_TYPE_LOG)383383+ logflags = info->u.log.logflags;384384+385385+ if (!(logflags & IP6T_LOG_MACDECODE))386386+ goto fallback;387387+388388+ switch (dev->type) {389389+ case ARPHRD_ETHER:390390+ printk("MACSRC=%pM MACDST=%pM MACPROTO=%04x ",391391+ eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest,392392+ ntohs(eth_hdr(skb)->h_proto));393393+ return;394394+ default:395395+ break;396396+ }397397+398398+fallback:399399+ printk("MAC=");400400+ if (dev->hard_header_len &&401401+ skb->mac_header != skb->network_header) {402402+ const unsigned char *p = skb_mac_header(skb);403403+ unsigned int len = dev->hard_header_len;404404+ unsigned int i;405405+406406+ if (dev->type == ARPHRD_SIT &&407407+ (p -= ETH_HLEN) < skb->head)408408+ p = NULL;409409+410410+ if (p != NULL) {411411+ printk("%02x", *p++);412412+ for (i = 1; i < len; i++)413413+ printk(":%02x", p[i]);414414+ }415415+ printk(" ");416416+417417+ if (dev->type == ARPHRD_SIT) {418418+ const struct iphdr *iph =419419+ (struct iphdr *)skb_mac_header(skb);420420+ printk("TUNNEL=%pI4->%pI4 ", &iph->saddr, &iph->daddr);421421+ }422422+ } else423423+ printk(" ");424424+}425425+376426static struct nf_loginfo default_loginfo = {377427 .type = NF_LOG_TYPE_LOG,378428 .u = {···450400 prefix,451401 in ? in->name : "",452402 out ? out->name : "");453453- if (in && !out) {454454- unsigned int len;455455- /* MAC logging for input chain only. */456456- printk("MAC=");457457- if (skb->dev && (len = skb->dev->hard_header_len) &&458458- skb->mac_header != skb->network_header) {459459- const unsigned char *p = skb_mac_header(skb);460460- int i;461403462462- if (skb->dev->type == ARPHRD_SIT &&463463- (p -= ETH_HLEN) < skb->head)464464- p = NULL;465465-466466- if (p != NULL) {467467- for (i = 0; i < len; i++)468468- printk("%02x%s", p[i],469469- i == len - 1 ? "" : ":");470470- }471471- printk(" ");472472-473473- if (skb->dev->type == ARPHRD_SIT) {474474- const struct iphdr *iph =475475- (struct iphdr *)skb_mac_header(skb);476476- printk("TUNNEL=%pI4->%pI4 ",477477- &iph->saddr, &iph->daddr);478478- }479479- } else480480- printk(" ");481481- }404404+ /* MAC logging for input path only. */405405+ if (in && !out)406406+ dump_mac_header(loginfo, skb);482407483408 dump_packet(loginfo, skb, skb_network_offset(skb), 1);484409 printk("\n");
+1-23
net/netfilter/Kconfig
···40404141if NF_CONNTRACK42424343-config NF_CT_ACCT4444- bool "Connection tracking flow accounting"4545- depends on NETFILTER_ADVANCED4646- help4747- If this option is enabled, the connection tracking code will4848- keep per-flow packet and byte counters.4949-5050- Those counters can be used for flow-based accounting or the5151- `connbytes' match.5252-5353- Please note that currently this option only sets a default state.5454- You may change it at boot time with nf_conntrack.acct=0/1 kernel5555- parameter or by loading the nf_conntrack module with acct=0/1.5656-5757- You may also disable/enable it on a running system with:5858- sysctl net.netfilter.nf_conntrack_acct=0/15959-6060- This option will be removed in 2.6.29.6161-6262- If unsure, say `N'.6363-6443config NF_CONNTRACK_MARK6544 bool 'Connection mark tracking support'6645 depends on NETFILTER_ADVANCED···494515 To compile it as a module, choose M here. If unsure, say N.495516496517config NETFILTER_XT_TARGET_TEE497497- tristate '"TEE" - packet cloning to alternate destiantion'518518+ tristate '"TEE" - packet cloning to alternate destination'498519 depends on NETFILTER_ADVANCED499520 depends on (IPV6 || IPV6=n)500521 depends on !NF_CONNTRACK || NF_CONNTRACK···609630 tristate '"connbytes" per-connection counter match support'610631 depends on NF_CONNTRACK611632 depends on NETFILTER_ADVANCED612612- select NF_CT_ACCT613633 help614634 This option adds a `connbytes' match, which allows you to match the615635 number of bytes and/or packets for each direction within a connection.
+7-3
net/netfilter/ipvs/ip_vs_conn.c
···158158 unsigned hash;159159 int ret;160160161161+ if (cp->flags & IP_VS_CONN_F_ONE_PACKET)162162+ return 0;163163+161164 /* Hash by protocol, client address and port */162165 hash = ip_vs_conn_hashkey(cp->af, cp->protocol, &cp->caddr, cp->cport);163166···362359 */363360void ip_vs_conn_put(struct ip_vs_conn *cp)364361{365365- /* reset it expire in its timeout */366366- mod_timer(&cp->timer, jiffies+cp->timeout);362362+ unsigned long t = (cp->flags & IP_VS_CONN_F_ONE_PACKET) ?363363+ 0 : cp->timeout;364364+ mod_timer(&cp->timer, jiffies+t);367365368366 __ip_vs_conn_put(cp);369367}···657653 /*658654 * unhash it if it is hashed in the conn table659655 */660660- if (!ip_vs_conn_unhash(cp))656656+ if (!ip_vs_conn_unhash(cp) && !(cp->flags & IP_VS_CONN_F_ONE_PACKET))661657 goto expire_later;662658663659 /*
···112112 if (ret < 0)113113 pr_info("cannot load conntrack support for proto=%u\n",114114 par->family);115115+116116+ /*117117+ * This filter cannot function correctly unless connection tracking118118+ * accounting is enabled, so complain in the hope that someone notices.119119+ */120120+ if (!nf_ct_acct_enabled(par->net)) {121121+ pr_warning("Forcing CT accounting to be enabled\n");122122+ nf_ct_set_acct(par->net, true);123123+ }124124+115125 return ret;116126}117127