-
-
Notifications
You must be signed in to change notification settings - Fork 728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SBGP extension handling #2053
Open
thillux
wants to merge
30
commits into
sfackler:master
Choose a base branch
from
thillux:sbgp-extension
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c160383
read AS numbers
nomick 525dcbb
IP address range parsing
nomick a7dc993
add possibility to define sbgp extensions
nomick 187ee6d
some style fixes
nomick d27ac33
fixes for current master and OpenSSL 3
thillux e93ab39
add test for SBGP extension
thillux 815a951
mark supported OpenSSL version range, make CI happy
thillux df85aef
fix formatting for older rust versions
thillux 78c4b4e
removed local reimpls of ossl functions
PetrichorIT 95f97b3
API refactoring, removed unessecary components
PetrichorIT 98bff2f
switched to internal types for sbgp extension building
PetrichorIT a24c404
simplified builder, added more tests
PetrichorIT c4a61d1
removed random whitespace change in systest/build
PetrichorIT 54c6e48
appeased clippy & added missing cfg(ossl110)
PetrichorIT 938a715
fix unused import
PetrichorIT c5cad36
fixed inherit & critical defaults & canonical
PetrichorIT 0dd8c8d
fix leak, deferred allocation of max
PetrichorIT e4c23d1
simplified builder, removed nonrepr states
PetrichorIT 2386460
fixed cfg statements
PetrichorIT 49fec48
added assertions & panics + renamed some types
PetrichorIT cc295b5
docs & AS number extension subset_of test
PetrichorIT b6f9916
added SBGP IP ext, misssing bindings
PetrichorIT 7949ec4
added missing bindings + fixed fmt
PetrichorIT ba3bf9f
added OPENSSL_NO_RFC3779 to tests
PetrichorIT fa9e0b3
tests missing cfg flags + simplified use stmts
PetrichorIT 7cb5e43
Merge branch 'master' into sbgp-extension
PetrichorIT 8f32bb9
fixed missing cfg flags
PetrichorIT 6cc634c
fixed X509V3_asid_subset, no longer available in 1.1.0
PetrichorIT 7bce3d5
fixed rustfmt
PetrichorIT 6dcf781
fix typos & small clippy fix
HolyShitMan File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
#[cfg(ossl110)] | ||
use super::super::*; | ||
#[cfg(ossl110)] | ||
use libc::*; | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct ASRange { | ||
pub min: *mut ASN1_INTEGER, | ||
pub max: *mut ASN1_INTEGER, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct ASIdOrRange { | ||
pub type_: c_int, | ||
pub u: ASIdOrRange_st_anon_union, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub union ASIdOrRange_st_anon_union { | ||
pub id: *mut ASN1_INTEGER, | ||
pub range: *mut ASRange, | ||
} | ||
|
||
#[cfg(ossl110)] | ||
stack!(stack_st_ASIdOrRange); | ||
#[cfg(ossl110)] | ||
type ASIdOrRanges = stack_st_ASIdOrRange; | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub union ASIdentifierChoice_st_anon_union { | ||
pub asIdsOrRanges: *mut stack_st_ASIdOrRange, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct ASIdentifierChoice { | ||
pub type_: c_int, | ||
pub u: ASIdentifierChoice_st_anon_union, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct ASIdentifiers { | ||
pub asnum: *mut ASIdentifierChoice, | ||
pub rdi: *mut ASIdentifierChoice, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct IPAddressRange { | ||
pub min: *mut ASN1_BIT_STRING, | ||
pub max: *mut ASN1_BIT_STRING, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct IPAddressOrRange { | ||
pub type_: c_int, | ||
pub u: IPAddressOrRange_st_anon_union, | ||
} | ||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub union IPAddressOrRange_st_anon_union { | ||
pub addressPrefix: *mut ASN1_BIT_STRING, | ||
pub addressRange: *mut IPAddressRange, | ||
} | ||
|
||
#[cfg(ossl110)] | ||
stack!(stack_st_IPAddressOrRange); | ||
#[cfg(ossl110)] | ||
type IPAddressOrRanges = stack_st_IPAddressOrRange; | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub union IPAddressChoice_st_anon_union { | ||
pub addressesOrRanges: *mut IPAddressOrRanges, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct IPAddressChoice { | ||
pub type_: c_int, | ||
pub u: IPAddressChoice_st_anon_union, | ||
} | ||
|
||
#[repr(C)] | ||
#[cfg(ossl110)] | ||
pub struct IPAddressFamily { | ||
pub addressFamily: *mut ASN1_OCTET_STRING, | ||
pub ipAddressChoice: *mut IPAddressChoice, | ||
} | ||
|
||
#[cfg(ossl110)] | ||
stack!(stack_st_IPAddressFamily); | ||
#[cfg(ossl110)] | ||
type IPAddrBlocks = stack_st_IPAddressFamily; | ||
|
||
#[cfg(ossl110)] | ||
extern "C" { | ||
/* | ||
* Constructors / Destructors for SBGP autonomousSysNum | ||
*/ | ||
pub fn ASIdentifiers_new() -> *mut ASIdentifiers; | ||
pub fn ASIdentifiers_free(asi: *mut ASIdentifiers); | ||
pub fn ASIdOrRange_free(asi: *mut ASIdOrRange); | ||
|
||
/* | ||
* Constructors / Destructors for SBGP ipAddrBlock | ||
*/ | ||
pub fn IPAddressFamily_free(asi: *mut IPAddressFamily); | ||
pub fn IPAddressOrRange_free(asi: *mut IPAddressOrRange); | ||
|
||
/* | ||
* Utility functions for working with RFC 3779 values, | ||
* since their encodings are a bit tedious. | ||
* | ||
* Not yet used: | ||
* - X509v3_addr_add_inherit | ||
* - X509v3_addr_add_prefix | ||
*/ | ||
pub fn X509v3_asid_add_id_or_range( | ||
asid: *mut ASIdentifiers, | ||
which: c_int, | ||
min: *mut ASN1_INTEGER, | ||
max: *mut ASN1_INTEGER, | ||
) -> c_int; | ||
pub fn X509v3_asid_add_inherit(asid: *mut ASIdentifiers, which: c_int) -> c_int; | ||
pub fn X509v3_asid_canonize(asid: *mut ASIdentifiers) -> c_int; | ||
pub fn X509v3_asid_is_canonical(asid: *mut ASIdentifiers) -> c_int; | ||
|
||
pub fn X509v3_addr_get_range( | ||
aor: *mut IPAddressOrRange, | ||
afi: c_uint, | ||
min: *mut c_uchar, | ||
max: *mut c_uchar, | ||
length: c_int, | ||
) -> c_int; | ||
pub fn X509v3_addr_get_afi(f: *const IPAddressFamily) -> c_uint; | ||
pub fn X509v3_addr_add_range( | ||
addr: *mut IPAddrBlocks, | ||
afi: c_uint, | ||
safi: *const c_uint, | ||
min: *mut c_uchar, | ||
max: *mut c_uchar, | ||
) -> c_int; | ||
pub fn X509v3_addr_add_inherit( | ||
addr: *mut IPAddrBlocks, | ||
afi: c_uint, | ||
safi: *const c_uint, | ||
) -> c_int; | ||
pub fn X509v3_addr_canonize(addr: *mut IPAddrBlocks) -> c_int; | ||
pub fn X509v3_addr_is_canonical(addr: *mut IPAddrBlocks) -> c_int; | ||
} |
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,35 @@ | ||
#[cfg(ossl110)] | ||
use libc::*; | ||
|
||
#[cfg(ossl110)] | ||
use super::*; | ||
|
||
#[cfg(ossl110)] | ||
pub const ASIdOrRange_id: c_int = 0; | ||
#[cfg(ossl110)] | ||
pub const ASIdOrRange_range: c_int = 1; | ||
|
||
#[cfg(ossl110)] | ||
pub const ASIdentifierChoice_inherit: c_int = 0; | ||
#[cfg(ossl110)] | ||
pub const ASIdentifierChoice_asIdsOrRanges: c_int = 1; | ||
|
||
#[cfg(ossl110)] | ||
pub const IPAddressOrRange_addressPrefix: c_int = 0; | ||
#[cfg(ossl110)] | ||
pub const IPAddressOrRange_addressRange: c_int = 1; | ||
|
||
#[cfg(ossl110)] | ||
pub const IPAddressChoice_inherit: c_int = 0; | ||
#[cfg(ossl110)] | ||
pub const IPAddressChoice_addressesOrRanges: c_int = 1; | ||
|
||
#[cfg(ossl110)] | ||
pub const IANA_AFI_IPV4: c_int = 1; | ||
#[cfg(ossl110)] | ||
pub const IANA_AFI_IPV6: c_int = 2; | ||
|
||
#[cfg(ossl110)] | ||
pub const V3_ASID_ASNUM: c_int = 0; | ||
#[cfg(ossl110)] | ||
pub const V3_ASID_RDI: c_int = 1; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these should probably condition on
OPENSSL_NO_RFC3779
as well.