一个基于debian的嵌入式运行环境 daemon模式下运行一个dhcpcd进程,获取ip,下发路由等都ok。netlink能够收到地址add和路由add等网络事件 此时通过system()方法kill掉进程,dhcpcd无法正确的发送routedel等事件到netlink,可以捕捉到sock发送错误,返回errno为no such prosess 然而发送的套接字打印出来是没有变过的……dhcpc运行的时候也是用的同一个sock,kill的时候就no such process了………… 更神奇
感谢帮忙出主意哈
在上面那个回复里
The most common cause for the message I've seen is that you're trying to route via a path that is not known to the host. For example, LAN is 192.168.56.100 and WAN is 10.0.3.15. ip route add 8.8.8.8/32 via 192.168.6.1 results in RTNETLINK answers: No such process because 192.168.6.1 is not known to the host.
路由 not known to the host可能是指这个gateway地址无法匹配到本地直连网段。但是我这里是通过dhcpc获取ip,肯定是直连路由的,并且删除的是默认路由0.0.0.0/0
同时因为shell下kill没有问题,从log看也是先删除路由失败再由系统通知地址删除的 应该不是这个原因
The most common cause for the message I've seen is that you're trying to route via a path that is not known to the host. For example, LAN is 192.168.56.100 and WAN is 10.0.3.15. ip route add 8.8.8.8/32 via 192.168.6.1 results in RTNETLINK answers: No such process because 192.168.6.1 is not known to the host.