raw.c (188933ac139a6f8ab06cad369bd0200af947b00d) | raw.c (b6a7719aedd7e5c0f2df7641aa47386111682df4) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * RAW - implementation of IP "raw" sockets. 7 * 8 * Authors: Ross Biro --- 390 unchanged lines hidden (view full) --- 399 goto error_free; 400 401 if (iphlen >= sizeof(*iph)) { 402 if (!iph->saddr) 403 iph->saddr = fl4->saddr; 404 iph->check = 0; 405 iph->tot_len = htons(length); 406 if (!iph->id) | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * RAW - implementation of IP "raw" sockets. 7 * 8 * Authors: Ross Biro --- 390 unchanged lines hidden (view full) --- 399 goto error_free; 400 401 if (iphlen >= sizeof(*iph)) { 402 if (!iph->saddr) 403 iph->saddr = fl4->saddr; 404 iph->check = 0; 405 iph->tot_len = htons(length); 406 if (!iph->id) |
407 ip_select_ident(skb, NULL); | 407 ip_select_ident(net, skb, NULL); |
408 409 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); 410 } 411 if (iph->protocol == IPPROTO_ICMP) 412 icmp_out_count(net, ((struct icmphdr *) 413 skb_transport_header(skb))->type); 414 415 err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL, --- 60 unchanged lines hidden (view full) --- 476 return 0; 477 } 478 479 offset -= rfv->hlen; 480 481 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb); 482} 483 | 408 409 iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); 410 } 411 if (iph->protocol == IPPROTO_ICMP) 412 icmp_out_count(net, ((struct icmphdr *) 413 skb_transport_header(skb))->type); 414 415 err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL, --- 60 unchanged lines hidden (view full) --- 476 return 0; 477 } 478 479 offset -= rfv->hlen; 480 481 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb); 482} 483 |
484static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 485 size_t len) | 484static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) |
486{ 487 struct inet_sock *inet = inet_sk(sk); 488 struct ipcm_cookie ipc; 489 struct rtable *rt = NULL; 490 struct flowi4 fl4; 491 int free = 0; 492 __be32 daddr; 493 __be32 saddr; --- 210 unchanged lines hidden (view full) --- 704out: return ret; 705} 706 707/* 708 * This should be easy, if there is something there 709 * we return it, otherwise we block. 710 */ 711 | 485{ 486 struct inet_sock *inet = inet_sk(sk); 487 struct ipcm_cookie ipc; 488 struct rtable *rt = NULL; 489 struct flowi4 fl4; 490 int free = 0; 491 __be32 daddr; 492 __be32 saddr; --- 210 unchanged lines hidden (view full) --- 703out: return ret; 704} 705 706/* 707 * This should be easy, if there is something there 708 * we return it, otherwise we block. 709 */ 710 |
712static int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 713 size_t len, int noblock, int flags, int *addr_len) | 711static int raw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 712 int noblock, int flags, int *addr_len) |
714{ 715 struct inet_sock *inet = inet_sk(sk); 716 size_t copied = 0; 717 int err = -EOPNOTSUPP; 718 DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); 719 struct sk_buff *skb; 720 721 if (flags & MSG_OOB) --- 381 unchanged lines hidden --- | 713{ 714 struct inet_sock *inet = inet_sk(sk); 715 size_t copied = 0; 716 int err = -EOPNOTSUPP; 717 DECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name); 718 struct sk_buff *skb; 719 720 if (flags & MSG_OOB) --- 381 unchanged lines hidden --- |