c - IFF_UP 和 IFF_RUNNING 有什么区别?

标签 c linux network-programming

这两个标志经常一起设置。它们有什么区别?

最佳答案

来自 Linux Device Drivers 3 :

IFF_UP This flag is read-only for the driver. The kernel turns it on when the interface is active and ready to transfer packets.

...

IFF_RUNNING

This flag indicates that the interface is up and running. It is mostly present for BSD compatibility; the kernel makes little use of it. Most network drivers need not worry about IFF_RUNNING.

再深入一点,似乎有一个显着差异:

IFF_RUNNING 应该反射(reflect)网络接口(interface)上的操作状态,而不是其管理状态。举个例子,一个以太网接口(interface)可能被管理员UP(例如ifconfig eth0 up),但它不会被认为是可操作的(即RUNNING 根据 RFC2863)如果电缆未插入。

关于c - IFF_UP 和 IFF_RUNNING 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11679514/

相关文章:

c - 如何在 Linux 内核 v3.2 中创建一个简单的 sysfs 类属性

我们可以区分变量和指针变量吗

c - 出现错误,C 中的 "conflicting types for ' _'"。很抱歉再次问这个问题,我要么不理解,要么有其他问题

c - 接收网站的简单套接字程序(断言错误)

c - 为什么(以及何时)我需要在 sizeof 之后使用括号?

linux - 这可以排列吗?

java - JAVA中发送ctrl+c关闭ping请求

c - 我如何检查c程序中的目录是否存在并在不存在时创建它

linux - 如果网络连接断开,读取驻留在 smb 装载上的文件的系统调用将永远挂起?

c++ - 通过网络连接从 C# 向非托管 C++ 发送数据