rpc_generic.c (196503) | rpc_generic.c (213103) |
---|---|
1/* $NetBSD: rpc_generic.c,v 1.4 2000/09/28 09:07:04 kleink Exp $ */ 2 3/* 4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5 * unrestricted use provided that this legend is included on all tape 6 * media and as a part of the software program in whole or part. Users 7 * may copy or modify Sun RPC without charge, but are not authorized 8 * to license or distribute it to anyone else except as part of a product or --- 20 unchanged lines hidden (view full) --- 29 * Mountain View, California 94043 30 */ 31/* 32 * Copyright (c) 1986-1991 by Sun Microsystems Inc. 33 */ 34 35/* #pragma ident "@(#)rpc_generic.c 1.17 94/04/24 SMI" */ 36#include <sys/cdefs.h> | 1/* $NetBSD: rpc_generic.c,v 1.4 2000/09/28 09:07:04 kleink Exp $ */ 2 3/* 4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for 5 * unrestricted use provided that this legend is included on all tape 6 * media and as a part of the software program in whole or part. Users 7 * may copy or modify Sun RPC without charge, but are not authorized 8 * to license or distribute it to anyone else except as part of a product or --- 20 unchanged lines hidden (view full) --- 29 * Mountain View, California 94043 30 */ 31/* 32 * Copyright (c) 1986-1991 by Sun Microsystems Inc. 33 */ 34 35/* #pragma ident "@(#)rpc_generic.c 1.17 94/04/24 SMI" */ 36#include <sys/cdefs.h> |
37__FBSDID("$FreeBSD: head/sys/rpc/rpc_generic.c 196503 2009-08-24 10:09:30Z zec $"); | 37__FBSDID("$FreeBSD: head/sys/rpc/rpc_generic.c 213103 2010-09-24 15:01:45Z attilio $"); |
38 39/* 40 * rpc_generic.c, Miscl routines for RPC. 41 * 42 */ 43 44#include "opt_inet6.h" 45 --- 255 unchanged lines hidden (view full) --- 301#endif 302 u_int16_t port; 303 304 sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND); 305 306 switch (af) { 307 case AF_INET: 308 sin = nbuf->buf; | 38 39/* 40 * rpc_generic.c, Miscl routines for RPC. 41 * 42 */ 43 44#include "opt_inet6.h" 45 --- 255 unchanged lines hidden (view full) --- 301#endif 302 u_int16_t port; 303 304 sbuf_new(&sb, NULL, 0, SBUF_AUTOEXTEND); 305 306 switch (af) { 307 case AF_INET: 308 sin = nbuf->buf; |
309 if (__rpc_inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) | 309 if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) |
310 == NULL) 311 return NULL; 312 port = ntohs(sin->sin_port); 313 if (sbuf_printf(&sb, "%s.%u.%u", namebuf, 314 ((uint32_t)port) >> 8, 315 port & 0xff) < 0) 316 return NULL; 317 break; 318#ifdef INET6 319 case AF_INET6: 320 sin6 = nbuf->buf; | 310 == NULL) 311 return NULL; 312 port = ntohs(sin->sin_port); 313 if (sbuf_printf(&sb, "%s.%u.%u", namebuf, 314 ((uint32_t)port) >> 8, 315 port & 0xff) < 0) 316 return NULL; 317 break; 318#ifdef INET6 319 case AF_INET6: 320 sin6 = nbuf->buf; |
321 if (__rpc_inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) | 321 if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) |
322 == NULL) 323 return NULL; 324 port = ntohs(sin6->sin6_port); 325 if (sbuf_printf(&sb, "%s.%u.%u", namebuf6, 326 ((uint32_t)port) >> 8, 327 port & 0xff) < 0) 328 return NULL; 329 break; --- 61 unchanged lines hidden (view full) --- 391 case AF_INET: 392 sin = (struct sockaddr_in *)malloc(sizeof *sin, M_RPC, 393 M_WAITOK); 394 if (sin == NULL) 395 goto out; 396 memset(sin, 0, sizeof *sin); 397 sin->sin_family = AF_INET; 398 sin->sin_port = htons(port); | 322 == NULL) 323 return NULL; 324 port = ntohs(sin6->sin6_port); 325 if (sbuf_printf(&sb, "%s.%u.%u", namebuf6, 326 ((uint32_t)port) >> 8, 327 port & 0xff) < 0) 328 return NULL; 329 break; --- 61 unchanged lines hidden (view full) --- 391 case AF_INET: 392 sin = (struct sockaddr_in *)malloc(sizeof *sin, M_RPC, 393 M_WAITOK); 394 if (sin == NULL) 395 goto out; 396 memset(sin, 0, sizeof *sin); 397 sin->sin_family = AF_INET; 398 sin->sin_port = htons(port); |
399 if (__rpc_inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { | 399 if (inet_pton(AF_INET, addrstr, &sin->sin_addr) <= 0) { |
400 free(sin, M_RPC); 401 free(ret, M_RPC); 402 ret = NULL; 403 goto out; 404 } 405 sin->sin_len = ret->maxlen = ret->len = sizeof *sin; 406 ret->buf = sin; 407 break; 408#ifdef INET6 409 case AF_INET6: 410 sin6 = (struct sockaddr_in6 *)malloc(sizeof *sin6, M_RPC, 411 M_WAITOK); 412 if (sin6 == NULL) 413 goto out; 414 memset(sin6, 0, sizeof *sin6); 415 sin6->sin6_family = AF_INET6; 416 sin6->sin6_port = htons(port); | 400 free(sin, M_RPC); 401 free(ret, M_RPC); 402 ret = NULL; 403 goto out; 404 } 405 sin->sin_len = ret->maxlen = ret->len = sizeof *sin; 406 ret->buf = sin; 407 break; 408#ifdef INET6 409 case AF_INET6: 410 sin6 = (struct sockaddr_in6 *)malloc(sizeof *sin6, M_RPC, 411 M_WAITOK); 412 if (sin6 == NULL) 413 goto out; 414 memset(sin6, 0, sizeof *sin6); 415 sin6->sin6_family = AF_INET6; 416 sin6->sin6_port = htons(port); |
417 if (__rpc_inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { | 417 if (inet_pton(AF_INET6, addrstr, &sin6->sin6_addr) <= 0) { |
418 free(sin6, M_RPC); 419 free(ret, M_RPC); 420 ret = NULL; 421 goto out; 422 } 423 sin6->sin6_len = ret->maxlen = ret->len = sizeof *sin6; 424 ret->buf = sin6; 425 break; --- 458 unchanged lines hidden --- | 418 free(sin6, M_RPC); 419 free(ret, M_RPC); 420 ret = NULL; 421 goto out; 422 } 423 sin6->sin6_len = ret->maxlen = ret->len = sizeof *sin6; 424 ret->buf = sin6; 425 break; --- 458 unchanged lines hidden --- |