{"id":396,"date":"2025-12-14T11:42:00","date_gmt":"2025-12-14T03:42:00","guid":{"rendered":"https:\/\/www.garfield-blog.top\/?p=396"},"modified":"2025-12-14T11:42:00","modified_gmt":"2025-12-14T03:42:00","slug":"%e3%80%90%e6%ba%90%e7%a0%81%e8%a7%a3%e6%9e%90%e3%80%91hostapd6%e4%bb%8e%e6%89%8b%e6%9c%ba%e8%bf%9e%e6%8e%a5wifi%e7%9c%8bhostapd%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.garfield-blog.top\/?p=396","title":{"rendered":"\u3010\u6e90\u7801\u89e3\u6790\u3011hostapd(6)\u4ece\u624b\u673a\u8fde\u63a5WIFI\u770bhostapd\u6d41\u7a0b"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">wifii\u8fde\u63a5\u8fc7\u7a0b<\/h2>\n\n\n\n<p>\u5728\u5173\u95ed<code>wifi<\/code>\u7684\u5bc6\u7801\uff0c\u8bbe\u7f6e\u4e3a\u5f00\u653e\u8fde\u63a5\uff0c\u76f4\u63a5\u4f7f\u7528\u624b\u673a\u8fde\u63a5\u8def\u7531\u5668<code>wifi<\/code>\uff0c\u8bfb\u53d6<code>hostapd<\/code>\u7684\u65e5\u5fd7\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Tue Apr 22 21:52:30 2025 daemon.info hostapd: wlan1: STA xx:xx:xx:xx:cc:49 IEEE 802.11: authenticated\nTue Apr 22 21:52:30 2025 daemon.info hostapd: wlan1: STA xx:xx:xx:xx:cc:49 IEEE 802.11: associated (aid 1)\nTue Apr 22 21:52:30 2025 daemon.info hostapd: wlan1: STA xx:xx:xx:xx:cc:49 RADIUS: starting accounting session A8FF112BFD77B744<\/code><\/pre>\n\n\n\n<p>\u5f00\u542f<code>wifi<\/code>\u5bc6\u7801\uff0c\u53ef\u4ee5\u770b\u5230\u5f00\u542f<code>wifi<\/code>\u5bc6\u7801\u540e\u4f1a\u660e\u663e\u7684\u591a\u51fa\u4e00\u6761\u5173\u4e8e<code>wpa<\/code>\u7684\u65e5\u5fd7<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Tue Apr 22 23:13:40 2025 daemon.info hostapd: wlan0: STA xx:xx:xx:xx:0a:fb IEEE 802.11: authenticated\nTue Apr 22 23:13:40 2025 daemon.info hostapd: wlan0: STA xx:xx:xx:xx:0a:fb IEEE 802.11: associated (aid 1)\nTue Apr 22 23:13:40 2025 daemon.info hostapd: wlan0: STA xx:xx:xx:xx:0a:fb RADIUS: starting accounting session D7F2785787303561\nTue Apr 22 23:13:40 2025 daemon.info hostapd: wlan0: STA xx:xx:xx:xx:0a:fb WPA: pairwise key handshake completed (RSN)<\/code><\/pre>\n\n\n\n<p><strong>\u4ecesyslog\u4e2d\u770b<\/strong><\/p>\n\n\n\n<p>\u8fd9\u91cc\u7ed3\u5408\u6e90\u7801\u53ef\u4ee5\u770b\u51fa<\/p>\n\n\n\n<p>\u7b2c\u4e00\u6761\u65e5\u5fd7\u5bf9\u5e94\u7684\u51fd\u6570\u662f\uff1a<code>handle_auth_cb<\/code><\/p>\n\n\n\n<p>\u4ece\u8fd9\u91cc\u5207\u5165\u67e5\u770b\u4ee3\u7801\u7684\u51fd\u6570\u8c03\u7528\u6808\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/hostapd\/main.c\n\/\/main\u51fd\u6570\u4e2d\u6ce8\u518c\u4e86hostapd_wpa_event\u51fd\u6570\u4f5c\u4e3a\nmain\n    -&gt;hostapd_wpa_event\n        -&gt;hostapd_mgmt_tx_cb\n            \/\/hostapd\u4e2d\u7684\u53d1\u9001\u7ba1\u7406\u5e27\u7684\u72b6\u6001\u673a\n            -&gt;ieee802_11_mgmt_cb\n                -&gt;handle_auth_cb\n                -&gt;handle_assoc_cb<\/code><\/pre>\n\n\n\n<p>\u4ece\u4ee3\u7801\u8c03\u7528\u6808\u4e0a\u6765\u662f<code>wifi<\/code>\u8fde\u63a5\u540e\u89e6\u53d1\u4e86<code>hostapd<\/code>\u4e2d\u5bf9\u4e8e\u7ba1\u7406\u5e27\u5904\u7406\u7684\u6d41\u7a0b\uff0c\u8fd9\u6bb5\u903b\u8f91\u5f00\u59cb\u6765\u81ea<code>netlink<\/code>\u4e8b\u4ef6\u4e0a\u62a5\uff0c\u7136\u540e\u89e6\u53d1<code>hostapd<\/code>\u4e2d\u7684\u72b6\u6001\u673a\u4e2d\uff0c\u63a5\u7740\u72b6\u6001\u673a\u5904\u7406\u7ba1\u7406\u5e27\u62a5\u6587\u65f6\u6253\u5370\u4e86\u8fd9\u4e9b\u65e5\u5fd7<\/p>\n\n\n\n<p>\u5728\u6e90\u7801\u4e2d\u65b0\u589e\u4e00\u4e9b\u65e5\u5fd7\u540e\u53ef\u4ee5\u5206\u6790\u9053\u66f4\u52a0\u8be6\u7ec6\u7684\u65e5\u5fd7\uff0c\u770b\u5230\u66f4\u52a0\u8be6\u7ec6\u51fd\u6570\u8c03\u7528\u6808<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u521d\u59cb\u5316\u65f6\u6ce8\u518c\u4e86\u5904\u7406netlink\u4e8b\u4ef6\u7684\u56de\u8c03\nwpa_driver_nl80211_init_nl_global\n    \/\/\u5904\u7406netlink\u5168\u5c40\u4e8b\u4ef6\n    -&gt;process_global_event\n        -&gt;do_process_drv_event\n            \/\/\u5904\u7406NL80211_CMD_FRAME_TX_STATUS\u4e8b\u4ef6\n            -&gt;mlme_event\n                -&gt;mlme_event_mgmt_tx_status\n                    \/\/\u8fd9\u91cc\u53ea\u662f\u4e00\u4e2a\u51fd\u6570\u6307\u9488\uff0c\u6700\u7ec8\u662f\u5728main\u51fd\u6570\u4e2d\u6ce8\u518c\n                    -&gt;wpa_supplicant_event<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u7684<code>wpa_supplicant_event<\/code>\u5b9e\u9645\u4e0a\u662f\u5728<code>main<\/code>\u51fd\u6570\u4e2d\u6ce8\u518c\u7684\u51fd\u6570\u56de\u8c03\u5165\u53e3<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">netlink\u521d\u59cb\u5316\u6ce8\u518c<\/h2>\n\n\n\n<p>\u51fd\u6570\u8c03\u7528\u6808<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/hostapd\/main.c\nmain\n    -&gt;hostapd_driver_init\n        -&gt;wpa_drivers&#91;i]-&gt;global_init\n\n\/\/src\/drivers\/driver_nl80211.c\ncosnt struct wpa_driver_ops wpa_driver_nl80211_ops{\n    .global_init = nl80211_global_init\n}\n    -&gt;nl80211_global_init\n        -&gt;wpa_driver_nl80211_init_nl_global<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u6574\u4f53\u6d41\u7a0b\u603b\u7ed3<\/h2>\n\n\n\n<p><strong>\u5bf9\u4e8e\u4e0a\u8ff0\u6d41\u7a0b\u6211\u4eec\u53ef\u4ee5\u603b\u7ed3\u4e3a\u5982\u4e0b\u6d41\u7a0b<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/12\/hostapd\u5904\u7406netlink\u4e8b\u4ef6\u6d41\u7a0b-4096x1498.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"4096\" height=\"1498\" data-original=\"https:\/\/www.garfield-blog.top\/wp-content\/uploads\/2025\/12\/hostapd\u5904\u7406netlink\u4e8b\u4ef6\u6d41\u7a0b-4096x1498.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-397\"  sizes=\"auto, (max-width: 4096px) 100vw, 4096px\" \/><\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>wifii\u8fde\u63a5\u8fc7\u7a0b \u5728\u5173\u95edwifi\u7684\u5bc6\u7801\uff0c\u8bbe\u7f6e\u4e3a\u5f00\u653e\u8fde\u63a5\uff0c\u76f4\u63a5\u4f7f\u7528\u624b\u673a\u8fde\u63a5\u8def\u7531\u5668wifi\uff0c\u8bfb\u53d6hostapd\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-396","post","type-post","status-publish","format-standard","hentry","category-source-code-analysis"],"_links":{"self":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=396"}],"version-history":[{"count":1,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions"}],"predecessor-version":[{"id":398,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=\/wp\/v2\/posts\/396\/revisions\/398"}],"wp:attachment":[{"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.garfield-blog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}