diff options
author | jlemon <jlemon@FreeBSD.org> | 2001-09-29 03:23:44 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2001-09-29 03:23:44 +0000 |
commit | 17d77e934622c40b38b3ea7e9d9486bf6c67f15f (patch) | |
tree | 091b8f79b7b11be3575beb9da2c81c7da171d9cf /sys | |
parent | 420d4edc40d7c01a1b518636ee82a20d85ad87fc (diff) | |
download | FreeBSD-src-17d77e934622c40b38b3ea7e9d9486bf6c67f15f.zip FreeBSD-src-17d77e934622c40b38b3ea7e9d9486bf6c67f15f.tar.gz |
Centralize satosin(), sintosa() and ifatoia() macros in <netinet/in.h>
Remove local definitions.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/netinet/in.h | 4 | ||||
-rw-r--r-- | sys/netinet/in_pcb.c | 3 | ||||
-rw-r--r-- | sys/netinet/in_rmx.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_input.c | 4 | ||||
-rw-r--r-- | sys/netinet/ip_output.c | 4 |
5 files changed, 6 insertions, 11 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h index a80877d..9ea89cd 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -477,6 +477,10 @@ int in_localaddr __P((struct in_addr)); char *inet_ntoa __P((struct in_addr)); /* in libkern */ char *inet_ntoa_r __P((struct in_addr ina, char *buf)); /* in libkern */ +#define satosin(sa) ((struct sockaddr_in *)(sa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) +#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) + #endif #endif diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 1db834c..2725e80 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -399,9 +399,6 @@ in_pcbladdr(inp, nam, plocal_sin) * and the primary interface supports broadcast, * choose the broadcast address for that interface. */ -#define satosin(sa) ((struct sockaddr_in *)(sa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) if (sin->sin_addr.s_addr == INADDR_ANY) sin->sin_addr = IA_SIN(TAILQ_FIRST(&in_ifaddrhead))->sin_addr; else if (sin->sin_addr.s_addr == (u_long)INADDR_BROADCAST && diff --git a/sys/netinet/in_rmx.c b/sys/netinet/in_rmx.c index bfd65e6..59bbb8d 100644 --- a/sys/netinet/in_rmx.c +++ b/sys/netinet/in_rmx.c @@ -101,11 +101,9 @@ in_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, if (in_broadcast(sin->sin_addr, rt->rt_ifp)) { rt->rt_flags |= RTF_BROADCAST; } else { -#define satosin(sa) ((struct sockaddr_in *)sa) if (satosin(rt->rt_ifa->ifa_addr)->sin_addr.s_addr == sin->sin_addr.s_addr) rt->rt_flags |= RTF_LOCAL; -#undef satosin } } diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 9c0615b..0f391f1 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -558,7 +558,6 @@ pass: (ip_fw_fwd_addr == NULL); TAILQ_FOREACH(ia, &in_ifaddrhead, ia_link) { -#define satosin(sa) ((struct sockaddr_in *)(sa)) #ifdef BOOTP_COMPAT if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY) @@ -1428,7 +1427,7 @@ ip_rtaddr(dst) } if (ipforward_rt.ro_rt == 0) return ((struct in_ifaddr *)0); - return ((struct in_ifaddr *) ipforward_rt.ro_rt->rt_ifa); + return (ifatoia(ipforward_rt.ro_rt->rt_ifa)); } /* @@ -1653,7 +1652,6 @@ ip_forward(m, srcrt) * Also, don't send redirect if forwarding using a default route * or a route modified by a redirect. */ -#define satosin(sa) ((struct sockaddr_in *)(sa)) if (rt->rt_ifp == m->m_pkthdr.rcvif && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && satosin(rt_key(rt))->sin_addr.s_addr != 0 && diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index 012a3c4..49e2c74 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -180,7 +180,7 @@ ip_output(m0, opt, ro, flags, imo) #endif ip = mtod(m, struct ip *); hlen = IP_VHL_HL(ip->ip_vhl) << 2 ; - ia = (struct in_ifaddr *)ro->ro_rt->rt_ifa; + ia = ifatoia(ro->ro_rt->rt_ifa); goto sendit; } else rule = NULL ; @@ -238,8 +238,6 @@ ip_output(m0, opt, ro, flags, imo) * If routing to interface only, * short circuit routing lookup. */ -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) if (flags & IP_ROUTETOIF) { if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { |