wide-dhcpv6 使用(2)


上一篇编译好的文件,有dhcp6c,dhcp6s,dhcp6replay等几个可执行文件。

这边取其所需,即dhcp6c到开发板上在执行。

使用命令./dhpc6c,随即弹出了提示框

usage: dhcp6c [-c configfile] [-dDfi] [-p pid-file] interface [interfaces...]

这是些什么参数,不是很懂。

到之前prefix指定的安装路径/man/man8.

 敲击命令,即可查看这些参数的说明了。man -l dhcp6c.8 

DESCRIPTION
     dhcp6c works as a DHCPv6 client and gets information from DHCPv6 servers to configure the specified
     interface.  Multiple interfaces can be specified separated by spaces or tabs, in which case dhcp6c
     will work on all the interfaces simultaneously.

     The command line options are:

     -c configfile
             Use configfile as the configuration file.

     -d      Print debugging messages.

     -D      Even more debugging information is printed.

     -f      Foreground mode (useful when debugging).  Although dhcp6c usually prints warning, debug鈥[m
             ging, or error messages to syslog(8), it prints the messages to standard error if this
             option is specified.

     -i      Info-req mode.  In this mode, stateless DHCPv6 is executed with the folllowing configura鈥[m
             tion, and the obtained info is written to stdout.  After this output, dhcp6c is terminated.
             (suits for a use in shell-script etc).

              interface (interface given in the argument) {
                     information-only;
                     script (a script which displays the received information to stdout);
              };

             Since the configuration is internally generated, you cannot provide a configuration in this
             mode.  If you want to have different actions for the stateless DHCPv6 information, you
             should write an appropriate configuration and invoke dhcp6c without this option.

-c  指的是配置文件

-d  打印信息

-f    后台运行

-i   自己看e文吧。


这边需要dhcp配置文件,说明你的要求是怎样的。

这边配置的dhcp6c.conf如下

interface if {
        send ia-na 1;
        send ia-pd 0;
        send domain-name-servers,domain-name;
};

最后用命令

./dhcp6c -c dhcp6c.conf -fD interface eth0


反正是没有预期的结果就是了。日志打印如下

Jan/01/2000 02:57:49: gethwid: found an interface eth0 for DUID
Jan/01/2000 02:57:49: get_duid: generated a new DUID: 00:01:00:01:00:00:29:ad:00:16:8e:a7:8c:f6
Jan/01/2000 02:57:49: get_duid: failed to open DUID file for save,/var/db/dhcp6c_duid
Jan/01/2000 02:57:49: client6_init: failed to get a DUID
就是duid不能被保存。这个路径是
/var/db/dhcp6c_duid
很奇怪的,哪里配置了这个路径? 代码里头定义的路径是
#define DUID_FILE LOCALDBDIR   "/dhcp6c_duid"

那么这个LOCALDBDIR    我没有百度到。 后面考虑了一下,应该是Makefile里头传进去的。

看了一下,还真是


localdbdir= /var/db
user= bin
group= bin

CFLAGS=	-g -O2 -I$(srcdir) -D_GNU_SOURCE -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_GETADDRINFO=1 -DHAVE_GETNAMEINFO=1 -DHAVE_GETIFADDRS=1 -DHAVE_IF_NAMETOINDEX=1 -DHAVE_DAEMON=1 -DHAVE_WARNX=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYSLOG_H=1 -DHAVE_UNISTD_H=1 -DHAVE_IFADDRS_H=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_STRUCT_TM_TM_ZONE=1 -DHAVE_TM_ZONE=1 -DHAVE_SIG_ATOMIC_T=1 -DGETPGRP_VOID=1 -DRETSIGTYPE=void -DHAVE_MKTIME=1 -DHAVE_SELECT=1 -DHAVE_SOCKET=1 -DHAVE_ANSI_FUNC=1 -DHAVE_TAILQ_FOREACH_REVERSE_OLD=1 -DHAVE_STDARG_H=1  -DSYSCONFDIR=\"${sysconfdir}\" \
	-DLOCALDBDIR=\"${localdbdir}\"

还真是,看到了没,在CFLAGS中,有一栏-DLOCALDBDIR 赋值的函数。 有点坑。

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