IP HEADER
以前找工作时,常被问到IP头都有哪些字段?
现在觉得真的理解了记起来没那么难。
上路时总要记得终点和起点(src/dst ip),
要倒几次车,大体也知道(ttl).
路有大路有小路,有高速路和土路。
大路到小路要分片,小路到大路可能重组。
上高速路需要通行证(qos/tos).
路上有警察,查你是不是非法(csum, header len, ip option),
查你装的什么货(protocol)?
Two packets will be proessed by tcp server side:
For the first packet(syn) of handshake, it first lookup the listen socket,
and create a req socket as temporary.
For the third packet(ack) of handshake, it will match the req socket created
in previous steps.
For the packet to localhost, ip_local_deliver_finish
will be the
last funciton called by network layer.
In ip_local_deliver_finish
, it will be process the protocol
hander of a array element of inet_protos
according the protocol
value
in IPv4 header.
IPv6 is very similar vs IPv4 except the name is a bit different.
1 | 1019 static const struct net_proto_family inet_family_ops = { |
1 | > inet_create |
System call socket
will do two things:
struct socket *sock
.__sock_create
, which alloc a struct socket *sock
,creating
method of net_families[family]
.sock
to a file descriptor by sock_map_fd
.1 | > socket |
Each family
has a corresponding array element of struct net_proto_family
,
which will be called in system call socket
.
1 | 181 struct net_proto_family { |
The create
is important, which is first and basic function during
system call socket
.
1 | 164 static DEFINE_SPINLOCK(net_family_lock); |
I want to write blog with github page and octopress in the office
and in the home.
The github page has work well done with pc in the home.
Now setup the environment in office to write github page.
The github page repo:
https://github.com/martinbj2008/martinbj2008.github.io
the octopress is pushed to git repo as branch “source”
How to write blog and sync them to github while avoid conflict with home?