Conversation
|
Last version was +576 −1,110 Now it is +705 −2,371 |
|
The S-V failure indicates a real problem in etopen rules |
Ticket: 4112 Move it away from http2 to generic core crate. And use it for DCERPC (and SMB) And remove the C version. Main change in API is the free function is not free itself, but a rust wrapper around unbox.
Ticket: 4112
Ticket: 4112
Ticket: 4112
d275de5 to
ebf6ee6
Compare
victorjulien
left a comment
There was a problem hiding this comment.
Some inline comments and questions.
Really nice job. Esp love seeing so much parsing code get removed.
| assert_eq!(DETECT_DCE_IFACE_OP_NE, iface_data.op); | ||
| assert_eq!(1, iface_data.any_frag); | ||
| assert_eq!(10, iface_data.version); | ||
| if let Some(x) = iface_data.du16 { |
There was a problem hiding this comment.
should we just use .unwrap() instead of conditions here?
| pub mode: DetectUintMode, | ||
| } | ||
|
|
||
| pub trait DetectIntType: |
There was a problem hiding this comment.
what are these empty constructs?
There was a problem hiding this comment.
@jasonish advised me these...
I want a generic that provides what I can get for unsigned integers : comparison, max value, parsing from string...
There was a problem hiding this comment.
What we're after is a type alias for a type that implements FromStr, PartialOrd, PrimInt, Bounded, however you can make a type alias (like a typedef) that specific multiple traits for whatever reason. The idiomatic workaround is to create a new trait that specifies all these traits.
It lets us specify function like fn detect_parse_uint_start_equal<T: DetectIntType> instead of fn detect_parse_uint_start_equal<T: std::str::FromStr + std::cmp::PartialOrd + num::PrimInt + num::Bounded>`.
| pub unsafe extern "C" fn rs_detect_u64_parse( | ||
| str: *const std::os::raw::c_char, | ||
| ) -> *mut DetectUintData<u64> { | ||
| let ft_name: &CStr = CStr::from_ptr(str); //unsafe |
There was a problem hiding this comment.
if unsafe, should we do more to check? E.g. can ft_name be validated somehow, or can str be?
btw str is also a type, might be good to not use it as an argument value. Tricks code hilighing here for example
There was a problem hiding this comment.
cc @jasonish
I think it is unsafe, because you have no assurance that C caller will provide a valid null-terminated string...
Changing str variable name
There was a problem hiding this comment.
if unsafe, should we do more to check? E.g. can
ft_namebe validated somehow, or canstrbe?
We can check for null, thats about it.
| ) -> *mut DetectUintData<u64> { | ||
| let ft_name: &CStr = CStr::from_ptr(str); //unsafe | ||
| if let Ok(s) = ft_name.to_str() { | ||
| if let Ok((_, ctx)) = detect_parse_uint::<u64>(s) { |
There was a problem hiding this comment.
Is the first, ignored, argument here the remaining string? Should we check if that is empty? Could it be non-empty on trailing data?
There was a problem hiding this comment.
Is the first, ignored, argument here the remaining string?
Yes
Should we check if that is empty? Could it be non-empty on trailing data?
I am not sure
There are other keywords such as urilen which have an integer, but not only. After, we can have norm|raw
| #define DETECT_UINT_LT DetectUintModeLt | ||
| #define DETECT_UINT_LTE DetectUintModeLte | ||
|
|
||
| typedef DetectUintData_u64 DetectU64Data; |
There was a problem hiding this comment.
These don't match our style, should probably be DetectUintDataU32
There was a problem hiding this comment.
What do you mean ?
DetectUintData_u64 is generated by cbindgen
DetectU64Data is what is in the code currently
I added these typedef to minimize the diff.
But we can run sed 's/DetectU64Data/DetectUintData_u64/' and avoid these
|
Replaced by #7170 |
The "eve.version" field is not always log. Update the schema to enforce that it is, and fix it for records that don't log it. Ticket: OISF#7167
The "eve.version" field is not always logged. Update the schema to enforce that it is, and fix it for records that don't log it. Ticket: OISF#7167
The "eve.version" field is not always logged. Update the schema to enforce that it is, and fix it for records that don't log it. Ticket: OISF#7167
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4112
Describe changes:
DetectUintstructure fordsizeanddcerpc,ttl,tcpmss,filesize(and template2)Replaces #7150 with
Still TODO:
set_uintin loggers to see if we can easily a new keywords