Changes in uspace/srv/net/loopip/loopip.c [a17356fd:02a09ed] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/loopip/loopip.c
ra17356fd r02a09ed 40 40 #include <inet/iplink_srv.h> 41 41 #include <inet/addr.h> 42 #include <net/socket_codes.h>43 42 #include <io/log.h> 44 43 #include <loc.h> … … 51 50 static int loopip_close(iplink_srv_t *srv); 52 51 static int loopip_send(iplink_srv_t *srv, iplink_sdu_t *sdu); 53 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu);54 52 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu); 55 static int loopip_get_mac48(iplink_srv_t *srv, addr48_t *mac);56 53 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr); 57 54 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr); … … 63 60 .close = loopip_close, 64 61 .send = loopip_send, 65 .send6 = loopip_send6,66 62 .get_mtu = loopip_get_mtu, 67 .get_mac48 = loopip_get_mac48,68 63 .addr_add = loopip_addr_add, 69 64 .addr_remove = loopip_addr_remove … … 167 162 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()"); 168 163 164 addr32_t src_v4; 165 addr128_t src_v6; 166 uint16_t src_af = inet_addr_get(&sdu->src, &src_v4, &src_v6); 167 168 addr32_t dest_v4; 169 addr128_t dest_v6; 170 uint16_t dest_af = inet_addr_get(&sdu->dest, &dest_v4, &dest_v6); 171 172 if (src_af != dest_af) 173 return EINVAL; 174 169 175 rqueue_entry_t *rqe = calloc(1, sizeof(rqueue_entry_t)); 170 176 if (rqe == NULL) … … 174 180 * Clone SDU 175 181 */ 176 rqe->af = AF_INET;182 rqe->af = src_af; 177 183 rqe->sdu.data = malloc(sdu->size); 178 184 if (rqe->sdu.data == NULL) { … … 192 198 } 193 199 194 static int loopip_send6(iplink_srv_t *srv, iplink_sdu6_t *sdu)195 {196 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip6_send()");197 198 rqueue_entry_t *rqe = calloc(1, sizeof(rqueue_entry_t));199 if (rqe == NULL)200 return ENOMEM;201 202 /*203 * Clone SDU204 */205 rqe->af = AF_INET6;206 rqe->sdu.data = malloc(sdu->size);207 if (rqe->sdu.data == NULL) {208 free(rqe);209 return ENOMEM;210 }211 212 memcpy(rqe->sdu.data, sdu->data, sdu->size);213 rqe->sdu.size = sdu->size;214 215 /*216 * Insert to receive queue217 */218 prodcons_produce(&loopip_rcv_queue, &rqe->link);219 220 return EOK;221 }222 223 200 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu) 224 201 { … … 226 203 *mtu = 1500; 227 204 return EOK; 228 }229 230 static int loopip_get_mac48(iplink_srv_t *src, addr48_t *mac)231 {232 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_get_mac48()");233 return ENOTSUP;234 205 } 235 206
Note:
See TracChangeset
for help on using the changeset viewer.