wide-dhcp6c(3)

截止目前为止,还能够正常使用wide-dhcp6c。 原因,暂时找不到原因在哪里。 只有通过打印日志来看。 一直怀疑是配置文件出错了,但是也没看到过一个可以使用的配置文件,dhcp6c.conf. 都是example等等,附加e文和缩写。 虽然看过,也是很粗糙的理解其意思。


先修改一下cftoken.l,将yywrap在cfdebug_print函数之前补上,这样make clean ,再make的时候,就不用再生成的cftoken.c 里面加了。

int yywrap()
{
	return 1;
}

static void
cfdebug_print(w, t, l)
	char *w, *t;
	int l;
{
	if (w) {
		dprintf(LOG_DEBUG, FNAME,
		    "<%d>%s [%s] (%d)", yy_start, w, t, l);
	} else {
		dprintf(LOG_DEBUG, FNAME,
		    "<%d>[%s] (%d)", yy_start, t, l);
	}
}


另外将YYDEBUG这个宏打开,设置为1。 同时将全局变量yydebug 也在最开始的地方赋值为1. 这样就可以看到过程中哪里分析错误了。

root@vc0718t-evm:/usrfs# ./dhcp6c -c ./dhcp6c.conf -Df eth0
Jan/01/2000 06:11:10: get_duid: extracted an existing DUID from /usr/share/dhcp6c_duid: 00:01:00:01:00:00:3a:35:00:16:8e:a7:8c:f6
Jan/01/2000 06:11:10: dhcp6_ctl_authinit: failed to open /usr/share/dhcp6cctlkey: No such file or directory
Jan/01/2000 06:11:10: client6_init: failed initialize control message authentication282
Jan/01/2000 06:11:10: client6_init: skip opening control port375
5
should !
Starting parse
no should !
Entering state 0
Reducing stack by rule 1 (line 149):
-> $$ = nterm statements ()
Stack now 0
Entering state 1
Reading a token: Next token is token INTERFACE ()
Shifting token INTERFACE ()
Entering state 3
Reading a token: Next token is token IFNAME ()
Shifting token IFNAME ()
Entering state 20
Reading a token: Next token is token BCL ()
Shifting token BCL ()
Entering state 40
Reducing stack by rule 36 (line 486):
-> $$ = nterm declarations ()
Stack now 0 1 3 20 40
Entering state 62
Reading a token: Next token is token SEND ()
Shifting token SEND ()
Entering state 87
Reading a token: Next token is token IA_NA ()
Shifting token IA_NA ()
Entering state 126
Reading a token: Next token is token NUMBER ()
Shifting token NUMBER ()
Entering state 185
Reducing stack by rule 55 (line 643):
   $1 = token IA_NA ()
   $2 = token NUMBER ()
-> $$ = nterm dhcpoption ()
Stack now 0 1 3 20 40 62 87
Entering state 142
Reading a token: Next token is token EOS ()
Reducing stack by rule 50 (line 605):
   $1 = nterm dhcpoption ()
-> $$ = nterm dhcpoption_list ()
Stack now 0 1 3 20 40 62 87
Entering state 143
Next token is token EOS ()
Shifting token EOS ()
Entering state 189
Reducing stack by rule 38 (line 505):
   $1 = token SEND ()
   $2 = nterm dhcpoption_list ()
   $3 = token EOS ()
-> $$ = nterm declaration ()
Stack now 0 1 3 20 40 62
Entering state 98
Reducing stack by rule 37 (line 487):
   $1 = nterm declarations ()
   $2 = nterm declaration ()
-> $$ = nterm declarations ()
Stack now 0 1 3 20 40
Entering state 62
Reading a token: Next token is token SEND ()
Shifting token SEND ()
Entering state 87
Reading a token: Next token is token IA_PD ()
Shifting token IA_PD ()
Entering state 125
Reading a token: Next token is token NUMBER ()
Shifting token NUMBER ()
Entering state 184
Reducing stack by rule 54 (line 635):
   $1 = token IA_PD ()
   $2 = token NUMBER ()
-> $$ = nterm dhcpoption ()
Stack now 0 1 3 20 40 62 87
Entering state 142
Reading a token: Next token is token EOS ()
Reducing stack by rule 50 (line 605):
   $1 = nterm dhcpoption ()
-> $$ = nterm dhcpoption_list ()
Stack now 0 1 3 20 40 62 87
Entering state 143
Next token is token EOS ()
Shifting token EOS ()
Entering state 189
Reducing stack by rule 38 (line 505):
   $1 = token SEND ()
   $2 = nterm dhcpoption_list ()
   $3 = token EOS ()
-> $$ = nterm declaration ()
Stack now 0 1 3 20 40 62
Entering state 98
Reducing stack by rule 37 (line 487):
   $1 = nterm declarations ()
   $2 = nterm declaration ()
-> $$ = nterm declarations ()
Stack now 0 1 3 20 40
Entering state 62
Reading a token: Next token is token SEND ()
Shifting token SEND ()
Entering state 87
Reading a token: Next token is token DNS_SERVERS ()
Shifting token DNS_SERVERS ()
Entering state 128
Reducing stack by rule 58 (line 667):
   $1 = token DNS_SERVERS ()
-> $$ = nterm dhcpoption ()
Stack now 0 1 3 20 40 62 87
Entering state 142
Reading a token: Next token is token COMMA ()
Shifting token COMMA ()
Entering state 188
Reading a token: Next token is token DNS_NAME ()
Shifting token DNS_NAME ()
Entering state 129
Reducing stack by rule 59 (line 675):
   $1 = token DNS_NAME ()
-> $$ = nterm dhcpoption ()
Stack now 0 1 3 20 40 62 87 142 188
Entering state 142
Reading a token: Next token is token EOS ()
Reducing stack by rule 50 (line 605):
   $1 = nterm dhcpoption ()
-> $$ = nterm dhcpoption_list ()
Stack now 0 1 3 20 40 62 87 142 188
Entering state 215
Reducing stack by rule 51 (line 609):
   $1 = nterm dhcpoption ()
   $2 = token COMMA ()
   $3 = nterm dhcpoption_list ()
-> $$ = nterm dhcpoption_list ()
Stack now 0 1 3 20 40 62 87
Entering state 143
Next token is token EOS ()
Shifting token EOS ()
Entering state 189
Reducing stack by rule 38 (line 505):
   $1 = token SEND ()
   $2 = nterm dhcpoption_list ()
   $3 = token EOS ()
-> $$ = nterm declaration ()
Stack now 0 1 3 20 40 62
Entering state 98
Reducing stack by rule 37 (line 487):
   $1 = nterm declarations ()
   $2 = nterm declaration ()
-> $$ = nterm declarations ()
Stack now 0 1 3 20 40
Entering state 62
Reading a token: Next token is token ECL ()
Shifting token ECL ()
Entering state 96
Reading a token: Next token is token EOS ()
Shifting token EOS ()
Entering state 154
Reducing stack by rule 11 (line 166):
   $1 = token INTERFACE ()
   $2 = token IFNAME ()
   $3 = token BCL ()
   $4 = nterm declarations ()
   $5 = token ECL ()
   $6 = token EOS ()
-> $$ = nterm interface_statement ()
Stack now 0 1
Entering state 12
Reducing stack by rule 3 (line 155):
   $1 = nterm interface_statement ()
-> $$ = nterm statement ()
Stack now 0 1
Entering state 11
Reducing stack by rule 2 (line 151):
   $1 = nterm statements ()
   $2 = nterm statement ()
-> $$ = nterm statements ()
Stack now 0
Entering state 1
Reading a token: Next token is token STRING ()
Error: popping nterm statements ()
Stack now 0
Cleanup: discarding lookahead token STRING ()
Stack now 0
Jan/01/2000 06:11:10: main: failed to parse configuration file 230

执行程序后,可以看到貌似是 下一步的分析出错,reading a token: Next token is STRING(),看样子是这里分析文件出错了。

那么还是配置文件的问题。。。

待续


配置出来了,配置文件其实也很简单。e文不太好,看了半天很多的看了也似懂非懂的。

然后参考了

www.infradead.org/~tgr/libnl/

上面写的一大堆东西,也没看懂多少。

就是dhcp6c.conf简单的配置文件如下,原先的时候添加几个其他的配置信息,结果反而一大堆错误

interface eth0 {
	send ia-na 0;
};

id-assoc na{
};
然后从日志信息来看

Jan/01/2000 08:41:46: dhcp6_get_options: get DHCP option status code, len 2
Jan/01/2000 08:41:46:   status code: success
Jan/01/2000 08:41:46: dhcp6_get_options: get DHCP option DNS, len 16
Jan/01/2000 08:41:46: dhcp6_get_options: get DHCP option SIP server address, len 64
Jan/01/2000 08:41:46: dhcp6_get_options: get DHCP option NTP server, len 48
Jan/01/2000 08:41:46: client6_recvreply: status code: success
Jan/01/2000 08:41:46: info_printf: nameserver[0] 2001:db8:3333::39cc:fe88:d094
Jan/01/2000 08:41:46: info_printf: NTP server[0] 2000::200
Jan/01/2000 08:41:46: info_printf: NTP server[1] 2000::201
Jan/01/2000 08:41:46: info_printf: NTP server[2] 2000::202
Jan/01/2000 08:41:46: info_printf: SIP server address[0] 2000::300
Jan/01/2000 08:41:46: info_printf: SIP server address[1] 2000::302
Jan/01/2000 08:41:46: info_printf: SIP server address[2] 2000::303
Jan/01/2000 08:41:46: info_printf: SIP server address[3] 2000::304
Jan/01/2000 08:41:46: get_ia: make an IA: NA-0
Jan/01/2000 08:41:46: update_address: create an address 2001:db8:3333::39cc:0:1007 pltime=86400, vltime=86400
Jan/01/2000 08:41:46: ifaddrconf: add an address 2001:db8:3333::39cc:0:1007/128 on eth0
Jan/01/2000 08:41:46: dhcp6_remove_event: removing an event on eth0, state=REQUEST


以及敲击iconfig,地址都是配置上了。看来兜了好几天的空闲时间。这边用的 是美国netgear作为ipv6分配的服务器。 看样子是ok的 。。。。

你可能感兴趣的:(嵌入式,c)