Skip to content

Instantly share code, notes, and snippets.

View uebayasi's full-sized avatar

Masao Uebayashi uebayasi

  • Tombi Inc.
  • Yokohama, Kanagawa, Japan
View GitHub Profile
@uebayasi
uebayasi / ubuntu-kvm.md
Last active September 5, 2016 10:44
Ubuntu + KVM

TL;DR - Use diffconfig

Initial build

  • Create .config by running make menuconfig interactively
  • Generate diffconfig by running ./script/diffconfig.sh and save it (e.g. ~/hoge.config)
  • Do build (make)

Incremental build

  • Fix system header internal include (XXX evil XXX)
    • Replace #include <sys/*.h> with #include "sys/*.h" in /usr/include/*.h
    • Replace #include <sys/*.h> with #include "*.h" in /usr/include/sys/*.h
  • Symlink liblto_plugin.so
cd ${TOOLDIR}/libexec/gcc/x86_64--netbsd/5.4.0
ln -sf liblto_plugin.so.0.0 liblto_plugin.so.0
ln -sf liblto_plugin.so.0.0 liblto_plugin.so.0
  • XXX genmatch vs. libiconv
  • Click the interesting packet
  • Select "File" -> "Export Specified Packets"
  • Select "Packet Range" -> "Selected packets only"
@uebayasi
uebayasi / minimal-scapy-tcpreplay-ethernet.md
Created June 14, 2016 11:10
Sending a minimal Ethernet frame using Scapy and tcpreplay
# scapy
INFO: Can't import PyX. Won't be able to use psdump() or pdfdump().
Welcome to Scapy (2.3.2)
>> x = Ether(src='00:11:22:33:44:55', dst='aa:bb:cc:dd:ee:ff')
>> wrpcap('x.pcap', x)
>> ^D
# ifconfig vether123 up
# ifconfig vether123 inet6 autoconf
# tcpreplay --intf1 vether123 x.pcap
Jumping to start of image at address 0xbfca0000
U-Boot 2012.04.01 (UBNT Build ID: 4605996-gd120a44) (Build time: Oct 14 2013 - 18:14:14)
Skipping PCIe port 0 BIST, in EP mode, can't tell if clocked.
Skipping PCIe port 1 BIST, reset not done. (port not configured)
BIST check passed.
UBNT_E200 r1:1, r2:9, serial #: 24A43C0634DA
Core clock: 800 MHz, IO clock: 600 MHz, DDR clock: 533 MHz (1066 Mhz DDR)
#0 0x00007f7ff710e74a in _lwp_kill () from /usr/lib/libc.so.12
#1 0x00007f7ff710e3d5 in abort () from /usr/lib/libc.so.12
#2 0x00007f7ff746a7d2 in default_fatal_finish ()
from /usr/pkg/lib/dovecot/libdovecot.so.0
#3 0x00007f7ff746a835 in i_internal_fatal_handler ()
from /usr/pkg/lib/dovecot/libdovecot.so.0
#4 0x00007f7ff7423031 in i_panic () from /usr/pkg/lib/dovecot/libdovecot.so.0
#5 0x00007f7ff789960d in index_mail_get_raw_headers ()
from /usr/pkg/lib/dovecot/libdovecot-storage.so.0
#6 0x00007f7ff78998f3 in index_mail_get_first_header ()
XXX 0x8001180068000010 <- 0x00002044
XXX 0x8001180068000010 <- 0x00022044
XXX 0x8001180068000010 <- 0x00022004
XXX 0x8001180068000018 <- 0x398d28080b000001
XXX 0x8001180068000018 <- 0x398d28080b000000
XXX 0x8001180068000010 <- 0x00022014
XXX 0x8001180068000018 <- 0x398d28080b000000
XXX 0x8001180068000010 <- 0x0002201c
XXX 0x8001180068000010 <- 0x0002203c
XXX 0x80016f0010000008 <- 0x01a1
  • Summary
    • Installing Redmine under sub-URI is hard
    • Input
      • Make Apache access localhost:3000/redmine
        • ProxyPass /redmine http://localhost:3000/redmine
      • Make Redmine process /redmine
        • Dynamic contents -> routing
          • Edit config/routes.rb
        • Static contents -> ???
          • XXX Doesn't work