This repository has been archived by the owner on May 2, 2024. It is now read-only.
forked from beagleboard/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
netfilter: nf_nat_snmp_basic: use asn1 decoder library
The basic SNMP ALG parse snmp ASN.1 payload however, since 2012 linux kernel provide ASN.1 decoder library. If we use ASN.1 decoder in the /lib/asn1_decoder.c, we can remove about 1000 line of ASN.1 parsing routine. To use asn1_decoder.c, we should write mib file(nf_nat_snmp_basic.asn1) then /script/asn1_compiler.c makes *-asn1.c and *-asn1.h file at the compiletime.(nf_nat_snmp_basic-asn1.c, nf_nat_snmp_basic-asn1.h) The nf_nat_snmp_basic.asn1 is made by RFC1155, RFC1157, RFC1902, RFC1905, RFC2578, RFC3416. of course that mib file supports only the basic SNMP ALG. Previous SNMP ALG mangles only first octet of IPv4 address. but after this patch, the SNMP ALG mangles whole IPv4 Address. And SNMPv3 is not supported. I tested with snmp commands such ans snmpd, snmpwalk, snmptrap. Signed-off-by: Taehee Yoo <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
- Loading branch information
Showing
5 changed files
with
419 additions
and
1,192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
Message ::= | ||
SEQUENCE { | ||
version | ||
INTEGER ({snmp_version}), | ||
|
||
community | ||
OCTET STRING, | ||
|
||
pdu | ||
PDUs | ||
} | ||
|
||
|
||
ObjectName ::= | ||
OBJECT IDENTIFIER | ||
|
||
ObjectSyntax ::= | ||
CHOICE { | ||
simple | ||
SimpleSyntax, | ||
|
||
application-wide | ||
ApplicationSyntax | ||
} | ||
|
||
SimpleSyntax ::= | ||
CHOICE { | ||
integer-value | ||
INTEGER, | ||
|
||
string-value | ||
OCTET STRING, | ||
|
||
objectID-value | ||
OBJECT IDENTIFIER | ||
} | ||
|
||
ApplicationSyntax ::= | ||
CHOICE { | ||
ipAddress-value | ||
IpAddress, | ||
|
||
counter-value | ||
Counter32, | ||
|
||
timeticks-value | ||
TimeTicks, | ||
|
||
arbitrary-value | ||
Opaque, | ||
|
||
big-counter-value | ||
Counter64, | ||
|
||
unsigned-integer-value | ||
Unsigned32 | ||
} | ||
|
||
IpAddress ::= | ||
[APPLICATION 0] | ||
IMPLICIT OCTET STRING OPTIONAL ({snmp_helper}) | ||
|
||
Counter32 ::= | ||
[APPLICATION 1] | ||
IMPLICIT INTEGER OPTIONAL | ||
|
||
Unsigned32 ::= | ||
[APPLICATION 2] | ||
IMPLICIT INTEGER OPTIONAL | ||
|
||
Gauge32 ::= Unsigned32 OPTIONAL | ||
|
||
TimeTicks ::= | ||
[APPLICATION 3] | ||
IMPLICIT INTEGER OPTIONAL | ||
|
||
Opaque ::= | ||
[APPLICATION 4] | ||
IMPLICIT OCTET STRING OPTIONAL | ||
|
||
Counter64 ::= | ||
[APPLICATION 6] | ||
IMPLICIT INTEGER OPTIONAL | ||
|
||
PDUs ::= | ||
CHOICE { | ||
get-request | ||
GetRequest-PDU, | ||
|
||
get-next-request | ||
GetNextRequest-PDU, | ||
|
||
get-bulk-request | ||
GetBulkRequest-PDU, | ||
|
||
response | ||
Response-PDU, | ||
|
||
set-request | ||
SetRequest-PDU, | ||
|
||
inform-request | ||
InformRequest-PDU, | ||
|
||
snmpV2-trap | ||
SNMPv2-Trap-PDU, | ||
|
||
report | ||
Report-PDU | ||
} | ||
|
||
GetRequest-PDU ::= | ||
[0] IMPLICIT PDU OPTIONAL | ||
|
||
GetNextRequest-PDU ::= | ||
[1] IMPLICIT PDU OPTIONAL | ||
|
||
Response-PDU ::= | ||
[2] IMPLICIT PDU OPTIONAL | ||
|
||
SetRequest-PDU ::= | ||
[3] IMPLICIT PDU OPTIONAL | ||
|
||
-- [4] is obsolete | ||
|
||
GetBulkRequest-PDU ::= | ||
[5] IMPLICIT PDU OPTIONAL | ||
|
||
InformRequest-PDU ::= | ||
[6] IMPLICIT PDU OPTIONAL | ||
|
||
SNMPv2-Trap-PDU ::= | ||
[7] IMPLICIT PDU OPTIONAL | ||
|
||
Report-PDU ::= | ||
[8] IMPLICIT PDU OPTIONAL | ||
|
||
PDU ::= | ||
SEQUENCE { | ||
request-id | ||
INTEGER, | ||
|
||
error-status | ||
INTEGER, | ||
|
||
error-index | ||
INTEGER, | ||
|
||
variable-bindings | ||
VarBindList | ||
} | ||
|
||
|
||
VarBind ::= | ||
SEQUENCE { | ||
name | ||
ObjectName, | ||
|
||
CHOICE { | ||
value | ||
ObjectSyntax, | ||
|
||
unSpecified | ||
NULL, | ||
|
||
noSuchObject | ||
[0] IMPLICIT NULL, | ||
|
||
noSuchInstance | ||
[1] IMPLICIT NULL, | ||
|
||
endOfMibView | ||
[2] IMPLICIT NULL | ||
} | ||
} | ||
|
||
VarBindList ::= SEQUENCE OF VarBind |
Oops, something went wrong.