Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1fddf4ba authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso
Browse files

netfilter: nf_log: add packet logging for netdev family



Move layer 2 packet logging into nf_log_l2packet() that resides in
nf_log_common.c, so this can be shared by both bridge and netdev
families.

This patch adds the boiler plate code to register the netdev logging
family.

Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent f6d0cbcf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -109,5 +109,10 @@ void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf,
			       const struct net_device *out,
			       const struct nf_loginfo *loginfo,
			       const char *prefix);
void nf_log_l2packet(struct net *net, u_int8_t pf, unsigned int hooknum,
		     const struct sk_buff *skb,
		     const struct net_device *in,
		     const struct net_device *out,
		     const struct nf_loginfo *loginfo, const char *prefix);

#endif /* _NF_LOG_H */
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ config NFT_BRIDGE_REJECT

config NF_LOG_BRIDGE
	tristate "Bridge packet logging"
	select NF_LOG_COMMON

endif # NF_TABLES_BRIDGE

+1 −15
Original line number Diff line number Diff line
@@ -24,21 +24,7 @@ static void nf_log_bridge_packet(struct net *net, u_int8_t pf,
				 const struct nf_loginfo *loginfo,
				 const char *prefix)
{
	switch (eth_hdr(skb)->h_proto) {
	case htons(ETH_P_IP):
		nf_log_packet(net, NFPROTO_IPV4, hooknum, skb, in, out,
			      loginfo, "%s", prefix);
		break;
	case htons(ETH_P_IPV6):
		nf_log_packet(net, NFPROTO_IPV6, hooknum, skb, in, out,
			      loginfo, "%s", prefix);
		break;
	case htons(ETH_P_ARP):
	case htons(ETH_P_RARP):
		nf_log_packet(net, NFPROTO_ARP, hooknum, skb, in, out,
			      loginfo, "%s", prefix);
		break;
	}
	nf_log_l2packet(net, pf, hooknum, skb, in, out, loginfo, prefix);
}

static struct nf_logger nf_bridge_logger __read_mostly = {
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,10 @@ config NF_CONNTRACK
config NF_LOG_COMMON
	tristate

config NF_LOG_NETDEV
	tristate "Netdev packet logging"
	select NF_LOG_COMMON

if NF_CONNTRACK

config NF_CONNTRACK_MARK
+3 −0
Original line number Diff line number Diff line
@@ -48,6 +48,9 @@ nf_nat-y := nf_nat_core.o nf_nat_proto_unknown.o nf_nat_proto_common.o \
# generic transport layer logging
obj-$(CONFIG_NF_LOG_COMMON) += nf_log_common.o

# packet logging for netdev family
obj-$(CONFIG_NF_LOG_NETDEV) += nf_log_netdev.o

obj-$(CONFIG_NF_NAT) += nf_nat.o
obj-$(CONFIG_NF_NAT_REDIRECT) += nf_nat_redirect.o

Loading