- 博客(27)
- 资源 (18)
- 收藏
- 关注
原创 RAW实现
struct proto raw_prot = { .name = "RAW", .owner = THIS_MODULE, .close = raw_close, .destroy = raw_destroy, .connect = ip4_datagram_connect, .disconnect = udp_disconnec
2016-10-13 19:39:16 608
原创 IGMP
IGMP(Internet Group Manage Protocol):Internet组管理协议,提供internet网际多点传送的功能,即将一个ip包拷贝给多个host。 IGMP的工作过程如下:一. 当主机加入一个新的工作组时,它发送一个igmp host membership report的报文给全部主机组,宣布此成员关系.本地多点广播路由器接受到这个报文后,向Inter
2016-10-13 19:25:56 708
原创 lINUX iCmp协议
ICMP是(Internet Control Message Protocol)Internet控制报文协议。它是TCP/IP协议族的一个子协议,用于在IP主机、路由器之间传递控制消息。控制消息是指网络通不通、主机是否可达、路由是否可用等网络本身的消息。这些控制消息虽然并不传输用户数据,但是对于用户数据的传递起着重要的作用。在Linux kernel中密切相关的函数是下面几个:void i
2016-10-13 19:16:56 1020
原创 LINUX arp
ARP协议: ARP (Address Resolution Protocol) 是个地址解析协议。也就是负责L3地址到L2地址之间的映射关系。或者说,以太网中,当一个上层协议要发包时,有了该节点的IP地址,ARP就能提供该节点的MAC地址。OSI 模式把网络工作分为七层,彼此不直接打交道,只通过接口. IP地址在第三层, MAC地址在第二层。协议在发生数据包时,首先要封装第三层
2016-10-13 19:04:37 1027
原创 linux内核参数
sysctl 是一个用来在系统运作中查看及调整系统参数的工具.# sysctl -asysctl -adebug.exception-trace = 1dev.scsi.logging_level = 0fs.aio-max-nr = 65536fs.aio-nr = 0fs.dentry-state = 14420 3448 45 0 0
2016-10-11 14:09:55 3418 1
原创 socket创建过程
SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol){int retval;struct socket *sock;int flags;/* Check the SOCK_* constants for consistency. */BUILD_BUG_ON(SOCK_CLOEXEC != O
2016-10-09 22:45:04 612
原创 linux 网络协议
/* * The protocol list. Each protocol is registered in here. */static DEFINE_SPINLOCK(net_family_lock);static const struct net_proto_family __rcu *net_families[NPROTO];static const str
2016-10-09 21:43:53 702
原创 网络设备NAPI能力
void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight){INIT_LIST_HEAD(&napi->poll_list);hrtimer_init(&napi->timer, CLOCK_MO
2016-10-07 00:32:21 618
转载 napi介绍
/* * Structure for NAPI scheduling similar to tasklet but with weighting */struct napi_struct {/* The poll_list must only be managed by the entity which* changes the state of the NAPI_STATE_
2016-10-07 00:15:11 903
原创 以太网帧结构
struct ethhdr {unsigned char h_dest[ETH_ALEN]; /* destination eth addr*/unsigned char h_source[ETH_ALEN]; /* source ether addr*/__be16 h_proto; /* packet type ID field*/} __attribu
2016-10-06 23:32:35 2608
原创 探测封包类型
/** * eth_type_trans - determine the packet's protocol ID. * @skb: received socket data * @dev: receiving network device * * The rule here is that we * assume 802.3 if the type field is sh
2016-10-06 19:03:21 621
原创 网络层数据接收
static int __netif_receive_skb(struct sk_buff *skb){int ret;if (sk_memalloc_socks() && skb_pfmemalloc(skb)) {unsigned long pflags = current->flags;/** PFMEMALLOC skbs are special,
2016-10-06 18:41:55 679
原创 网络层协议注册
static DEFINE_SPINLOCK(ptype_lock);struct list_head ptype_base[PTYPE_HASH_SIZE] ;struct list_head ptype_all ; /* Taps */struct packet_type {__be16 type; /* This is really htons(ether_typ
2016-10-06 18:33:14 233
原创 发送IP封包到高层协议
int ip_local_deliver(struct sk_buff *skb){/** Reassemble IP fragments.*/struct net *net = dev_net(skb->dev);if (ip_is_fragment(ip_hdr(skb))) {if (ip_defrag(net, skb, IP_DEFRAG_LOCAL_
2016-10-06 18:09:38 555
原创 IP上层协议注册
/* This is one larger than the largest protocol value that can be * found in an ipv4 or ipv6 header. Since in both cases the protocol * value is presented in a __u8, this is defined to be 256.
2016-10-06 17:53:21 323
原创 Socket types
/** * enum sock_type - Socket types * @SOCK_STREAM: stream (connection) socket * @SOCK_DGRAM: datagram (conn.less) socket * @SOCK_RAW: raw socket * @SOCK_RDM: reliably-delivered message *
2016-10-06 17:37:36 406
原创 raw_prot
{ .type = SOCK_RAW, .protocol = IPPROTO_IP,/* wild card */ .prot = &raw_prot, .ops = &inet_sockraw_ops, .flags = INET_PROTOSW_REUSE,
2016-10-01 23:18:14 291
原创 ping_prot
{.type = SOCK_DGRAM,.protocol = IPPROTO_ICMP,.prot = &ping_prot,.ops = &inet_dgram_ops,.flags = INET_PROTOSW_REUSE, },struct proto ping_prot = {.nam
2016-10-01 23:16:36 702
原创 udp_prot
{.type = SOCK_DGRAM,.protocol = IPPROTO_UDP,.prot = &udp_prot,.ops = &inet_dgram_ops,.flags = INET_PROTOSW_PERMANENT, },struct proto udp_prot = {
2016-10-01 23:15:09 473
原创 tcp_prot
{.type = SOCK_STREAM,.protocol = IPPROTO_TCP,.prot = &tcp_prot,.ops = &inet_stream_ops,.flags = INET_PROTOSW_PERMANENT | INET_PROTOSW_ICSK,},struct pr
2016-10-01 23:13:35 580
原创 传输层实现
struct inet_protosw {struct list_head list; /* These two fields form the lookup key. */unsigned shorttype; /* This is the 2nd argument to socket(2). */unsigned shortprotocol;
2016-10-01 23:12:01 480
原创 inetsw table
/* The inetsw table contains everything that inet_create needs to * build a new socket. */static struct list_head inetsw[SOCK_MAX];static DEFINE_SPINLOCK(inetsw_lock);for (q = inetsw_arr
2016-10-01 23:08:20 349
原创 Linux创建socket
static const struct net_proto_family inet_family_ops = {.family = PF_INET,.create = inet_create,.owner = THIS_MODULE,};/* * Create an inet socket. */static int inet_create(
2016-10-01 23:01:05 533
原创 Linux 内核 net_proto_family
static const struct net_proto_family inet_family_ops = {.family = PF_INET,.create = inet_create,.owner = THIS_MODULE,};(void)sock_register(&inet_family_ops);/** * sock_register -
2016-10-01 22:58:10 1208
原创 Linux TCP/IP socket 实现
简要记录函数调用流程SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol){int retval;struct socket *sock;int flags;/* Check the SOCK_* constants for consistency. */BUILD_BUG_ON(S
2016-10-01 22:48:54 461
原创 Linux IP处理之ip_queue_xmit
ip_queue_xmit()完成面向连接套接字的包输出,当套接字处于连接状态时,所有从套接字发出的包都具有确定的路由, 无需为每一个输出包查询它的目的入口,可将套接字直接绑定到路由入口上, 这由套接字的目的缓冲指针(dst_cache)来完成.ip_queue_xmit()首先为输入包建立IP包头, 经过本地包过滤器后,再将IP包分片输出(ip_fragment)。/
2016-10-01 22:33:23 3342
原创 Linux IP 处理
增加IP头到一个skb,之后发送这个skb到下层处理。int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk, __be32 saddr, __be32 daddr, struct ip_options_rcu *opt){struct inet_sock *inet = inet_sk(sk);
2016-10-01 22:28:09 306
没有程序语言是完美的.甚至没有一个唯一最好的语言,只有对于特定目的,比较适合和不适合
2010-06-03
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人