What package do i need to install for using routing sockets?

有些话、适合烂在心里 提交于 2019-12-25 01:12:38

问题


i am trying code given in Unix Network Programming by Richard Stevens. but i am not able to get the code to compile.

here is the source code. http://www.cs.cmu.edu/afs/cs.cmu.edu/academic/class/15213-f00/unpv12e/libroute/

i don't have the header file net/if_dl.h and the net/route.h header file does not include the constants and structures that the code uses.


回答1:


That is a BSD-specific API, and linux doesn't support it. The equivalent functionality (not source-compatible) is provided by the netlink socket family. "man 7 netlink" should get you started, but you're likely going to need to do some porting work.




回答2:


Please note, you DO NOT need to make in that folder "libroute"

See the Document:

cd ../libroute # only if your system supports 4.4BSD style routing sockets
make           # only if your system supports 4.4BSD style routing sockets

cd ../libxti   # only if your system supports XTI
make           # only if your system supports XTI

Linux is not BSD style routing, just go to ../intro and build examples~!




回答3:


I'm not on a machine where I can do this right now, but perhaps I can still help. If your distribution uses yum (e.g. RHEL):

yum provides if_dl.h

Or if you use apt (e.g. Ubuntu/Debian):

sudo apt-get install apt-file
sudo apt-file update
apt-file search if_dl.h

If apt-file is already installed, the first step won't be necessary, and I can't remember for sure if the second is. Also, I believe both package managers work both with filename and with full path.

Hopefully this will work for you or someone else reading this, and you'll get your answer!




回答4:


As explained in https://ubuntu.pkgs.org/16.04/ubuntu-universe-amd64/freebsd-glue_0.2.20_amd64.deb.html just install freebsd-glue deb package:

sudo apt-get install freebsd-glue



回答5:


try to copy a if_dl.h from net , and put it in /usr/include/net . may be it works and maybe it needs other libs. Maybe my English is not so good . Forgive me.



来源:https://stackoverflow.com/questions/5301318/net-if-dl-h-header-file-not-found-in-ubuntu-10-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!