Skip to content

netfilter: nf_nat_snmp_basic: use ASN.1 decoder

Taehee Yoo netfilter-devel 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 1 replyIn review
  2. v45 patches 1 replySuperseded
  3. v35 patches 2 repliesSuperseded

Changes in v5 from the cover letter

- fix sparse error

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5netfilter: nf_nat_snmp_basic: remove useless commentnet/ipv4/netfilter/nf_nat_snmp_basic.c+0 -300 replies
2/5netfilter: nf_nat_snmp_basic: remove debug parameternet/ipv4/netfilter/nf_nat_snmp_basic.c+0 -620 replies
3/5netfilter: nf_nat_snmp_basic: replace ctinfo with dir.net/ipv4/netfilter/nf_nat_snmp_basic.c+2 -50 replies
4/5netfilter: nf_nat_snmp_basic: use nf_ct_helper_lognet/ipv4/netfilter/nf_nat_snmp_basic.c+6 -50 replies
5/5netfilter: nf_nat_snmp_basic: use asn1 decoder librarynet/ipv4/netfilter/Kconfig net/ipv4/netfilter/Makefile net/ipv4/netfilter/nf_nat_snmp_basic.asn1 +1 more+241 -10140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH V5 0/5] netfilter: nf_nat_snmp_basic: use ASN.1 decoder

The goal of this patch set are to use the ASN.1 decoder library to parse SNMP ASN.1 payload.

This patch set are same as previous patch
"[PATCH V2]netfilter: nf_nat_snmp_basic: use asn1 decoder library".

My test environment are below.

#Network
Client <-------------> Netfilter FW <-------------> SNMP Server
192.168.3.2 192.168.3.1 192.168.4.1 192.168.4.2

#FW commands

   iptables -t raw -I PREROUTING -p udp -m multiport --dports 161,162 \
	-j CT --helper snmp

echo 'file nf_nat_snmp_basic_main.c +p' > \
/sys/kernel/debug/dynamic_debug/control

#SNMP Server commands
sudo ip r a 192.168.3.2 via 192.168.4.1 dev enp2s0
#Client commands
sudo ip r a 192.168.4.2 via 192.168.3.1 dev enp3s0

To test basic snmp test, I used snmpwalk command because it is easy to use
snmpwalk -v <1 or 2c> -c public <ip address> OID
example)
snmpwalk -v 2c -c public 192.168.4.2 .1.3.6.1.2.1.4.21

so that we can see this message from dmesg.
"snmp_helper: 192.168.3.2 to 192.168.4.1"

And, to test snmp trap test, I used snmptrap command.

   snmptrap -v 1 -c public 192.168.3.2 .1 192.168.4.2 0 0 0 .1 a \
	192.168.4.2

snmptrap -v 2c -c public 192.168.3.2 .1 .1 .1 a 192.168.4.2

SNMPv1 trap includes two ip address in payload. so we can see below message twice.
"snmp_helper: 192.168.4.2 to 192.168.3.1"

If you want to see asn1 decoder debug message, please use below command echo 'file asn1_decoder.c +p' > /sys/kernel/debug/dynamic_debug/control

V5 :
- fix sparse error

V4 :
- rename nf_nat_snmp_basic.c to nf_nat_snmp_basic_main.c to fix compile error

V3 :
- be separated by previous patch.

V2 :
- Add missing nf_nat_snmp_basic.asn1 file

V1 :
- Initial patch

Taehee Yoo (5):
netfilter: nf_nat_snmp_basic: remove useless comment
netfilter: nf_nat_snmp_basic: remove debug parameter
netfilter: nf_nat_snmp_basic: replace ctinfo with dir.
netfilter: nf_nat_snmp_basic: use nf_ct_helper_log
netfilter: nf_nat_snmp_basic: use asn1 decoder library

 net/ipv4/netfilter/Kconfig                         |    1 +
 net/ipv4/netfilter/Makefile                        |    6 +
 net/ipv4/netfilter/nf_nat_snmp_basic.asn1          |  177 +++
 ...f_nat_snmp_basic.c => nf_nat_snmp_basic_main.c} | 1181 ++------------------
 4 files changed, 249 insertions(+), 1116 deletions(-)
 create mode 100644 net/ipv4/netfilter/nf_nat_snmp_basic.asn1
 rename net/ipv4/netfilter/{nf_nat_snmp_basic.c => nf_nat_snmp_basic_main.c} (15%)
Signature · 1 line
2.9.3