hostapd upstream

因緣際會, 最近剛好需要做 hostapd 的 upstream, 順便記錄一下.

hostapd Linux 上是 wifi 用來啟動 AP mode 的工具. - https://w1.fi/hostapd/
也有相關的 git 和社群在維護.
https://w1.fi/cgit/hostap/

這邊也有相關 hostapd 的文件可以參考:



之前有做過 Linux kernel upstream, 參考這個來做做看.

1. git clone git://w1.fi/hostap.git

2. 提交修改
    git add .
    git commit -s

   hostapd patch 可以參考 git log 寫法
3. 製作 patch
git format-patch origin --stdout > ../myhostapd.patch

4. 發送 patch
    (0) 發送前 git 設定一下
          $ git config --global user.name "xxxx"
      $ git config --global user.email xxxx@example.com

    (1) 發送前測試 email
          echo -e "Subject: Test Mail \r\n\r\nThis is a test mail" | msmtp --debug --from=default -t <gmail account>

           gmail 的話 Google 帳號要開啟 低安全性應用程式 存取權

    (2)
    git send-email \   
    --smtp-server /usr/bin/msmtp \   
    --from my@gmail.com \   
    --to hostap@lists.infradead.org \   
  --cc my@gmail.com ./myhostapd.patch

查看:

    官網的 mailing list - http://lists.infradead.org/mailman/listinfo/hostap

    patchwork - https://patchwork.ozlabs.org/project/hostap/list/

    例如我這次的 patch :
           https://patchwork.ozlabs.org/patch/1163800/
           接受上到 git 了
           https://w1.fi/cgit/hostap/commit/?id=d9286d099797186eb30870323da529c0284197bd

          Jouni Malinen 人很好, 還幫忙指導了一下英文
When we set "channel=0" in hostapd.conf to enable ACS function,
and set the a wrong channel list, e.g. chanlist=222-999 on purpose,
hostapd will would still start ACS process to compute ideal channel,
even when there is are no available channels in this setting.
with such configuration

Though there is no problem since hostapd fails to initialize
interface, it spends time and may cause some problem to tell if
the setting is correct at the first. going through the scan and the
debug log entries may make it more difficult to tell what was behind
the failure

Thus would like to suggest the following patch, we can check if
there is are any available channels in the function acs_request_scan()
at the first, and return -1 if no available channel, then it will
fail at acs_init(), without doing ACS computation. It will show
the following in the log:
    Could not select hw_mode and channel. (-3)
    wlan0: interface state UNINITIALIZED->DISABLED

Then we can know the setting is incorrect at the first at already in
hostapd_select_hw_mode(), instead of waiting for scan callback
function to know if the setting is ok for ACS or not. It This can save
time and help to tell if the setting is correct at the initial
function at the first. This will also allow the ENABLE control interface
command to return FAIL when adding an interface dynamically.




留言

熱門文章