Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can create a wrapper library, which will intercept all calls to <code>setsockopt</code> and will be able to change some parameters. This works if your application have the call to setsockopt. In another case, you can wrap different function, e.g. <code>socket</code> using the same approach. In wrapper of <code>socket</code> you need to create a socket with __socket and then change any parameter you want.</p> <p>Wrapper library must be a dynamic one, with <code>setsockopt</code> function. This function is allowed to be overloaded by glibc. Then, start your programm as follows:</p> <pre><code> LD_PRELOAD=path_to_wrapper_library/libwrap.so ./you_program </code></pre> <p>The library will be injected (linked) into programm and will replace the setsockopt function.</p> <p>This works only with dynamically linked programms (check it with <code>ldd ./you_program</code> - there will be some /lib/*.so if it is dynamically linked).</p> <p>Original function can be called from your code with <code>__</code> prefix: <code>__setsockopt</code> or using <code>dlsym(RTLD_NEXT, "setsockopt");</code>.</p> <p>Some examples (not a setsockopt, but the idea of preload wrapper): <a href="http://scaryreasoner.wordpress.com/2007/11/17/using-ld_preload-libraries-and-glibc-backtrace-function-for-debugging/" rel="nofollow">http://scaryreasoner.wordpress.com/2007/11/17/using-ld_preload-libraries-and-glibc-backtrace-function-for-debugging/</a> or <a href="http://developers.sun.com/solaris/articles/lib_interposers_code.html" rel="nofollow">http://developers.sun.com/solaris/articles/lib_interposers_code.html</a></p> <p>Compile to dynamic library with:</p> <pre><code> gcc wrap.c -fPIC -shared -ldl -o libwrap.so </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload