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: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
@@ -22,6 +22,7 @@ config NFT_BRIDGE_REJECT
|
||||
|
||||
config NF_LOG_BRIDGE
|
||||
tristate "Bridge packet logging"
|
||||
select NF_LOG_COMMON
|
||||
|
||||
endif # NF_TABLES_BRIDGE
|
||||
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user