Date: Fri, 6 Apr 2018 23:31:47 +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-11@freebsd.org Subject: svn commit: r332159 - in stable/11/sys: net ofed/drivers/infiniband/ulp/ipoib Message-ID: <201804062331.w36NVlVh052383@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: brooks Date: Fri Apr 6 23:31:47 2018 New Revision: 332159 URL: https://svnweb.freebsd.org/changeset/base/332159 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/11/sys/net/if_arcsubr.c stable/11/sys/net/if_ethersubr.c stable/11/sys/net/if_fddisubr.c stable/11/sys/net/if_fwsubr.c stable/11/sys/net/if_iso88025subr.c stable/11/sys/net/if_vlan.c stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_arcsubr.c ============================================================================== --- stable/11/sys/net/if_arcsubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_arcsubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -679,12 +679,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/11/sys/net/if_ethersubr.c ============================================================================== --- stable/11/sys/net/if_ethersubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_ethersubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -1084,13 +1084,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/11/sys/net/if_fddisubr.c ============================================================================== --- stable/11/sys/net/if_fddisubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_fddisubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -556,14 +556,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/11/sys/net/if_fwsubr.c ============================================================================== --- stable/11/sys/net/if_fwsubr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_fwsubr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -660,13 +660,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/11/sys/net/if_iso88025subr.c ============================================================================== --- stable/11/sys/net/if_iso88025subr.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_iso88025subr.c Fri Apr 6 23:31:47 2018 (r332159) @@ -171,13 +171,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/11/sys/net/if_vlan.c ============================================================================== --- stable/11/sys/net/if_vlan.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/net/if_vlan.c Fri Apr 6 23:31:47 2018 (r332159) @@ -1842,12 +1842,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_SLOCK(); Modified: stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Apr 6 23:25:54 2018 (r332158) +++ stable/11/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Fri Apr 6 23:31:47 2018 (r332159) @@ -318,13 +318,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?201804062331.w36NVlVh052383>