call trace
the ‘.show’ method in device_attribute will call the netstat_show,
some of the driver read the part of stat from NIC register,
but most count the stat by software in dev->stat
1 | > dev_get_stats |
the ‘.show’ method in device_attribute will call the netstat_show,
some of the driver read the part of stat from NIC register,
but most count the stat by software in dev->stat
1 | > dev_get_stats |
1 | 1087 git init —bare study.git <=== crate study.git |
1 | 1103 git clone study.git/ tmp1 |
1 | git clone —bare study.git/ mirror.git |
1 | 1134 git remote add mirror /home/junwei/git_study/mirror.git/ <=== add a new remote and name it as mirror. |
git config push.default tracking 来让git push命令默认push当前的分支到对应的remote tracking分支上
1 | [junwei@junwei study]$ git config push.default tracking |
1 | [martin@fc16 example]$ git log --oneline |
1 | [martin@fc16 example]$ git push origin :v1.a0 |
1 | static void __init bootmem_init(void) |
1 | 936 static int __devinit e1000_probe(struct pci_dev *pdev, |
1 | 53 #define alloc_etherdev(sizeof_priv) alloc_etherdev_mq(sizeof_priv, 1) |
1 | 365 struct net_device *alloc_etherdev_mqs(int sizeof_priv, unsigned int txqs, |
1 | 5821 struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, |
1 | 334 void ether_setup(struct net_device *dev) |
IPv6 route tree 原理.
IPv6路由采用二叉树的形式进行存储, 查找任意路由最多需要128次比较(128次,说法不太严格)。
因此其算法复杂度为常数,因此IPv6里没有像IPv4那样的cache。
When we compile a glibc(or eglibc), we need generated the timezone data file with it. although, it is stable and no change almost in every version update.
Today a problem is met about it.
We use the old glibc’s timezone file, which is used by many different toolchain for several paltforms.
unfortunately.the data file has been change after 2007 year by GNU official. but I did not found the exact version(date) of glibc, which change the timezone data file.
btw: toolchain = binutils + gcc + glibc(eglic) + kernel(header)
linux kernel provide 3 method to manager SA/SP,
such as add/del/flush/dump SAs/SPs.
The af_key.c implement the pf_key socket.
important function is
pfkey_create,pfkey_sendmsg,pfkey_recvmsg,
pfkey_release,datagram_poll,
1 | static const struct proto_ops pfkey_ops = { |
1 | static struct xfrm_mgr pfkeyv2_mgr = |
in kernel 3.0, pf_key message format
A traditional TLV format.
header + (extenion-header + extention_value)*n
The header is sadb_msg.
extention header is sadb_ext.
extention value is different according the extention header.
Such as sadb_sa,sadb_x_policy and so on.
1 | struct sadb_msg { |
The application program(such as setkey) sent a command to kernel by sendmsg system API.
Thus in kernel pf_key will call pfkey_sendmsg.
pfkey_sendmsg will call pfkey_get_base_msg to do some simple check, and
then call pfkey_process.
pfkey_process will first pfkey_broadcast, then divid the extention message
to a pointer array one by one.void *ext_hdrs\[SADB_EXT_MAX\]; SADB_EXT_SA —->SADB_EXT_ADDRESS_SRC—->SADB_EXT_ADDRESS_DST—->
this pointer array will be used by the following handler.
and then call the pfkey_handler according the sadb_msg_type in the pf_key messag header.
typedef int (*pfkey_handler)(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs);
1 | typedef int (*pfkey_handler)(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs); |
The policy related function was done in xfrm_policy.c and xfrm_state.c
3.1 policy add handler: pfkey_spdadd
3.2 polcy dump handler: pfkey_spddump
function pfkey_xfrm_policy2msg
3.3 policy flush handler: pfkey_spdflush.
3.4 SA add handler:pfkey_add
3.2 SA dump handler:pfkey_dump
3.3 SA flush handler:pfkey_flush