Changeset b86a32e in mainline for uspace/srv/net/loopip/loopip.c
- Timestamp:
- 2013-07-15T12:14:55Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c84146d3
- Parents:
- 87159eb8 (diff), 956d4281 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/loopip/loopip.c
r87159eb8 rb86a32e 40 40 #include <inet/iplink_srv.h> 41 41 #include <inet/addr.h> 42 #include <net/socket_codes.h> 42 43 #include <io/log.h> 43 44 #include <loc.h> … … 50 51 static int loopip_close(iplink_srv_t *srv); 51 52 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); 52 54 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); 53 56 static int loopip_addr_add(iplink_srv_t *srv, inet_addr_t *addr); 54 57 static int loopip_addr_remove(iplink_srv_t *srv, inet_addr_t *addr); … … 60 63 .close = loopip_close, 61 64 .send = loopip_send, 65 .send6 = loopip_send6, 62 66 .get_mtu = loopip_get_mtu, 67 .get_mac48 = loopip_get_mac48, 63 68 .addr_add = loopip_addr_add, 64 69 .addr_remove = loopip_addr_remove … … 162 167 log_msg(LOG_DEFAULT, LVL_DEBUG, "loopip_send()"); 163 168 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 175 169 rqueue_entry_t *rqe = calloc(1, sizeof(rqueue_entry_t)); 176 170 if (rqe == NULL) … … 180 174 * Clone SDU 181 175 */ 182 rqe->af = src_af;176 rqe->af = AF_INET; 183 177 rqe->sdu.data = malloc(sdu->size); 184 178 if (rqe->sdu.data == NULL) { … … 198 192 } 199 193 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 SDU 204 */ 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 queue 217 */ 218 prodcons_produce(&loopip_rcv_queue, &rqe->link); 219 220 return EOK; 221 } 222 200 223 static int loopip_get_mtu(iplink_srv_t *srv, size_t *mtu) 201 224 { … … 203 226 *mtu = 1500; 204 227 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; 205 234 } 206 235
Note:
See TracChangeset
for help on using the changeset viewer.