tracedump
single application IP packet sniffer
Functions

inject.c File Reference

#include <stdbool.h>
#include <stdint.h>
#include <sys/socket.h>
#include <linux/net.h>
#include <netinet/in.h>
#include <stdarg.h>
#include "tracedump.h"

Go to the source code of this file.

Functions

int32_t inject_socketcall (struct tracedump *td, struct pid *sp, uint32_t sc_code,...)
 Inject socketcall() into running process.
void inject_escape_socketcall (struct tracedump *td, struct pid *sp)
 Circumvent an on-going socketcall.
void inject_restore_socketcall (struct tracedump *td, struct pid *sp)
 Cancel inject_escape_socketcall() effects.

Function Documentation

void inject_escape_socketcall ( struct tracedump td,
struct pid sp 
)

Circumvent an on-going socketcall.

Implemented by calling socketcall with an invalid subcode, which will result in an -EINVAL. This will put the traced process in normal state, ie. executing the code under EIP, which is required for the inject_*() functions to work properly.

Definition at line 133 of file inject.c.

Referenced by handle_socket().

void inject_restore_socketcall ( struct tracedump td,
struct pid sp 
)

Cancel inject_escape_socketcall() effects.

This function will execute the whole socketcall until it finishes

Definition at line 151 of file inject.c.

Referenced by handle_socket().

int32_t inject_socketcall ( struct tracedump td,
struct pid sp,
uint32_t  sc_code,
  ... 
)

Inject socketcall() into running process.

Supports variable list of arguments to socketcall(), each may be of different kind

Parameters:
tdtracedump root
pidprocess id
sc_codesocketcall subcode (see include/linux/net.h)
varg1enum arg_type
varg2uint32_t: memory size or a value
varg3OPTIONAL void *: address of the memory
...
1,0,1
Returns:
socketcall() return code

Definition at line 16 of file inject.c.

Referenced by inject_autobind(), inject_getsockname_in(), and inject_getsockopt().

 All Data Structures Files Functions Variables Enumerations Enumerator Defines