s2i_dump improvements
This commit is contained in:
parent
cd1d1a031f
commit
3c9de865d1
22
Makefile
22
Makefile
@ -175,27 +175,9 @@ tools/syscall-dump.so.$(HOST_ARCH): tools/syscall-dump.c
|
|||||||
.PHONY: s2i_dump
|
.PHONY: s2i_dump
|
||||||
s2i_dump: tools/syscall-dump.so
|
s2i_dump: tools/syscall-dump.so
|
||||||
if test -z "$(SATIP_HOST)"; then echo "Define SATIP_HOST variable"; exit 1; fi
|
if test -z "$(SATIP_HOST)"; then echo "Define SATIP_HOST variable"; exit 1; fi
|
||||||
scp tools/syscall-dump.so \
|
cd firmware/initramfs && tar cvzf ../fw.tgz --owner=root --group=root *
|
||||||
tools/s2i-dump.sh \
|
scp tools/syscall-dump.so tools/s2i-dump.sh firmware/fw.tgz \
|
||||||
firmware/initramfs/root/s2i.bin \
|
|
||||||
firmware/initramfs/usr/lib/libuuid.so.1 \
|
|
||||||
firmware/initramfs/usr/lib/libcurl.so.4 \
|
|
||||||
firmware/initramfs/usr/lib/liboauth.so.0 \
|
|
||||||
firmware/initramfs/usr/lib/libsoup-2.4.so.1 \
|
|
||||||
firmware/initramfs/usr/lib/libgio-2.0.so.0 \
|
|
||||||
firmware/initramfs/usr/lib/libgobject-2.0.so.0 \
|
|
||||||
firmware/initramfs/usr/lib/libgmodule-2.0.so.0 \
|
|
||||||
firmware/initramfs/usr/lib/libgthread-2.0.so.0 \
|
|
||||||
firmware/initramfs/usr/lib/libssl.so.1.0.0 \
|
|
||||||
firmware/initramfs/usr/lib/libcrypto.so.1.0.0 \
|
|
||||||
firmware/initramfs/usr/lib/libxml2.so.2 \
|
|
||||||
root@$(SATIP_HOST):/usr/lib
|
|
||||||
scp firmware/initramfs/root/default_sl.json \
|
|
||||||
firmware/initramfs/root/*.txt \
|
|
||||||
firmware/initramfs/root/*.m3u \
|
|
||||||
root@$(SATIP_HOST):/root
|
root@$(SATIP_HOST):/root
|
||||||
scp firmware/initramfs/usr/local/bin/mdnsd root@$(SATIP_HOST):/usr/bin
|
|
||||||
scp $(TOOLCHAIN)/target/bin/netstat root@$(SATIP_HOST):/bin
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# minisatip
|
# minisatip
|
||||||
|
@ -1,5 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
if test -r /root/fw.tgz; then
|
||||||
|
if ! test -d /1; then
|
||||||
|
mkdir /1
|
||||||
|
fi
|
||||||
|
cd /1
|
||||||
|
tar xvzf /root/fw.tgz
|
||||||
|
mount --bind /dev /1/dev
|
||||||
|
mount --bind /proc /1/proc
|
||||||
|
cp -av /root/syscall-dump.so /1/usr/lib
|
||||||
|
cp -av /root/s2i-dump.sh /1
|
||||||
|
cp -av /usr/bin/strace /1/usr/bin
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
if ! test -d /mnt/s2i-log; then
|
if ! test -d /mnt/s2i-log; then
|
||||||
mkdir -p /mnt/s2i-log
|
mkdir -p /mnt/s2i-log
|
||||||
mount -t tmpfs -o size=300M,mode=0755 tmpfs /mnt/s2i-log
|
mount -t tmpfs -o size=300M,mode=0755 tmpfs /mnt/s2i-log
|
||||||
@ -8,10 +21,9 @@ if ! test -d /mnt/ramdisk; then
|
|||||||
mkdir -p /mnt/ramdisk
|
mkdir -p /mnt/ramdisk
|
||||||
mount -t tmpfs -o size=1024k,mode=0755 tmpfs /mnt/ramdisk
|
mount -t tmpfs -o size=1024k,mode=0755 tmpfs /mnt/ramdisk
|
||||||
fi
|
fi
|
||||||
mkdir -p /usr/local/bin
|
killall -9 mdnsd
|
||||||
mkdir -p /var/run
|
rm -f /mnt/s2i-log/*
|
||||||
ln -sf /usr/bin/mdnsd /usr/local/bin/mdnsd
|
#TRACE="strace -r -ff -o /mnt/s2i-log/trace"
|
||||||
rm -f /mnt/s2i-log/s2i.log
|
|
||||||
LD_PRELOAD=/usr/lib/syscall-dump.so \
|
LD_PRELOAD=/usr/lib/syscall-dump.so \
|
||||||
SYSCALL_DUMP_LOG=/mnt/s2i-log/s2i.log \
|
SYSCALL_DUMP_LOG=/mnt/s2i-log/s2i.log \
|
||||||
/usr/lib/s2i.bin
|
$TRACE /root/s2i.bin
|
||||||
|
@ -15,8 +15,11 @@ Usage:
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/un.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -56,6 +59,7 @@ static int (*real_close)(int fd);
|
|||||||
static int (*real_dup)(int oldfd);
|
static int (*real_dup)(int oldfd);
|
||||||
static int (*real_dup2)(int oldfd, int newfd);
|
static int (*real_dup2)(int oldfd, int newfd);
|
||||||
static int (*real_eventfd)(unsigned int initval, int flags);
|
static int (*real_eventfd)(unsigned int initval, int flags);
|
||||||
|
static int (*real_bind)(int socket, const struct sockaddr *address, socklen_t address_len);
|
||||||
static int (*real_system)(const char *command);
|
static int (*real_system)(const char *command);
|
||||||
static FILE *(*real_fopen)(const char *pathname, const char *mode);
|
static FILE *(*real_fopen)(const char *pathname, const char *mode);
|
||||||
static FILE *(*real_freopen)(const char *pathname, const char *mode, FILE *stream);
|
static FILE *(*real_freopen)(const char *pathname, const char *mode, FILE *stream);
|
||||||
@ -395,6 +399,25 @@ int eventfd(unsigned int initval, int flags)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* bind() wrapper */
|
||||||
|
int bind(int socket, const struct sockaddr *address, socklen_t address_len)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
char s[32];
|
||||||
|
|
||||||
|
REDIR(real_bind, "bind");
|
||||||
|
|
||||||
|
if (address->sa_family == AF_UNIX)
|
||||||
|
dlog("bind AF_UNIX to '%s'\n", ((struct sockaddr_un *)address)->sun_path);
|
||||||
|
else if (address->sa_family == AF_INET)
|
||||||
|
dlog("bind AF_INET to '%s:%d'\n", inet_ntop(AF_INET, &(((struct sockaddr_in*)address)->sin_addr), s, sizeof(s)), ((struct sockaddr_in *)address)->sin_port);
|
||||||
|
else if (address->sa_family == AF_INET6)
|
||||||
|
dlog("bind AF_INET to '%s:%d'\n", inet_ntop(AF_INET6, &(((struct sockaddr_in6*)address)->sin6_addr), s, sizeof(s)), ((struct sockaddr_in6 *)address)->sin6_port);
|
||||||
|
r = real_bind(socket, address, address_len);
|
||||||
|
dlog("bind(%d, %p, %zi) = %d (%d)\n", socket, address, (size_t)address_len, r, E(r));
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
/* system() wrapper */
|
/* system() wrapper */
|
||||||
int system(const char *command)
|
int system(const char *command)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user