|
1 | 1 | // SPDX-License-Identifier: MIT |
2 | 2 |
|
3 | | -use std::mem::size_of; |
4 | | -use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; |
| 3 | +use std::{ |
| 4 | + mem::size_of, |
| 5 | + net::{IpAddr, Ipv4Addr, Ipv6Addr}, |
| 6 | +}; |
5 | 7 |
|
6 | | -use anyhow::Context; |
7 | | -use byteorder::{ByteOrder, NativeEndian}; |
8 | | -use netlink_packet_utils::{ |
9 | | - nla::{DefaultNla, Nla, NlaBuffer}, |
10 | | - parsers::{parse_string, parse_u32}, |
11 | | - DecodeError, Emitable, Parseable, |
| 8 | +use netlink_packet_core::{ |
| 9 | + emit_u32, parse_string, parse_u32, DecodeError, DefaultNla, Emitable, |
| 10 | + ErrorContext, Nla, NlaBuffer, Parseable, |
12 | 11 | }; |
13 | 12 |
|
14 | 13 | use crate::address::{AddressFlags, CacheInfo, CacheInfoBuffer}; |
@@ -84,9 +83,7 @@ impl Nla for AddressAttribute { |
84 | 83 | buffer[..string.len()].copy_from_slice(string.as_bytes()); |
85 | 84 | buffer[string.len()] = 0; |
86 | 85 | } |
87 | | - Self::Flags(ref value) => { |
88 | | - NativeEndian::write_u32(buffer, value.bits()) |
89 | | - } |
| 86 | + Self::Flags(ref value) => emit_u32(buffer, value.bits()).unwrap(), |
90 | 87 | Self::CacheInfo(ref attr) => attr.emit(buffer), |
91 | 88 | Self::Other(ref attr) => attr.emit_value(buffer), |
92 | 89 | } |
|
0 commit comments