Computer Science 853 Quiz 1 Name_______________________ 1. Which of the following functions is responsible for creating the slab cache of struct sock elements a. sock_register() b. inet_register_protosw() c. net_add_protocol() d. proto_register() 2. For each of the following function calls identify the binding that is being performed: ___ a. net_add_protocol() 1. socket layer to transport layer 2. socket layer to socket create 3. AF_INET layer to network layer ___ b. sock_register() 4. transport layer to network layer 5. network layer to dev layer 6. AF_INET layer to transport layer ___ c. dev_add_pack() ___ d. inet_register_protosw() 3. For each of the following answer U or D depending upon the function is used to establish UPCALL or DOWNCALL bindings ___ a. net_add_protocol() ___ b. inet_register_protosw() ___ c dev_add_pack() ___ d sock_register 4. In addtion to inet_register_proto() and net_add_protocol() what additional function must be caled when creating a new IPV4 transport protocol. 5. The UDP protocol handler for the sendmsg socket call is specified in a. struct proto_ops b. struct proto c. struct net_protocol d. struct net_proto_family 6. Identify the event that causes each of the following tables to be searched ___ a. inet_protos 1. An application creates a socket ___ b. net_families 2. An input packet is to be delivered to the network layer ___ c. ptype_base 3. An output packet is to be ___ d. inetsw delivered to the dev layer 4. An input packet is to be delivered to the transport layer 5. The AF_INET layer needs to find the recvmsg handler of a transport protocol. 7. For each of the following tables identify the primary key that is used to look up a data structure in the table. ___ a. inet_protos 1. Transport protocol number (TCP=6) ___ b. net_families 2. Socket type (SOCK_DGRAM = 2) ___ c. ptype_base 3. Protocol family number (PF_INET = 2) ___ d. inetsw 4. Network layer protocol id ETHP_IP = 0x800 8. When the inetsw table is searched secondary search key is a. The protocol family number b. network layer protocol id c. transport layer protocol d. socket type number. 9. A single entry in the Linux routing table and shown in the command /sbin/route best corresponds to a. An element of the route b. An element of the fib cache c. There is always a 1 to 1 correspondence between cache and fib elements. 10. On a Linux system when a super active web surfer is working, a. the number of route cache b. there will be more entries will significantly routing table entries than exceed the number of routing route cache entries table entries c. the route cache and the routing table always have the same number of entries -- the route cache just provides faster access. Computer Science 853 Quiz 2 Name _________________ 1. Which best characterizes where the "users" and "dataref" reference counters reside. a. both in struct sk_buff b. both in struct skb_shared_info b. dataref in sk_buff and d. users in sk_buff and users in skb_shared_info dataref in skb_shared_info 2. When an skb is cloned what best describes the way in which the reference counters are affected. a. both dataref and users b. neither in incremented are incremented c. only users is incremented d. only dataref is incremented 3. Identify the proper skb_* utility function that would be used to update appropriate buffer pointers and length fields when... a. Appending user data to the buffer. b. Inserting a new protocol header in an outgoing packet c. Removing a protocol header from a incoming packet before passing it up to the next layer. 4. A buffer pair from the fclone cache is returned to the slab cache a. at the time the parent is freed b. at the time the child is freed c. when either a or b occurs d. only after both a and b occur. 5. The buffer free code contains the following two lines that unconditionally return a buffer whose fclone field is set to SKB_FCLONE_UNAVAILABLE 332 case SKB_FCLONE_UNAVAILABLE: 333 kmem_cache_free(skbuff_head_cache, skb); SKB_FCLONE_UNAVAILABLE is a also a legal state for the child buffer of a pair allocated from the fclone cache. Explain precisely and concisely why this doesn't present a problem. 6. The value of skb->len should always be a. skb->end - skb->head b. skb->tail - skb->data c. skb->tail - skb->head d. skb->end - skb->data 7. For an unshared/uncloned sk_buff wmem_alloc is decremented a. as soon a the buffer is b. as soon as the buffer is passed to the dev layer added to the device's Tx ring c. only after the Tx complete interrupt associated with the transmission of the buffer 8. For an unshared/uncloned sk_buff wmem_alloc is decremented a. as soon a the buffer is b. as soon as the buffer is passed to the dev layer added to the device's Tx ring c. only after the Tx complete interrupt associated with the transmission of the buffer 9. Which best describes the use of buffer "destructors" when buffer cloning is in use: a. both original and clone b. original has destructor but have destructors clone does not. c. clone has destructor but d. neither one has destructor original does not 10. In a reliable protocol in which buffers may time out and have to be retransmitted cloning a. must be done at EACH b. need be done only before retransmission the first transmission c. need not be done at all. 11. A reliable transport protocol should use dev_alloc_skb() a. for both regular data packets b. for acks but NOT for and for acks. regular data packets c. for regular data packets but d. both (a.) and (b.) work not for acks. equally well 12. If a reliable protocol wishes to perform "honest" accounting for allocated buffer space (the released space is credited to wmem only when actually freed) it should a. pass a clone to the IP b. pass the original to the layer IP layer c. either way works equally well. Computer Science 853 Quiz 3 Name _________________ 1. Given the "current" pointer and an fd index, produce a diagram illustrating all relevant data structures and the linkages between them that are used in locating the associated struct proto. Label the structures in your diagram with the structure name. 2. In UDP the hash queue on which a struct sock resides is derived from a. local IP addr b. remote IP addr c. local port number d. remote port number 3. During a UDP connect operation a. If the socket is not already b. Any existing bind status is bound inet_autobind() is reset to null called to bind it. c. The bind status is not altered. 4. During a UDP bind operation a. If the socket is not already b. Any existing connection is connected inet_autoconn() is reset to null. called to connect it. c. The connection status is not altered. 5. In bind and connect operations, the "getport" function is responsible for allocating a. both the local port and the b. only the remote port remote port c. only the local port 6. The difference between the "num" and "sport" elements is best characterized in a UDP inet_sock as: a. num carries protocol number b. both carry source port but sport carries source port num is host byte order and sport net byte order c. both carry source port but num is net byte order and sport is host byte order 7. Pointers to the struct proto and struct proto_ops are managed as follows: a. both reside in the struct b. both reside in the struct sock socket c. proto resides in the socket d. proto_ops resides in the socket proto_ops in the sock proto resides in the sock 8. Suppose that the value of the udp_port_rover in udp_v4_get_port() is 0x9ACD and that this queue is selected but it is not empty. If port 0x9ACD is found already in use what will be the next port number tested (Assume there are 128 hash chains). 9. In udp_sendmsg() it is necessary to call ip_route_output_flow() a. for every packet sent regardless b. for every packet sent if the of whether the socket is connected socket is not connected but never for connected sockets c. for some but not all packets d. for every packet sent if the regardless of whether or not socket is not connected but the socket is connected. for some but not all packets for connected sockets 10. For each of the following pairs of operations mark the one that MUST be done first. If either may be safely done first don't mark either one. a. _____ bind ______ connnect b. _____ resolve route ______ allocate skbuff c. _____ allocate skbuff _____ copy packet data from user space d. _____ store tot_len in _____ compute the checksum the iphdr and store in the iphdr. Computer Science 853 Quiz 4 Name_______________________ 1. It may be necessary to clone skb_buffs a. in multicast delivery but not in b. in unicast but not in multicast unicast c. in both d. in neither 2. A packet that whose destination port does not correspond to an open socket a. will be dropped before udp_rcv() b. will be dropped by udp_rcv() c. will be dropped by udp_recvmsg() d. will be queued for possible future delivery when the port is bound to a socket. 3. When a deliverable packet has been received, at the time udp_rcv()returns returns to its caller in the ip layer, a. application data has been b. the packet is in the receive copied to user space and the queue but the data hasn't been sk_buff freed copied c. application data has been copied but the sk_buff hasn't been freed. 4. Which of the following will cause a packet to be dropped in udp_rcv() a. length in udpheader less b. length implied by skb->len than length implied by skb->len less than length in udpheader c. both d. neither one 5. In your COP protocol, for each of the following API calls identify the proper characteristic of the wait that may (or may not) occur: ____ a. bind 1. schedule_timeout with infinite timeout ____ b. listen 2. schedule_timeout with 5 second timeout ____ c. connect 3. no call to schedule_timeout 6. How many NF_HOOK chains will process a packet sent by your COP protocol a. 0 b. 1 c. 2 d. 3 7. Which best characterises normal firewall operation a. a packet is dropped if any hook b. a packet is dropped if all hooks says drop and accepted if any say drop and accepted if all hook says accept hook say accept a. a packet is dropped if any hook a. a packet is dropped if any hook says drop and accepted if all says drop and accepted if all hooks say accept hooks say accept 8. Pointers to the head of the hook chains are stored in a two dimensional array. What are the indices in each dimension row - col - 9. Identify the correct action in the following cases in the udp port lookup routine ____ a. rcv_saddr = 0 && 1. score += 2 (rcv_saddr != daddr) 2. socket rejected ____ b. rcv_saddr != 0 && 3. socket accepted (rcv_saddr != daddr) 4. score += 0 ____ c. rcv_saddr != 0 && (rcv_saddr == daddr) 10. When a process is sleeping while waiting for a packet after a call to udp_recvmsg() , <> packet arrival what can cause the sleep to end and a return to the application to be made. Computer Science 853 Quiz 5 Name_______________________ 1. The neigh_resolve_ output function will be called instead of dev_queue_xmit() when a. The MAC address of the next hop b. When the MAC address has been has not yet been resolved by ARP previously resolved but has become stale. c. Both (a.) and (b). d. Always 2. When neigh_resolve_output() is called it will queue the packet on the ARP queue instead of passing it on to dev_queue_xmit() a. The MAC address of the next hop b. When the MAC address has been has not yet been resolved by ARP previously resolved but has become stale. c. Both (a.) and (b). d. Always 3. Indicate whether each of the following actions occurs in (U) user process context, (S) soft irq context or (B) both soft irq and user context, or (H) hardware IRQ. ___ a. dequeuing an sk_buff with pfifo_fast_dequeue ___ b. enqueing an sk_buff with pfifo_fast_enqueue ___ c. enqueuing an sk_buff on the completion_queue of the CPU's softnet_data structure. ___ d. invoking the device driver's dev->hard_start_xmit function 4. What is the meaning (in words) of the following DTRC bits: a. T b. D 5. The mapping of DTRC to sk_priority occurs in a. socket creation b. a call to setsockopt c. dev_queue_xmit() 6. The mapping of sk_priority to queue number occurs in a. socket creation b. a call to setsockopt c. dev_queue_xmit() 7. Suppose a SYN1 is received in the TCP_ESTABLISHED state by COP what should be the new state and action. a. new state b. action 8. Suppose a data packet is received in the TCP_LISTEN state by COP what should be the new state and action. a. new state b. action 9. Suppose a COP socket is in the LISTEN state, and a call to cop_sendmsg() occurs on the socket. What should be the new state and action a. new state b. action 10. Under what circumstance(s) will a return be made from dev_queue_xmit() with the packet queued on one of the Qdisc queues but not passed to the device driver 11. What is the principal advantage of having one softnet data structure per CPU instead of having a SINGLE softnet data structure that serves all CPUs Computer Science 853 Quiz 6 Name_______________________ 1. Order the following protocol characteristics according to their suitability for interrupt coalescing (1) best (2) middle (3) worst. ___ a. A window based protocol such as TCP ___ b. A request/response (stop and wait) protocol such as early NFS ___ c. An unacknowledged high-speed unidirectional UDP flow. 2. Consider a host which receives high volume incoming TCP data flows. The desirability of using high levels of interrupt coalescing a. increases with the number b. decreases with the number of simultaneous flows of simultaneous flows c. is not related to the number of flows 3. Use of large frame sizes (larger than the standard ethernet 1500 byte NPDU) when transferring a fixed amount of data reduces which type(s) of overhead. Circle all that apply: a. interrupt handling b. packet header processing overhead overhead c. per byte overhead associated with data checksums and copying to user space. 4. Interoperability problems are most likely to be triggered by a. interrupt coalescing b. use of large frame size c. both d. neither one 5. Receive sk_buffs are allocated by: a. the transport protocol b. the dev layer c. the network layer protocol d. the device driver 6. Receive sk_buffs are allocated in the context of a. user process b. software irq c. hardware irq d. either (b) or (c) could be used 7. Indicate whether each of the following actions occurs in (U) user process context, (S) soft irq context or (B) both soft irq and user context, or (H) hardware IRQ. ___ a. Extracting the network layer protocol ID (IP, ARP, etc) from the MAC header of a received packet ___ b. Enqueuing a received sk_buff on the softnet data structure ___ c. Dequeuing a received sk_buff from the softnet data structure ___ d. Passing a received sk_buff to a network handler that was registered with dev_add_pack() 8. The input_pkt_queue on the softnet data structure is used by a. old style device drivers b. new style device drivers c. both d. neither 9. Which of the following best describes the use of the backlog_dev in the softnet data structure (assume uniprocessor system) a. one backlog_dev serves as b. there is a unique backlog_dev a proxy for all old style for each old style driver drivers c. there is a unique backlog_dev for EVERY driver 10. Under what conditions does net_rx_action() return to do_softirq() a. b. c. 11. Answer the following questions that pertain to the net_rx_action softirq T or F. ____ a. On an SMP system the softirq must execute on the same CPU upon which it was scheduled. ____ b. It is allowable for two instances of net_rx_action to execute concurrently on different CPUs. ____ c. It is allowable for an instance of the net_rx_action to be scheduled on CPU 0 while an instance is actively processing packets on CPU 1. Computer Science 853 Quiz 7 Name_______________________ 1. The ip_rcv() code executes in which context: a. hardware irq b. soft irq c. application d. all of the above 2. In IP reassembly a single instance of a struct ipq represents a. a single fragment b. a single packet being reassembled c. all packets presently being resassembled. 3. When a fragement is received and its head-end overlaps the tail-end of a single fragment that has already been received a. the overlapped tail of the b. the overlapping head of the existing fragment is new fragment is discarded discarded c. the ENTIRE existing overlapped d. the entire new fragment is fragment is discarded. discarded 4. When a fragement is received and its tail-end overlaps the head-end of a single fragment that has already been received a. the overlapped head of the b. the overlapping tail of the existing fragment is new fragment is discarded discarded c. the ENTIRE existing overlapped d. the entire new fragment is fragment is discarded. discarded 5. Answer the following T or F ____ a. In reassembly the value of "meat" in a struct ipq can never exceed the value of "len" ____ b. The value of "len" can only increase and will never decrease ____ c. It is possible for "meat == len" before all fragments have been received 6. When reassembly completes a. a new skbuff is allocated and b. all of the fragments are linked all fragments are copied into using the skb->next pointers a single kmalloc'd area c. all of the fragments are linked d. The first fragment uses frag_list using frag_list pointer of the but the others uses skb->next shared_info structure. 7. In the final reassembly procedure it is necessary to create an new sk_buff and insert it into the chain after the head a. always b. the head already has a fraglist c. the head owns unmapped page d. either b or c buffers 8. An ip packet is may be delivered to a. at most one (total) raw xor b. at most one transport protocol transport protocol handler handler and one raw handler c. any number of raw handlers but d. any number of raw handlers and only one transport protocol any number of transport protocols 9. When a packet is to be delivered to multiple raw sockets and also to a transport protocol(s) a. delivery to all raw sockets b. delivery to all transport(s) occurs first occurs first c. delivery to the first raw d. delivery to all but the last socket precedes the transports raw socket precedes the transports and the remaining raw sockets and the last raw socket follows follow the transports the transports 10. In the COP transport protocol the endpoint that initiates the close sequence must: a. ensure that the txqueue is b. send FIN1 and then delay until drained and all packets acked the TX queue drains before sending FIN1 c. both ways work equally well. 11. If a FIN1 is received and the TX queue is not empty, the receiver of the FIN1 should a. ACK the FIN1 and then wait until b. wait until the TX queue the TX queue drains and all drains and all packets are packets are acked acked before acking the FIN1 c. ACK the FIN1 and then eventually purge the TX queue in cop_destroy 12. If a FIN1 is received and the RX queue is not empty, the receiver of the FIN1 should a. ACK the FIN1 immediately and b. wait until the RX queue then continue to service drains before acking the FIN1 recvmsg() requests until the RX queue drains c. ACK the FIN1, return 0 on subsequent calls to recvmsg() and purge the RX queue in cop_destroy