dhcp authoritative引數作用

2021-06-19 22:39:30 字數 1818 閱讀 7361

遇到過這樣乙個問題,手機作為熱點,用筆記本去連線 始終處於分配ip階段,而其它大多數機器又是可以的。

最後調查發現是authoritative缺失,導致客戶端長時間等待dhcp分配ip超時。

authoritative;

指定當乙個客戶端試圖獲得乙個不是該dhcp伺服器分配的ip資訊,dhcp將傳送乙個拒絕訊息,而不會等待請求超時。當請求被拒絕,客戶端會重新向當前dhcp傳送ip請求獲得新位址。

當網路中有其他的dhcp伺服器時,加上此引數可以忽略其他dhcp伺服器。

可把此引數加在dhcp.conf配置檔案的第一行。

android手機熱點**層修改:

diff --git a/tethercontroller.cpp b/tethercontroller.cpp

index 743742c..32a0b43 100644

--- a/

tethercontroller.cpp

+++ b/

tethercontroller.cpp

@@ -96,6 +96,8 @@ bool tethercontroller::getipfwdenabled()

+#define tether_start_const_arg 8

+int tethercontroller::starttethering(int num_addrs, struct in_addr* addrs)

- int num_processed_args = 7 + (num_addrs/2) + 1; // 1 null for termination

+ int num_processed_args = tether_start_const_arg + (num_addrs/2) + 1;

char **args = (char **)malloc(sizeof(char *) * num_processed_args);

args[num_processed_args - 1] = null;

args[0] = (char *)"/system/bin/dnsmasq";

args[1] = (char *)"--keep-in-foreground";

args[2] = (char *)"--no-resolv";

args[3] = (char *)"--no-poll";

+ args[4] = (char *)"--dhcp-authoritative";

// todo: pipe through metered status from connservice

- args[4] = (char *)"--dhcp-option-force=43,android_metered";

- args[5] = (char *)"--pid-file";

- args[6] = (char *)"";

+ args[5] = (char *)"--dhcp-option-force=43,android_metered";

+ args[6] = (char *)"--pid-file";

+ args[7] = (char *)"";

- int nextarg = 7;

+ int nextarg = tether_start_const_arg;

for (int addrindex=0; addrindex < num_addrs;) {

char *start = strdup(inet_ntoa(addrs[addrindex++]));

char *end = strdup(inet_ntoa(addrs[addrindex++]));

springcloud Eureka引數作用

服務註冊中心配置 bean類 org.springframework.cloud.netflix.eureka.server.eurekaserverconfigbean eureka.server.enable self preservation false 關閉註冊中心的保護機制,eureka ...

C 陣列作引數傳遞

這幾天自己寫了乙個 d3d畫圖的類 很短 都沒幾行 除錯 沒有錯誤但是執行的時候卻 一直不會出影象不知道怎麼回事 最後只有慢慢改 不用類 和 類 結合起來慢慢除錯 最後 終於找到了 原因 今天一直坐在電腦前 對這短短的幾行 卻就是不知道 錯了 真鬱悶啊 不過最後除錯出來還不錯 c 裡面陣列作引數傳遞...

Qt函式作函式引數

類裡寫個要傳的函式 切記 函式一定要是靜態函式,前面加個static 如類名為 myobj 函式為 static void myfun int a,int b 自定義函式 函式為引數的函式 void fun void hh int,int hh 4,5 或者 void fun void myobj ...