MTK 官方 openwrt SDK 使用

摘要: 来源 1、https://github.com/unigent/openwrt-3.10.14 上面有个 问题:SDK 缺少 linux-3.10.14-p112871.tar.xz 在 https://github.com/mqmaker/linux/releases 下载,注意要下载那个没打补丁 阅读全文
posted @ 2017-06-08 11:35 JesseFang 阅读(6152) 评论(0) 推荐(0) 编辑

PF_RING packet overwrites

摘要: 最近在用 PF_RING 抓包过程中,发现个灵异的现象,高流量丢包时, 经常会出现正在处理的包的内容被覆盖。开始,怀疑是不是自己程序有地方越界写了,后来发现,如果自己拷贝一份,然后处理拷贝的那份,永远都不会发生覆盖现象。后来通过跟踪发现是,PF_RING 的共享内存 RING 区域对尾部处理有异常。 阅读全文
posted @ 2016-06-12 10:12 JesseFang 阅读(321) 评论(0) 推荐(0) 编辑

pycares cffi

摘要: pypy 5.0.1 由于 cpyext 有 bug,用不了异步 DNS 解析库 pycares 。花了一周时间,对照着 pycares 的 C 代码自己重写了个 cffi 的实现。在 windows 8 和 CentOS 6 上测试通过。 代码可见: https://github.com/boyt 阅读全文
posted @ 2016-04-29 14:30 JesseFang 阅读(539) 评论(0) 推荐(0) 编辑

libevent evbuffer bug

摘要: 今天发现 libevent 2.0.22 一个坑爹的bug,导致消息混乱。查找问题浪费一天,复现代码如下 #include <event2/buffer.h> #include <stdio.h> #include <string.h> // libevent-2.0.22-stable bug, 阅读全文
posted @ 2016-03-10 17:47 JesseFang 阅读(828) 评论(0) 推荐(0) 编辑

浮点转字符串性能比较

摘要: 1.浮点转字符串 使用 boost 1.56 里面的 karma 自带的测试用例,修改源码添加对 double conversion 的支持,同时输出结果为 markdown 表格。double conversion 优化级别O2,测试机为 CentOS 6.5 g++ 4.4.7。结果如下 [ro 阅读全文
posted @ 2016-02-24 16:22 JesseFang 阅读(326) 评论(0) 推荐(0) 编辑

重写 libev 的 EV_WIN32_HANDLE_TO_FD

摘要: libev 的 EV_WIN32_HANDLE_TO_FD 默认实现是调用C库的 _open_osfhandle ,但这里有个问题是转换后,关闭 fd 就默认关闭了 handle。当它遇到 libcurl 时就出现了问题。 libcurl handle 的创建和关闭都是 libcurl 来管理的,适... 阅读全文
posted @ 2015-07-28 11:32 JesseFang 阅读(697) 评论(0) 推荐(0) 编辑

thrift TNonblockingServer 使用

摘要: 下载 0.9.1 版本 (0.9.2需要 2.5的bison,而 RHEL6上自带bison是2.4)TNonblockingServer 时必须使用TFramedTransport,不能使用 TBufferedTransport,因为前者会先写入这个消息的字节数。这样非阻塞时可以预知消息的大小。1... 阅读全文
posted @ 2015-07-28 11:16 JesseFang 阅读(1789) 评论(0) 推荐(0) 编辑

accel-pptp 部署

摘要: accel-pptp 是 pptp-client 和 pptpd 的改进版,使用内核 pptp 模块,相比 raw socket 实现方式能提供更好的性能。Ubuntu 12.04上启用内核 pptp内核 3.2+ 已经包含内核 pptp 模块1. 编译 pppd 模块apt-get install... 阅读全文
posted @ 2015-01-20 14:48 JesseFang 阅读(1116) 评论(0) 推荐(0) 编辑

boost::asio 使用 libcurl

摘要: curl 使用 asio 的官方样例 http://curl.haxx.se/libcurl/c/asiohiper.html, 但这个例子用起来有很明细的 bug,asio 异步IO 只注册一次,也就是第一次 aync_read 之后对socket的读都是由 超时 驱动的。自己把样例改了下。cur... 阅读全文
posted @ 2014-12-18 17:46 JesseFang 阅读(3909) 评论(0) 推荐(0) 编辑

蜂鸟A20开发板刷 cubietruck 的 SD 卡固件

摘要: 美睿视讯 为蜂鸟A20准备的 MerriiLinux 功能非常简陋。所以能用上主流的 debian 或者 LUbuntu 就可以说是非常迫切的需求了。蜂鸟A20(Merrii Hummingbird A20)从硬件配置上来说非常接近 cubietruck ,相同的全志A20,相同的千兆PHY 芯片 ... 阅读全文
posted @ 2014-10-20 16:29 JesseFang 阅读(3191) 评论(0) 推荐(0) 编辑

MinGW 使用 msvcr90.dll

摘要: MinGW 编译出来的程序总是使用 VC6 的 msvcrt.dll ,VC8,9,10有很多新的API(仅限于c runtime),想使用怎么办?比如:boost 对 MinGW 最低要求就是 msvcrt 7.01.MinGW 系统默认情况MinGW 根据宏 MSVCRT_VERSION 来选择... 阅读全文
posted @ 2014-09-25 00:10 JesseFang 阅读(1294) 评论(0) 推荐(0) 编辑

OpenSSL win 下报错 OPENSSL_Uplink(58D46000,08): no OPENSSL_Applink

摘要: python 中使用 M2Crypto 想读写文件时总是报:OPENSSL_Uplink(58D46000,08): no OPENSSL_Applinkwindows 平台下使用 openssl 时不能直接操作与文件 IO 有关的函数。因为 ms/uplink.c 会动态从当前 exe 中获取 m... 阅读全文
posted @ 2014-08-08 17:37 JesseFang 阅读(5278) 评论(0) 推荐(0) 编辑

Android NDK 下载

摘要: Android NDKAndroid NDK, Revision 10 (July 2014)Platform(32-bit target)PackageSize (Bytes)MD5 Checksum Windows 32-bit android-ndk32-r10-windows-x86.z... 阅读全文
posted @ 2014-08-05 15:14 JesseFang 阅读(875) 评论(1) 推荐(0) 编辑

伪造 UDP 包源 IP 地址

摘要: Raw sockets 方式raw socket 可通过参数 IPV6_HDRINCL 或 IP_HDRINCL 自定义IP头——伪造UDP报文源IP就全靠它了。限制:从xp sp2之后的所有非服务器版本的windows,都不能发送TCP,并且也不能伪造UDP的源地址。这里使用 dpkt 做 UDP... 阅读全文
posted @ 2014-03-11 17:52 JesseFang 阅读(11617) 评论(0) 推荐(0) 编辑

IP defragment

摘要: snort IP defragment 模型:BSDfavors an original fragment with an offset that is less than or equal to a subsequent fragment.BSD-rightfavors a subsequent ... 阅读全文
posted @ 2014-03-11 17:16 JesseFang 阅读(469) 评论(0) 推荐(0) 编辑

atomic_compare_exchange

摘要: atomic_compare_exchange 分为两个版本 atomic_compare_exchange_strong 和 atomic_compare_exchange_weak,语义如下bool atomic_compare_exchange( volatile A *obj, C* expected, C desired, memory_order succ, memory_order fail );{ fence_before(succ); // fence 1 if(*obj == expected) { *obj = desired; ... 阅读全文
posted @ 2014-01-16 11:16 JesseFang 阅读(4224) 评论(1) 推荐(0) 编辑

read write spinlock

摘要: 发一个自己基于 C++11 写的 read write spinlock,在 MinGW 4.8.2 (gcc 4.8 全面支持c++ 11,但由于gcc windows平台 libstdc++ 目前还不支持 thread,所以用 boost 1.49 及以上版本作为thread库)。目前在 Xeon E5606 (4核8线程) Win2008 x64平台上测试通过,但还需要在内存弱序的arm上做进一步测试。代码 spinlock.cpp:#include#include#define SPIN_LOCK_UNLOCK 0#define SPIN_LOCK_WRITE_LOCK -1using 阅读全文
posted @ 2014-01-15 17:51 JesseFang 阅读(609) 评论(0) 推荐(0) 编辑

C11 memory_order

摘要: 概念:摘录自:http://preshing.com/20120913/acquire-and-release-semantics/Acquire semanticsis a property which can only apply to operations whichreadfrom shar... 阅读全文
posted @ 2013-12-27 17:30 JesseFang 阅读(843) 评论(0) 推荐(0) 编辑

AIX安装SSH

摘要: AIX 7.1进入https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=aixbp先下载需要的openssl,openssh,选最新的版本即可。注意,需要先登录帐号,注册帐号是任意的。OpenSSL:OpenSSH:安装openssl:uncompress ~/openssl-fips-12.9.8.2500.tar.Z tar -xf ~/openssl-fips-12.9.8.2500.tarcd openssl-fips-12.9.8.2500/installp -ac -Y -d . openssl.base安 阅读全文
posted @ 2013-10-31 17:32 JesseFang 阅读(5544) 评论(0) 推荐(0) 编辑

popen3

摘要: windows版本popen3函数整理了下10年08月给 fossil 捐的代码 implementation of function “popen2” on win32——参考自 Creating a Child Process with Redirected Input and Output。做了个windows下通用版本,发到githublinux的版本可参见这个实现:https://gist.github.com/nitrogenlogic/1022231/raw/85f21ac82ae81bf8dd335699b91b00f6c3e259b5/popen3_2011.cpython 阅读全文
posted @ 2013-10-22 16:43 JesseFang 阅读(370) 评论(0) 推荐(0) 编辑