diff --git a/examples/get.rs b/examples/get.rs index 083f0c7..d3cc6ad 100644 --- a/examples/get.rs +++ b/examples/get.rs @@ -76,11 +76,19 @@ fn send_request(socket: &Socket, message: RtnlMessage) { fn main() { let messages = get_qdiscs(); - let qdiscs = ParseOptions::new().tc(messages).unwrap(); + let qdiscs = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages).unwrap(); println!("length: {}, qdiscs: {:#?}", qdiscs.len(), qdiscs); let messages = get_links(); - let links = ParseOptions::new().links(messages).unwrap(); + let links = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .links(messages).unwrap(); println!("length: {}, links: {:#?}", links.len(), links); let mut messages = Vec::new(); @@ -88,6 +96,10 @@ fn main() { let classes = get_classes(link.index as i32); messages.extend(classes); } - let classes = ParseOptions::new().tc(messages).unwrap(); + let classes = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages).unwrap(); println!("length: {}, classes: {:#?}", classes.len(), classes); } diff --git a/src/tests.rs b/src/tests.rs index aa12513..0138fea 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -11,7 +11,11 @@ use super::*; #[test] fn test_no_queue() { let messages = vec![get_qdiscs()[0].clone()]; - let stats = ParseOptions::new().tc(messages).unwrap(); + let stats = ParseOptions::new() + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages) + .unwrap(); let tc = stats.get(0).unwrap(); // message @@ -33,7 +37,11 @@ fn test_no_queue() { #[test] fn test_mq() { let messages = vec![get_qdiscs()[1].clone()]; - let stats = ParseOptions::new().tc(messages).unwrap(); + let stats = ParseOptions::new() + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages) + .unwrap(); let tc = stats.get(0).unwrap(); // message @@ -56,7 +64,11 @@ fn test_mq() { #[test] fn test_fq_codel() { let messages = vec![get_qdiscs()[2].clone()]; - let stats = ParseOptions::new().tc(messages).unwrap(); + let stats = ParseOptions::new() + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages) + .unwrap(); let tc = stats.get(0).unwrap(); // message @@ -114,7 +126,11 @@ fn test_htb() { let qdiscs = get_qdiscs(); let classes = get_classes(); let messages = vec![qdiscs[3].clone(), classes[0].clone()]; - let tc_stats = ParseOptions::new().tc(messages).unwrap(); + let tc_stats = ParseOptions::new() + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages) + .unwrap(); let tc = tc_stats.get(0).unwrap(); // message @@ -253,7 +269,10 @@ fn test_stats_parse_fail() { NetlinkHeader::default(), NetlinkPayload::InnerMessage(RtnlMessage::NewQueueDiscipline(tc_message)), ); - let tcs = ParseOptions::new().tc(vec![messages]).unwrap(); + let tcs = ParseOptions::new() + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(vec![messages]).unwrap(); let tc = tcs.get(0).unwrap(); assert!(tc.attr.stats2.is_none()); } diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 3eca601..4482336 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -77,7 +77,12 @@ fn send_request(socket: &Socket, message: RtnlMessage) { #[test] fn test_qdiscs() { let messages = get_qdiscs(); - let tcs = ParseOptions::new().tc(messages).unwrap(); + let tcs = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages) + .unwrap(); for tc in tcs { let attr = tc.attr; assert!(!attr.kind.is_empty()); @@ -89,13 +94,22 @@ fn test_qdiscs() { #[test] fn test_link_classes() { let messages = get_links(); - let links = ParseOptions::new().links(messages).unwrap(); + let links = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .links(messages) + .unwrap(); assert!(!links.is_empty()); for link in links { let messages = get_classes(link.index); - let classes = ParseOptions::new().tc(messages); + let classes = ParseOptions::new() + .fail_on_unknown_netlink_message(false) + .fail_on_unknown_attribute(false) + .fail_on_unknown_option(false) + .tc(messages); assert!(classes.is_ok()); } }