* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING. If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This file is required in order to support properly the RIPng nexthop
int _ripng_rte_cmp(struct ripng_rte_data *A, struct ripng_rte_data *B);
#define METRIC_OUT(a) \
- (a->rinfo ? a->rinfo->metric_out : a->aggregate->metric_out)
-#define NEXTHOP_OUT(a) \
- (a->rinfo ? a->rinfo->nexthop_out : a->aggregate->nexthop_out)
+ ((a)->rinfo ? (a)->rinfo->metric_out : (a)->aggregate->metric_out)
+#define NEXTHOP_OUT_PTR(a) \
+ ((a)->rinfo ? &((a)->rinfo->nexthop_out) : &((a)->aggregate->nexthop_out))
#define TAG_OUT(a) \
- (a->rinfo ? a->rinfo->tag_out : a->aggregate->tag_out)
+ ((a)->rinfo ? (a)->rinfo->tag_out : (a)->aggregate->tag_out)
struct list *
ripng_rte_new(void) {
*/
int
_ripng_rte_cmp(struct ripng_rte_data *A, struct ripng_rte_data *B) {
- return addr6_cmp(&NEXTHOP_OUT(A), &NEXTHOP_OUT(B));
+ return addr6_cmp(NEXTHOP_OUT_PTR(A), NEXTHOP_OUT_PTR(B));
}
/* Add routing table entry */
struct sockaddr_in6 *to) {
struct ripng_rte_data *data;
- struct listnode * nn;
+ struct listnode *node, *nnode;
struct in6_addr last_nexthop;
struct in6_addr myself_nexthop;
stream_reset (s);
num = 0;
- mtu = ifp->mtu;
+ mtu = ifp->mtu6;
if (mtu < 0)
mtu = IFMINMTU;
sizeof (struct ripng_packet) +
sizeof (struct rte)) / sizeof (struct rte);
- LIST_LOOP(ripng_rte_list, data, nn) {
-
+ for (ALL_LIST_ELEMENTS (ripng_rte_list, node, nnode, data)) {
/* (2.1) Next hop support */
- if (!IPV6_ADDR_SAME(&last_nexthop, &NEXTHOP_OUT(data))) {
+ if (!IPV6_ADDR_SAME(&last_nexthop, NEXTHOP_OUT_PTR(data))) {
/* A nexthop entry should be at least followed by 1 RTE */
if (num == (rtemax-1)) {
- ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s),
+ ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s),
to, ifp);
if (ret >= 0 && IS_RIPNG_DEBUG_SEND)
/* If the received next hop address is not a link-local address,
* it should be treated as 0:0:0:0:0:0:0:0.
*/
- if (!IN6_IS_ADDR_LINKLOCAL(&NEXTHOP_OUT(data)))
+ if (!IN6_IS_ADDR_LINKLOCAL(NEXTHOP_OUT_PTR(data)))
last_nexthop = myself_nexthop;
else
- last_nexthop = NEXTHOP_OUT(data);
+ last_nexthop = *NEXTHOP_OUT_PTR(data);
num = ripng_write_rte(num, s, NULL, &last_nexthop, 0, RIPNG_METRIC_NEXTHOP);
} else {
TAG_OUT(data), METRIC_OUT(data));
if (num == rtemax) {
- ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s),
+ ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s),
to, ifp);
if (ret >= 0 && IS_RIPNG_DEBUG_SEND)
/* If unwritten RTE exist, flush it. */
if (num != 0) {
- ret = ripng_send_packet (STREAM_DATA (s), stream_get_endp (s),
+ ret = ripng_send_packet ((caddr_t) STREAM_DATA (s), stream_get_endp (s),
to, ifp);
if (ret >= 0 && IS_RIPNG_DEBUG_SEND)
ripng_packet_dump ((struct ripng_packet *)STREAM_DATA (s),
stream_get_endp (s), "SEND");
- num = 0;
stream_reset (s);
}
}