20.9 route_usrreq Function route_usrreq is the routing protocol's user-request function. It is called for a variety of operations. Figure 20.18 shows the function. PRU_ATTACH: allocate control block 64-77 The PRU_ATTACH request is issued when the process calls socket. Memory is allocated for a routing control block. The pointer returned by MALLOC is stored in the so_pcb member of the socket structure, and if the memory was allocated, the rawcb structure is set to 0. PRU_DETACH: decrement counters 78-87 The close system call issues the PRU_DETACH request. If the socket structure points to a protocol control block, two of the counters in the route_cb structure are decremented: one is the any_count and one is based on the protocol. Process request 88-90 The function raw_usrreq is called to process the PRU_xxx request further. Increment counters 91-104 If the request is PRU_ATTACH and the socket points to a routing control block, a check is made for an error from raw_usrreq. Two of the counters in the route_cb structure are then incremented: one is the any_count and one is based on the protocol. Connect socket 105-106 The foreign address in the routing control block is set to route_src. This permanently connects the new socket to receive routing messages from the PF_ROUTE family. Enable SO_USELOOPBACK by default 107-111 The SO_USELOOPBACK socket option is enabled. This is a socket option that defaults to being enabled�all others default to being disabled.
|
No comments:
Post a Comment