Date: Sat, 7 Apr 2018 00:04:28 +0000 (UTC) From: Brooks Davis <brooks@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r332160 - in stable/10/sys: net ofed/drivers/infiniband/ulp/ipoib Message-ID: <201804070004.w3704S5S069086@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Sat Apr 7 00:04:28 2018 New Revision: 332160 URL: https://svnweb.freebsd.org/changeset/base/332160 Log: MFC r331648: Improve copy-and-pasted versions of SIOCGIFADDR. The original implementation used a reference to ifr_data and a cast to do the equivalent of accessing ifr_addr. This was copied multiple times since 1996. Approved by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14873 Modified: stable/10/sys/net/if_arcsubr.c stable/10/sys/net/if_ethersubr.c stable/10/sys/net/if_fddisubr.c stable/10/sys/net/if_fwsubr.c stable/10/sys/net/if_iso88025subr.c stable/10/sys/net/if_vlan.c stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/if_arcsubr.c ============================================================================== --- stable/10/sys/net/if_arcsubr.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_arcsubr.c Sat Apr 7 00:04:28 2018 (r332160) @@ -715,12 +715,7 @@ arc_ioctl(struct ifnet *ifp, u_long command, caddr_t d break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) &ifr->ifr_data; - *(u_int8_t *)sa->sa_data = ARC_LLADDR(ifp); - } + ifr->ifr_addr.sa_data[0] = ARC_LLADDR(ifp); break; case SIOCADDMULTI: Modified: stable/10/sys/net/if_ethersubr.c ============================================================================== --- stable/10/sys/net/if_ethersubr.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_ethersubr.c Sat Apr 7 00:04:28 2018 (r332160) @@ -1109,13 +1109,8 @@ ether_ioctl(struct ifnet *ifp, u_long command, caddr_t break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, ETHER_ADDR_LEN); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ETHER_ADDR_LEN); break; case SIOCSIFMTU: Modified: stable/10/sys/net/if_fddisubr.c ============================================================================== --- stable/10/sys/net/if_fddisubr.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_fddisubr.c Sat Apr 7 00:04:28 2018 (r332160) @@ -669,14 +669,9 @@ fddi_ioctl (ifp, command, data) break; } break; - case SIOCGIFADDR: { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, FDDI_ADDR_LEN); - - } + case SIOCGIFADDR: + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + FDDI_ADDR_LEN); break; case SIOCSIFMTU: /* Modified: stable/10/sys/net/if_fwsubr.c ============================================================================== --- stable/10/sys/net/if_fwsubr.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_fwsubr.c Sat Apr 7 00:04:28 2018 (r332160) @@ -656,13 +656,8 @@ firewire_ioctl(struct ifnet *ifp, u_long command, cadd break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(&IFP2FWC(ifp)->fc_hwaddr, - (caddr_t) sa->sa_data, sizeof(struct fw_hwaddr)); - } + bcopy(&IFP2FWC(ifp)->fc_hwaddr, &ifr->ifr_addr.sa_data[0], + sizeof(struct fw_hwaddr)); break; case SIOCSIFMTU: Modified: stable/10/sys/net/if_iso88025subr.c ============================================================================== --- stable/10/sys/net/if_iso88025subr.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_iso88025subr.c Sat Apr 7 00:04:28 2018 (r332160) @@ -200,13 +200,9 @@ iso88025_ioctl(struct ifnet *ifp, u_long command, cadd } break; - case SIOCGIFADDR: { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, ISO88025_ADDR_LEN); - } + case SIOCGIFADDR: + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ISO88025_ADDR_LEN); break; case SIOCSIFMTU: Modified: stable/10/sys/net/if_vlan.c ============================================================================== --- stable/10/sys/net/if_vlan.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/net/if_vlan.c Sat Apr 7 00:04:28 2018 (r332160) @@ -1588,12 +1588,8 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data #endif break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *)&ifr->ifr_data; - bcopy(IF_LLADDR(ifp), sa->sa_data, ifp->if_addrlen); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + ifp->if_addrlen); break; case SIOCGIFMEDIA: VLAN_LOCK(); Modified: stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Apr 6 23:31:47 2018 (r332159) +++ stable/10/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Sat Apr 7 00:04:28 2018 (r332160) @@ -293,13 +293,8 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t break; case SIOCGIFADDR: - { - struct sockaddr *sa; - - sa = (struct sockaddr *) & ifr->ifr_data; - bcopy(IF_LLADDR(ifp), - (caddr_t) sa->sa_data, INFINIBAND_ALEN); - } + bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0], + INFINIBAND_ALEN); break; case SIOCSIFMTU:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804070004.w3704S5S069086>