~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/mac80211/tests/elems.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /net/mac80211/tests/elems.c (Version linux-6.11.5) and /net/mac80211/tests/elems.c (Version linux-5.11.22)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * KUnit tests for element parsing                
  4  *                                                
  5  * Copyright (C) 2023-2024 Intel Corporation      
  6  */                                               
  7 #include <kunit/test.h>                           
  8 #include "../ieee80211_i.h"                       
  9                                                   
 10 MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);     
 11                                                   
 12 static void mle_defrag(struct kunit *test)        
 13 {                                                 
 14         struct ieee80211_elems_parse_params pa    
 15                 .link_id = 12,                    
 16                 .from_ap = true,                  
 17                 .mode = IEEE80211_CONN_MODE_EH    
 18         };                                        
 19         struct ieee802_11_elems *parsed;          
 20         struct sk_buff *skb;                      
 21         u8 *len_mle, *len_prof;                   
 22         int i;                                    
 23                                                   
 24         skb = alloc_skb(1024, GFP_KERNEL);        
 25         KUNIT_ASSERT_NOT_NULL(test, skb);         
 26                                                   
 27         if (skb_pad(skb, skb_tailroom(skb))) {    
 28                 KUNIT_FAIL(test, "failed to pa    
 29                 return;                           
 30         }                                         
 31                                                   
 32         /* build a multi-link element */          
 33         skb_put_u8(skb, WLAN_EID_EXTENSION);      
 34         len_mle = skb_put(skb, 1);                
 35         skb_put_u8(skb, WLAN_EID_EXT_EHT_MULTI    
 36                                                   
 37         put_unaligned_le16(IEEE80211_ML_CONTRO    
 38                            skb_put(skb, 2));      
 39         /* struct ieee80211_mle_basic_common_i    
 40         skb_put_u8(skb, 7); /* includes len fi    
 41         skb_put_data(skb, "\x00\x00\x00\x00\x0    
 42                                                   
 43         /* with a STA profile inside */           
 44         skb_put_u8(skb, IEEE80211_MLE_SUBELEM_    
 45         len_prof = skb_put(skb, 1);               
 46         put_unaligned_le16(IEEE80211_MLE_STA_C    
 47                            parse_params.link_i    
 48                            skb_put(skb, 2));      
 49         skb_put_u8(skb, 1); /* fake sta_info_l    
 50         /* put a bunch of useless elements int    
 51         for (i = 0; i < 20; i++) {                
 52                 skb_put_u8(skb, WLAN_EID_SSID)    
 53                 skb_put_u8(skb, 20);              
 54                 skb_put(skb, 20);                 
 55         }                                         
 56                                                   
 57         /* fragment STA profile */                
 58         ieee80211_fragment_element(skb, len_pr    
 59                                    IEEE80211_M    
 60         /* fragment MLE */                        
 61         ieee80211_fragment_element(skb, len_ml    
 62                                                   
 63         parse_params.start = skb->data;           
 64         parse_params.len = skb->len;              
 65         parsed = ieee802_11_parse_elems_full(&    
 66         /* should return ERR_PTR or valid, not    
 67         KUNIT_EXPECT_NOT_NULL(test, parsed);      
 68                                                   
 69         if (IS_ERR_OR_NULL(parsed))               
 70                 goto free_skb;                    
 71                                                   
 72         KUNIT_EXPECT_NOT_NULL(test, parsed->ml    
 73         KUNIT_EXPECT_EQ(test,                     
 74                         parsed->ml_basic_len,     
 75                         2 /* control */ +         
 76                         7 /* common info */ +     
 77                         2 /* sta profile eleme    
 78                         3 /* sta profile heade    
 79                         20 * 22 /* sta profile    
 80                         2 /* sta profile fragm    
 81         KUNIT_EXPECT_NOT_NULL(test, parsed->pr    
 82         KUNIT_EXPECT_EQ(test,                     
 83                         parsed->sta_prof_len,     
 84                         3 /* sta profile heade    
 85                         20 * 22 /* sta profile    
 86                                                   
 87         kfree(parsed);                            
 88 free_skb:                                         
 89         kfree_skb(skb);                           
 90 }                                                 
 91                                                   
 92 static struct kunit_case element_parsing_test_    
 93         KUNIT_CASE(mle_defrag),                   
 94         {}                                        
 95 };                                                
 96                                                   
 97 static struct kunit_suite element_parsing = {     
 98         .name = "mac80211-element-parsing",       
 99         .test_cases = element_parsing_test_cas    
100 };                                                
101                                                   
102 kunit_test_suite(element_parsing);                
103                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php