2510|0

3836

帖子

19

TA的资源

纯净的硅(中级)

楼主
 

X86学习之第一章以太网配置 [复制链接]

本帖最后由 paulhyde 于 2014-9-15 08:56 编辑

  1. 1.3.3 Network scripts
  2. Using the network scripts
  3. To be able to access the network functions, you need to include the necessary shell scripts by running:
  4. . /etc/functions.sh # common functions
  5. include /lib/network # include /lib/network/*.sh
  6. scan_interfaces # read and parse the network config
  7. Some protocols, such as PPP might change the configured interface names at run time (e.g. eth0 => ppp0 for PPPoE). That’s why you have to run scan_interfaces instead of reading the values from the config directly. After running scan_interfaces, the ’ifname’ option will always contain the effective interface name (which is used for IP traffic) and if the physical device name differs from it, it will be stored in the ’device’ option. That means that running config_get lan ifname after scan_interfaces might not return the same result as running it before.
  8. After running scan_interfaces, the following functions are available:
  9. find_config interface
  10. looks for a network configuration that includes the specified network interface.
  11. setup_interface interface [config] [protocol]
  12. will set up the specified interface, optionally overriding the network configuration name or the protocol that it uses.
  13. Writing protocol handlers
  14. You can add custom protocol handlers by adding shell scripts to /lib/network. They provide the following two shell functions:
  15. scan_() {
  16. local config="$1"
  17. # change the interface names if necessary
  18. }
  19. setup_interface_() {
  20. local interface="$1"
  21. local config="$2"
  22. # set up the interface
  23. }
  24. scan_protocolname is optional and only necessary if your protocol uses a custom device, e.g. a tunnel or a PPP device
复制代码
by 南京老练

 

此帖出自电子竞赛论坛
点赞 关注
 
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表