Skip to content
Advertisement

Tag: sockets

get process inode using netlink

I want to try and correlate an IP packet (using libpcap) to a process. I have had some limited success using the relevant /proc/net/ files but found that on some of the machines i’m using, this file can be many thousands of lines and parsing it is not efficient (caching has alleviated some performance problems). I read that using sock_diag

IPv6 example program fails on connect()

IPv6 example program fails on connect() I arranged the server argument to be evaluated by inet_pton() if numeric, otherwise, it goes through getaddrinfo(). inet_pton() sets up the address and it works. getaddrinfo() does not, apparently, it dies in connect (hangs up). The example program is a simple web page fetch and print (not https). I used the www.example.com server to

How to resolve “setsockopt(3, SOL_SOCKET, SO_MARK, [10], 4) = -1 EPERM” Operation denied for none root users

I got two network interfaces (ethernet and wlan). Now I found a little script on github (https://github.com/Intika-Linux-Firewall/App-Route-Jail) which seems to allow me to route specific applications through the none default gateway to loadbalance the traffic a little bit. The script is using the following call: setsockopt(sd, SOL_SOCKET, SO_MARK, &mark, sizeof(mark)); As I found out via an strace I got: ‘-1

C socket programming errors

It’s been an hour since I started looking for THE error. I just started C sockets. The program exits with code -1 after printing “Error 1 connection error”. The server in online, it’s a netcat server. Where did I messed up ? Answer Due to operator precedence, the expression is actually equal to That is, you assign the result of

Advertisement