What package do I need to install to use routing sockets?

I am trying to execute the code specified in Unix Network Programming by Richard Stevens. but I can not 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 do not have a net / if_dl.h header file, and the net / route.h header file does not contain the constants and structures that the code uses.

+6
c linux networking routing
source share
4 answers

This is a BSD-specific API, and linux does not support it. equivalent functionality (not compatible with the source) is provided by netlink socket. "man 7 netlink" should start you, but you probably need to do some porting.

+4
source share

Please note: you do not need to do "libroute" in this folder

See 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 a BSD style routing, just go to .. / intro and write some examples ~!

+5
source share

I am not in a car where I can do it right now, but maybe 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 already installed, the first step will not be needed, and I cannot remember exactly whether the second. In addition, I believe that both package managers work with both the file name and the full path.

Hope this works for you or someone else reading this and you will get an answer!

+3
source share

try copying the if_dl.h file from the network and putting it in / usr / include / net. maybe this works, and maybe he needs other libraries. Maybe my english is not so good. Forgive me.

0
source share

All Articles