1 / 14

Network Applications

Network Applications. user. kernel. socket. BSD Sockets. sock. INET Sockets. sk_buff. TCP. UDP. IP. ARP. PPP. SLIP. Ethernet. sys_socketcall(). send. ip_queue_xmit. sys_send(). sock->ops->sendmsg. dev_queue_xmit. inet_sendmsg(). do_dev_queue_xmit. sk->prot->sendmsg.

hollis
Download Presentation

Network Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Network Applications user kernel socket BSD Sockets sock INET Sockets sk_buff TCP UDP IP ARP PPP SLIP Ethernet

  2. sys_socketcall() send ip_queue_xmit sys_send() sock->ops->sendmsg dev_queue_xmit inet_sendmsg() do_dev_queue_xmit sk->prot->sendmsg tcp_sendmsg() dev->hard_start_xmit el3_start_xmit() do_tcp_sendmsg() tcp_send_skb sk->prot->queue_xmit

  3. do_tcp_sendmsg() • Allocate sk_buff • construct hardware and IP header • sk->prot->build_header() • ip_build_header • construct TCP header

  4. ip_queue_xmit() • Partially initialize skb (sk_buff) • check “free” value • free == 1: don’t free, keep skb on the sk send list • free == 0: after device send out, it will be freed • compute checksum • if lookback: call ip_lookback() • if fragmentation: call if_fragment() • call dev_queue_xmit()

  5. do_dev_queue_xmit() • Lock device • check if transmission • find the corresponding list • queue the skb in the tail of list • dequeue the first skb in the list and call the dev->hard_start_xmit()

  6. el3_interrupt() tcp_rcv el3_rx() tcp_data() netif_rx() tcp_queue() sk->data_ready() net_bh() def_callback2() pt_prev->fun() ip_rcv() ipprot->handler()

  7. Function Illustration • el3_interrupt() • get the device interface • call el3_rx() • el3_rx() • allocate sk_buff • determine the packet’s protocol ID • call netif_rx()

  8. Function Illustration (Cont.) • netif_rx() • check if backlog_size is appropriate • if no => drop • else enqueue in the system backlog list • call mark_bh()

  9. Function Illustration (Cont.) • net_bh() • dev_transmit(): check each network interface if anyone is ready to transmit • _sbk_unlink(): dequeue the sk_buff from the backlog list • search the two system list for packet type • ptype_all: ETH_P_ALL • ptype_base[]: main protocol list • call pt_prev->func() : i.e. ip_rcv()

  10. Function Illustration (Cont.) • ip_rcv() • correction checking • ip_options_compile: ip options preprocessing • ip_defrag() • if my packet • ip_option_processing • check if raw ip • find the protocol and call ipprot->handler(): tcp_rcv() • else ip_forward()

  11. Function Illustration (Cont.) • tcp_rcv() • _tcp_v4_lookup(): find the upper INET sock structure • call tcp_data() • tcp_data() • handle the data • call tcp_queue

  12. Function Illustration (Cont.) • tcp_queue() • tcp_insert_skb(): add a sk_buff to the tcp receive queue (sk->receive_queue) • sk->data_ready(): def_callback2() • def_callback2() • wake up the sleeping process

  13. sys_socketcall() sys_recv() inet_recvmsg() tcp_recvmsg()

More Related