Skip to content

Commit

Permalink
Enables AMF to accept not-perfect NGAP packets which have not 0 ASN.1…
Browse files Browse the repository at this point in the history
… PER padding bit. (#2)

* Enables AMF to accept not-perfect NGAP packets which have not 0 ASN.1 PER padding bit.

* Use go build -tags skip_padding_check to switch padding check

Default will check padding if value is 0

Co-authored-by: free5gc-org <free5gc.org@gmail.com>
  • Loading branch information
matsumu-y and free5gc-org committed Apr 1, 2022
1 parent 162f622 commit 504c704
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aper.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ func (pd *perBitData) parseAlignBits() error {
if val, err := pd.getBitsValue(alignBits); err != nil {
return err
} else if val != 0 {
return fmt.Errorf("Align Bit is not zero")
if skipPaddingCheck {
perTrace(2, "Align Bit is not zero")
perTrace(1, perBitLog(uint64(alignBits), pd.byteOffset, pd.bitsOffset, val))
} else {
return fmt.Errorf("Align Bit is not zero")
}
}
} else if pd.bitsOffset != 0 {
pd.bitCarry()
Expand Down
5 changes: 5 additions & 0 deletions padding_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build !skip_padding_check

package aper

const skipPaddingCheck bool = false
5 changes: 5 additions & 0 deletions skip_padding_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build skip_padding_check

package aper

const skipPaddingCheck bool = true

0 comments on commit 504c704

Please sign in to comment.