pktgen.c (0373a94671be1f5c823dbfc03617418d8effd5ce) pktgen.c (4c139b8ccebaecdfad58eb068d61ef386f1a58ed)
1/*
2 * Authors:
3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se>
4 * Uppsala University and
5 * Swedish University of Agricultural Sciences
6 *
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * Ben Greear <greearb@candelatech.com>

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

2032
2033 if (is_zero_ether_addr(pkt_dev->src_mac))
2034 memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN);
2035
2036 /* Set up Dest MAC */
2037 memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
2038
2039 if (pkt_dev->flags & F_IPV6) {
1/*
2 * Authors:
3 * Copyright 2001, 2002 by Robert Olsson <robert.olsson@its.uu.se>
4 * Uppsala University and
5 * Swedish University of Agricultural Sciences
6 *
7 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
8 * Ben Greear <greearb@candelatech.com>

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

2032
2033 if (is_zero_ether_addr(pkt_dev->src_mac))
2034 memcpy(&(pkt_dev->hh[6]), pkt_dev->odev->dev_addr, ETH_ALEN);
2035
2036 /* Set up Dest MAC */
2037 memcpy(&(pkt_dev->hh[0]), pkt_dev->dst_mac, ETH_ALEN);
2038
2039 if (pkt_dev->flags & F_IPV6) {
2040 int i, set = 0, err = 1;
2041 struct inet6_dev *idev;
2042
2040 if (pkt_dev->min_pkt_size == 0) {
2041 pkt_dev->min_pkt_size = 14 + sizeof(struct ipv6hdr)
2042 + sizeof(struct udphdr)
2043 + sizeof(struct pktgen_hdr)
2044 + pkt_dev->pkt_overhead;
2045 }
2046
2043 if (pkt_dev->min_pkt_size == 0) {
2044 pkt_dev->min_pkt_size = 14 + sizeof(struct ipv6hdr)
2045 + sizeof(struct udphdr)
2046 + sizeof(struct pktgen_hdr)
2047 + pkt_dev->pkt_overhead;
2048 }
2049
2047 /*
2048 * Skip this automatic address setting until locks or functions
2049 * gets exported
2050 */
2051
2052#ifdef NOTNOW
2053 int i, set = 0, err = 1;
2054 struct inet6_dev *idev;
2055
2056 for (i = 0; i < IN6_ADDR_HSIZE; i++)
2057 if (pkt_dev->cur_in6_saddr.s6_addr[i]) {
2058 set = 1;
2059 break;
2060 }
2061
2062 if (!set) {
2063

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

2068 */
2069
2070 rcu_read_lock();
2071 idev = __in6_dev_get(pkt_dev->odev);
2072 if (idev) {
2073 struct inet6_ifaddr *ifp;
2074
2075 read_lock_bh(&idev->lock);
2050 for (i = 0; i < IN6_ADDR_HSIZE; i++)
2051 if (pkt_dev->cur_in6_saddr.s6_addr[i]) {
2052 set = 1;
2053 break;
2054 }
2055
2056 if (!set) {
2057

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

2062 */
2063
2064 rcu_read_lock();
2065 idev = __in6_dev_get(pkt_dev->odev);
2066 if (idev) {
2067 struct inet6_ifaddr *ifp;
2068
2069 read_lock_bh(&idev->lock);
2076 for (ifp = idev->addr_list; ifp;
2077 ifp = ifp->if_next) {
2078 if (ifp->scope == IFA_LINK &&
2070 list_for_each_entry(ifp, &idev->addr_list, if_list) {
2071 if ((ifp->scope & IFA_LINK) &&
2079 !(ifp->flags & IFA_F_TENTATIVE)) {
2080 pkt_dev->cur_in6_saddr = ifp->addr;
2081 err = 0;
2082 break;
2083 }
2084 }
2085 read_unlock_bh(&idev->lock);
2086 }
2087 rcu_read_unlock();
2088 if (err)
2089 pr_err("ERROR: IPv6 link address not available\n");
2090 }
2072 !(ifp->flags & IFA_F_TENTATIVE)) {
2073 pkt_dev->cur_in6_saddr = ifp->addr;
2074 err = 0;
2075 break;
2076 }
2077 }
2078 read_unlock_bh(&idev->lock);
2079 }
2080 rcu_read_unlock();
2081 if (err)
2082 pr_err("ERROR: IPv6 link address not available\n");
2083 }
2091#endif
2092 } else {
2093 if (pkt_dev->min_pkt_size == 0) {
2094 pkt_dev->min_pkt_size = 14 + sizeof(struct iphdr)
2095 + sizeof(struct udphdr)
2096 + sizeof(struct pktgen_hdr)
2097 + pkt_dev->pkt_overhead;
2098 }
2099

--- 1704 unchanged lines hidden ---
2084 } else {
2085 if (pkt_dev->min_pkt_size == 0) {
2086 pkt_dev->min_pkt_size = 14 + sizeof(struct iphdr)
2087 + sizeof(struct udphdr)
2088 + sizeof(struct pktgen_hdr)
2089 + pkt_dev->pkt_overhead;
2090 }
2091

--- 1704 unchanged lines hidden ---