Deleted Added
full compact
ipsec.c (164056) ipsec.c (165118)
1/* $FreeBSD: head/sys/netipsec/ipsec.c 164056 2006-11-07 08:58:06Z rwatson $ */
1/* $FreeBSD: head/sys/netipsec/ipsec.c 165118 2006-12-12 12:17:58Z bz $ */
2/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 1817 unchanged lines hidden (view full) ---

1827/* Return a printable string for the IPv4 address. */
1828static char *
1829inet_ntoa4(struct in_addr ina)
1830{
1831 static char buf[4][4 * sizeof "123" + 4];
1832 unsigned char *ucp = (unsigned char *) &ina;
1833 static int i = 3;
1834
2/* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
3
4/*-
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions

--- 1817 unchanged lines hidden (view full) ---

1827/* Return a printable string for the IPv4 address. */
1828static char *
1829inet_ntoa4(struct in_addr ina)
1830{
1831 static char buf[4][4 * sizeof "123" + 4];
1832 unsigned char *ucp = (unsigned char *) &ina;
1833 static int i = 3;
1834
1835 /* XXX-BZ returns static buffer. */
1835 i = (i + 1) % 4;
1836 sprintf(buf[i], "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff,
1837 ucp[2] & 0xff, ucp[3] & 0xff);
1838 return (buf[i]);
1839}
1840
1841/* Return a printable string for the address. */
1842char *
1843ipsec_address(union sockaddr_union* sa)
1844{
1836 i = (i + 1) % 4;
1837 sprintf(buf[i], "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff,
1838 ucp[2] & 0xff, ucp[3] & 0xff);
1839 return (buf[i]);
1840}
1841
1842/* Return a printable string for the address. */
1843char *
1844ipsec_address(union sockaddr_union* sa)
1845{
1846#if INET6
1847 char ip6buf[INET6_ADDRSTRLEN];
1848#endif
1845 switch (sa->sa.sa_family) {
1846#ifdef INET
1847 case AF_INET:
1848 return inet_ntoa4(sa->sin.sin_addr);
1849#endif /* INET */
1850
1851#ifdef INET6
1852 case AF_INET6:
1849 switch (sa->sa.sa_family) {
1850#ifdef INET
1851 case AF_INET:
1852 return inet_ntoa4(sa->sin.sin_addr);
1853#endif /* INET */
1854
1855#ifdef INET6
1856 case AF_INET6:
1853 return ip6_sprintf(&sa->sin6.sin6_addr);
1857 return ip6_sprintf(ip6buf, &sa->sin6.sin6_addr);
1854#endif /* INET6 */
1855
1856 default:
1857 return "(unknown address family)";
1858 }
1859}
1860
1861const char *

--- 88 unchanged lines hidden ---
1858#endif /* INET6 */
1859
1860 default:
1861 return "(unknown address family)";
1862 }
1863}
1864
1865const char *

--- 88 unchanged lines hidden ---