Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Use ifatoia() and sintosa() consistently, rather...



details:   https://anonhg.NetBSD.org/src/rev/9344b11f1448
branches:  trunk
changeset: 481491:9344b11f1448
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Feb 01 00:07:09 2000 +0000

description:
Use ifatoia() and sintosa() consistently, rather than using home-grown
casting macros intermixed.

diffstat:

 sys/netinet/ip_input.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (57 lines):

diff -r de2f69668763 -r 9344b11f1448 sys/netinet/ip_input.c
--- a/sys/netinet/ip_input.c    Tue Feb 01 00:05:07 2000 +0000
+++ b/sys/netinet/ip_input.c    Tue Feb 01 00:07:09 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_input.c,v 1.95 2000/01/31 14:18:54 itojun Exp $     */
+/*     $NetBSD: ip_input.c,v 1.96 2000/02/01 00:07:09 thorpej Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -995,11 +995,9 @@
                         */
                        bcopy((caddr_t)(cp + off), (caddr_t)&ipaddr.sin_addr,
                            sizeof(ipaddr.sin_addr));
-                       if (opt == IPOPT_SSRR) {
-#define        INA     struct in_ifaddr *
-#define        SA      struct sockaddr *
-                           ia = (INA)ifa_ifwithladdr((SA)&ipaddr);
-                       } else
+                       if (opt == IPOPT_SSRR)
+                               ia = ifatoia(ifa_ifwithaddr(sintosa(&ipaddr)));
+                       else
                                ia = ip_rtaddr(ipaddr.sin_addr);
                        if (ia == 0) {
                                type = ICMP_UNREACH;
@@ -1033,8 +1031,9 @@
                         * locate outgoing interface; if we're the destination,
                         * use the incoming interface (should be same).
                         */
-                       if ((ia = (INA)ifa_ifwithaddr((SA)&ipaddr)) == 0 &&
-                           (ia = ip_rtaddr(ipaddr.sin_addr)) == 0) {
+                       if ((ia = ifatoia(ifa_ifwithaddr(sintosa(&ipaddr))))
+                           == NULL &&
+                           (ia = ip_rtaddr(ipaddr.sin_addr)) == NULL) {
                                type = ICMP_UNREACH;
                                code = ICMP_UNREACH_HOST;
                                goto bad;
@@ -1065,8 +1064,8 @@
                                    sizeof(struct in_addr) > ipt->ipt_len)
                                        goto bad;
                                ipaddr.sin_addr = dst;
-                               ia = (INA)ifaof_ifpforaddr((SA)&ipaddr,
-                                                           m->m_pkthdr.rcvif);
+                               ia = ifatoia(ifaof_ifpforaddr(sintosa(&ipaddr),
+                                   m->m_pkthdr.rcvif));
                                if (ia == 0)
                                        continue;
                                bcopy((caddr_t)&ia->ia_addr.sin_addr,
@@ -1080,7 +1079,8 @@
                                        goto bad;
                                bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr,
                                    sizeof(struct in_addr));
-                               if (ifa_ifwithaddr((SA)&ipaddr) == 0)
+                               if (ifatoia(ifa_ifwithaddr(sintosa(&ipaddr)))
+                                   == NULL)
                                        continue;
                                ipt->ipt_ptr += sizeof(struct in_addr);
                                break;



Home | Main Index | Thread Index | Old Index