Changes in uspace/srv/net/tcp/tcp.c [02a09ed:06a1d077] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/tcp.c
r02a09ed r06a1d077 69 69 size_t pdu_raw_size; 70 70 71 log_msg(L OG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv()");71 log_msg(LVL_DEBUG, "tcp_inet_ev_recv()"); 72 72 73 73 pdu_raw = dgram->data; … … 76 76 /* Split into header and payload. */ 77 77 78 log_msg(L OG_DEFAULT, LVL_DEBUG, "tcp_inet_ev_recv() - split header/payload");78 log_msg(LVL_DEBUG, "tcp_inet_ev_recv() - split header/payload"); 79 79 80 80 tcp_pdu_t *pdu; … … 84 84 85 85 if (pdu_raw_size < sizeof(tcp_header_t)) { 86 log_msg(L OG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < sizeof(tcp_header_t) = %zu",86 log_msg(LVL_WARN, "pdu_raw_size = %zu < sizeof(tcp_header_t) = %zu", 87 87 pdu_raw_size, sizeof(tcp_header_t)); 88 88 return EINVAL; … … 96 96 97 97 if (pdu_raw_size < hdr_size) { 98 log_msg(L OG_DEFAULT, LVL_WARN, "pdu_raw_size = %zu < hdr_size = %zu",98 log_msg(LVL_WARN, "pdu_raw_size = %zu < hdr_size = %zu", 99 99 pdu_raw_size, hdr_size); 100 100 return EINVAL; … … 102 102 103 103 if (hdr_size < sizeof(tcp_header_t)) { 104 log_msg(L OG_DEFAULT, LVL_WARN, "hdr_size = %zu < sizeof(tcp_header_t) = %zu",104 log_msg(LVL_WARN, "hdr_size = %zu < sizeof(tcp_header_t) = %zu", 105 105 hdr_size, sizeof(tcp_header_t)); return EINVAL; 106 106 } 107 107 108 log_msg(L OG_DEFAULT, LVL_DEBUG, "pdu_raw_size=%zu, hdr_size=%zu",108 log_msg(LVL_DEBUG, "pdu_raw_size=%zu, hdr_size=%zu", 109 109 pdu_raw_size, hdr_size); 110 110 pdu = tcp_pdu_create(pdu_raw, hdr_size, pdu_raw + hdr_size, 111 111 pdu_raw_size - hdr_size); 112 112 if (pdu == NULL) { 113 log_msg(L OG_DEFAULT, LVL_WARN, "Failed creating PDU. Dropped.");113 log_msg(LVL_WARN, "Failed creating PDU. Dropped."); 114 114 return ENOMEM; 115 115 } 116 116 117 pdu->src = dgram->src; 118 pdu->dest = dgram->dest; 117 pdu->src_addr.ipv4 = dgram->src.ipv4; 118 pdu->dest_addr.ipv4 = dgram->dest.ipv4; 119 log_msg(LVL_DEBUG, "src: 0x%08x, dest: 0x%08x", 120 pdu->src_addr.ipv4, pdu->dest_addr.ipv4); 119 121 120 122 tcp_received_pdu(pdu); … … 135 137 pdu_raw = malloc(pdu_raw_size); 136 138 if (pdu_raw == NULL) { 137 log_msg(L OG_DEFAULT, LVL_ERROR, "Failed to transmit PDU. Out of memory.");139 log_msg(LVL_ERROR, "Failed to transmit PDU. Out of memory."); 138 140 return; 139 141 } … … 143 145 pdu->text_size); 144 146 145 dgram.src = pdu->src;146 dgram.dest = pdu->dest;147 dgram.src.ipv4 = pdu->src_addr.ipv4; 148 dgram.dest.ipv4 = pdu->dest_addr.ipv4; 147 149 dgram.tos = 0; 148 150 dgram.data = pdu_raw; … … 151 153 rc = inet_send(&dgram, INET_TTL_MAX, 0); 152 154 if (rc != EOK) 153 log_msg(L OG_DEFAULT, LVL_ERROR, "Failed to transmit PDU.");155 log_msg(LVL_ERROR, "Failed to transmit PDU."); 154 156 } 155 157 … … 160 162 tcp_sockpair_t rident; 161 163 162 log_msg(L OG_DEFAULT, LVL_DEBUG, "tcp_received_pdu()");164 log_msg(LVL_DEBUG, "tcp_received_pdu()"); 163 165 164 166 if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) { 165 log_msg(L OG_DEFAULT, LVL_WARN, "Not enough memory. PDU dropped.");167 log_msg(LVL_WARN, "Not enough memory. PDU dropped."); 166 168 return; 167 169 } … … 175 177 int rc; 176 178 177 log_msg(L OG_DEFAULT, LVL_DEBUG, "tcp_init()");179 log_msg(LVL_DEBUG, "tcp_init()"); 178 180 179 181 tcp_rqueue_init(); 180 tcp_rqueue_ fibril_start();182 tcp_rqueue_thread_start(); 181 183 182 184 tcp_ncsim_init(); 183 tcp_ncsim_ fibril_start();185 tcp_ncsim_thread_start(); 184 186 185 187 if (0) tcp_test(); … … 187 189 rc = inet_init(IP_PROTO_TCP, &tcp_inet_ev_ops); 188 190 if (rc != EOK) { 189 log_msg(L OG_DEFAULT, LVL_ERROR, "Failed connecting to internet service.");191 log_msg(LVL_ERROR, "Failed connecting to internet service."); 190 192 return ENOENT; 191 193 } … … 193 195 rc = tcp_sock_init(); 194 196 if (rc != EOK) { 195 log_msg(L OG_DEFAULT, LVL_ERROR, "Failed initializing socket service.");197 log_msg(LVL_ERROR, "Failed initializing socket service."); 196 198 return ENOENT; 197 199 } … … 206 208 printf(NAME ": TCP (Transmission Control Protocol) network module\n"); 207 209 208 rc = log_init(NAME );210 rc = log_init(NAME, LVL_WARN); 209 211 if (rc != EOK) { 210 212 printf(NAME ": Failed to initialize log.\n");
Note:
See TracChangeset
for help on using the changeset viewer.