FossilOrigin-Name: c514ce830ed293d8b1afb836e3fdc90cb380bc74cf05508f5636772e2db0f7ea
This commit is contained in:
7u83@mail.ru 2014-11-10 23:49:34 +00:00
parent e341d7ec4c
commit 9575d29788
2 changed files with 63 additions and 2 deletions

View File

@ -102,14 +102,64 @@ printf("t6\n");
b+= add_ds_ie(b); b+= add_ds_ie(b);
printf("return ay<aa\n"); printf("return ay<aa\n");
int rates[] = {
2000, 2500, 11000
};
b+= add_supp_rates_ie(b,rates,3);
*len = b-buffer;
return b-buffer; return b-buffer;
} }
add_supp_rates_ie(uint8_t *buf,uint32_t * rates, int num_rates)
{
uint8_t *b = buf;
int len = num_rates;
*b++ = WLAN_EID_SUPP_RATES;
*b++ = len;
int i;
for (i=0; i<len; i++)
{
uint8_t r = rates[i]/500;
r|=0x80;
*b++ = r;
}
return b-buf;
}
dot11_get_beacon_data(struct apdata *ap,struct beacon_data *bd) dot11_get_beacon_data(struct apdata *ap,struct beacon_data *bd)
{ {
bd->head = malloc(256); bd->head = malloc(256);
dot11_get_beacon_head(ap,bd->head,&bd->head_len); // dot11_get_beacon_head(ap,bd->head,&bd->head_len);
uint8_t hf[] = {
0x80, 0x00, 0x00, 0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x7B,
0xCB, 0xA4, 0xF2, 0x50, 0xF0, 0x7B, 0xCB, 0xA4, 0xF2, 0x50, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x21, 0x04,
0x00, 0x09, 0x58, 0x54, 0x61, 0x74, 0x6F, 0x72, 0x74, 0x37, 0x37, 0x01,
0x08, 0x82, 0x84, 0x8B, 0x96, 0x0C, 0x12, 0x18, 0x24
};
printf ("memcpy head %d\n",sizeof(hf));
memcpy(bd->head,hf,sizeof(hf));
printf(" memcpyed\n");
bd->head_len=sizeof(hf);
printf ("done\n");
return 0; return 0;
} }

View File

@ -754,9 +754,20 @@ int start_ap(struct nl_sock *sk)
printf("Get Beacon Data \n"); printf("Get Beacon Data \n");
dot11_get_beacon_data(ap,&bd); dot11_get_beacon_data(ap,&bd);
printf("Got Beaqcon Fata\n"); printf("Got Beaqcon Fata\n");
printf("headlen %d\n",bd.head_len);
NLA_PUT(msg, NL80211_ATTR_BEACON_HEAD, bd.head_len, bd.head); NLA_PUT(msg, NL80211_ATTR_BEACON_HEAD, bd.head_len, bd.head);
printf ("Coter\n");
{
for (int i=0; i<bd.head_len; i++){
printf("%02X ",bd.head[i]);
}
}
printf("Put message 1\n"); printf("Put message 1\n");
/* /*
@ -789,7 +800,7 @@ printf ("Memcoy done\n");
// NLA_PUT(msg, NL80211_ATTR_MAC_ADDRESS,6,rd.mac); // NLA_PUT(msg, NL80211_ATTR_MAC_ADDRESS,6,rd.mac);
NLA_PUT_U32(msg, NL80211_ATTR_DTIM_PERIOD, 1); NLA_PUT_U32(msg, NL80211_ATTR_DTIM_PERIOD, 2);
NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, 0); NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITES_PAIRWISE, 0);
NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, 0); NLA_PUT_U32(msg, NL80211_ATTR_CIPHER_SUITE_GROUP, 0);
NLA_PUT_U32(msg, NL80211_ATTR_AKM_SUITES, 0); NLA_PUT_U32(msg, NL80211_ATTR_AKM_SUITES, 0);