From 6d0732c8abad7ace509d033a41814ea03a3a1b16 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 28 Sep 2011 14:23:35 +0400 Subject: IPv6 transport class suppport IPv6 supports the same concept of differentiated service for routing protocols as IPv4, but like too many things, the standards committee decided that having two names for the same thing wasn't good enough and introduced a third more generic term transport class. The socket option to set transport class works the same as IPv4, but the arguments are different. * lib/sockopt.[ch] * setsockopt_ipv6_tclass(): new function * bgpd/bgp_network.c * bgp_connect(): set socket option * bgp_listener(): set socket option * ospf6d/ospf6_network.c * ospf6_set_transport_class(): new function * ospf6_serv_sock(): set socket option * ripngd/ripngd.c * ripng_make_socket(): set socket option --- ospf6d/ospf6_network.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ospf6d/ospf6_network.c') diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 96b82af3..3372238b 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -63,6 +63,14 @@ ospf6_set_pktinfo (void) setsockopt_ipv6_pktinfo (ospf6_sock, 1); } +void +ospf6_set_transport_class (void) +{ +#ifdef IPTOS_PREC_INTERNETCONTROL + setsockopt_ipv6_tclass (ospf6_sock, IPTOS_PREC_INTERNETCONTROL); +#endif +} + void ospf6_set_checksum (void) { @@ -102,6 +110,7 @@ ospf6_serv_sock (void) #endif /*1*/ ospf6_reset_mcastloop (); ospf6_set_pktinfo (); + ospf6_set_transport_class (); ospf6_set_checksum (); /* setup global in6_addr, allspf6 and alldr6 for later use */ -- cgit v1.2.1 From 9a9446eabb8f153251d6d93d225a68ca44b436ac Mon Sep 17 00:00:00 2001 From: Vyacheslav Trushkin Date: Mon, 21 Nov 2011 20:26:39 +0400 Subject: ospf6d: justify multicast group management * ospf6_network.[ch] * ospf6_sso(): new function supersedes ospf6_join_allspfrouters(), ospf6_leave_allspfrouters(), ospf6_join_alldrouters() and ospf6_leave_alldrouters() * ospf6_interface.c * ospf6_interface_state_change(): update respectively * interface_up(): ditto * interface_down(): ditto --- ospf6d/ospf6_network.c | 82 ++++++-------------------------------------------- 1 file changed, 9 insertions(+), 73 deletions(-) (limited to 'ospf6d/ospf6_network.c') diff --git a/ospf6d/ospf6_network.c b/ospf6d/ospf6_network.c index 3372238b..e5a1436c 100644 --- a/ospf6d/ospf6_network.c +++ b/ospf6d/ospf6_network.c @@ -120,86 +120,22 @@ ospf6_serv_sock (void) return 0; } +/* ospf6 set socket option */ void -ospf6_join_allspfrouters (u_int ifindex) -{ - struct ipv6_mreq mreq6; - int retval; - - assert (ifindex); - mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, - sizeof (struct in6_addr)); - - retval = setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, - &mreq6, sizeof (mreq6)); - - if (retval < 0) - zlog_err ("Network: Join AllSPFRouters on ifindex %d failed: %s", - ifindex, safe_strerror (errno)); -#if 0 - else - zlog_debug ("Network: Join AllSPFRouters on ifindex %d", ifindex); -#endif -} - -void -ospf6_leave_allspfrouters (u_int ifindex) -{ - struct ipv6_mreq mreq6; - - assert (ifindex); - mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &allspfrouters6, - sizeof (struct in6_addr)); - - if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, - &mreq6, sizeof (mreq6)) < 0) - zlog_warn ("Network: Leave AllSPFRouters on ifindex %d Failed: %s", - ifindex, safe_strerror (errno)); -#if 0 - else - zlog_debug ("Network: Leave AllSPFRouters on ifindex %d", ifindex); -#endif -} - -void -ospf6_join_alldrouters (u_int ifindex) -{ - struct ipv6_mreq mreq6; - - assert (ifindex); - mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, - sizeof (struct in6_addr)); - - if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, - &mreq6, sizeof (mreq6)) < 0) - zlog_warn ("Network: Join AllDRouters on ifindex %d Failed: %s", - ifindex, safe_strerror (errno)); -#if 0 - else - zlog_debug ("Network: Join AllDRouters on ifindex %d", ifindex); -#endif -} - -void -ospf6_leave_alldrouters (u_int ifindex) +ospf6_sso (u_int ifindex, struct in6_addr *group, int option) { struct ipv6_mreq mreq6; + int ret; assert (ifindex); mreq6.ipv6mr_interface = ifindex; - memcpy (&mreq6.ipv6mr_multiaddr, &alldrouters6, - sizeof (struct in6_addr)); + memcpy (&mreq6.ipv6mr_multiaddr, group, sizeof (struct in6_addr)); - if (setsockopt (ospf6_sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, - &mreq6, sizeof (mreq6)) < 0) - zlog_warn ("Network: Leave AllDRouters on ifindex %d Failed", ifindex); -#if 0 - else - zlog_debug ("Network: Leave AllDRouters on ifindex %d", ifindex); -#endif + ret = setsockopt (ospf6_sock, IPPROTO_IPV6, option, + &mreq6, sizeof (mreq6)); + if (ret < 0) + zlog_err ("Network: setsockopt (%d) on ifindex %d failed: %s", + option, ifindex, safe_strerror (errno)); } static int -- cgit v1.2.1