File tree Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Expand file tree Collapse file tree 2 files changed +5
-19
lines changed Original file line number Diff line number Diff line change 1919        run : | 
2020          rustup override set stable 
2121          rustup update stable 
22-           rustup component add llvm-tools-preview 
2322
24- name : Install cargo-llvm-cov 
25-         uses : taiki-e/install-action@cargo-llvm-cov 
26- 
27-       - name : Test and Generate code coverage 
28-         run : cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info 
29-       - name : Upload coverage to Codecov 
30-         uses : codecov/codecov-action@v3 
31-         with :
32-           files : lcov.info 
33-           fail_ci_if_error : true 
23+ name : Test 
24+         run : cargo test 
Original file line number Diff line number Diff line change 88
99use  std:: { net:: Ipv4Addr ,  time:: Duration } ; 
1010
11- use  byteorder:: { ByteOrder ,  NetworkEndian } ; 
12- use  netlink_packet_core:: { NetlinkMessage ,  NetlinkPayload } ; 
11+ use  netlink_packet_core:: { parse_ip,  NetlinkMessage ,  NetlinkPayload } ; 
1312use  netlink_packet_netfilter:: { 
1413    constants:: * , 
1514    nflog:: { 
@@ -103,12 +102,8 @@ fn main() {
103102
104103                    for  nla in  get_packet_nlas ( & rx_packet)  { 
105104                        if  let  PacketNla :: Payload ( payload)  = nla { 
106-                             let  src = Ipv4Addr :: from ( NetworkEndian :: read_u32 ( 
107-                                 & payload[ 12 ..] , 
108-                             ) ) ; 
109-                             let  dst = Ipv4Addr :: from ( NetworkEndian :: read_u32 ( 
110-                                 & payload[ 16 ..] , 
111-                             ) ) ; 
105+                             let  src = parse_ip ( & payload[ 12 ..16 ] ) . unwrap ( ) ; 
106+                             let  dst = parse_ip ( & payload[ 16 ..20 ] ) . unwrap ( ) ; 
112107                            println ! ( "Packet from {} to {}" ,  src,  dst) ; 
113108                            break ; 
114109                        } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments