summaryrefslogtreecommitdiffstats
path: root/ospfd
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-12-05 19:43:38 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-12-05 19:48:38 +0100
commit53dc2b05c76f4f5cd6a72373fb241afdcedb2ee1 (patch)
treed43e2f4f851f368dcc943a9b30e73ff603ea5bc1 /ospfd
parentMerge branch 'stable/2.0' (diff)
parentbuild: number sections in COMMUNITY.md HTML (diff)
downloadfrr-53dc2b05c76f4f5cd6a72373fb241afdcedb2ee1.tar.xz
frr-53dc2b05c76f4f5cd6a72373fb241afdcedb2ee1.zip
Merge branch 'stable/2.0'
Conflicts: bgpd/bgp_route.c lib/if.c ripd/rip_interface.c zebra/interface.c zebra/zebra_vty.c
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ospf_network.c8
-rw-r--r--ospfd/ospf_packet.c18
-rw-r--r--ospfd/ospf_vty.c13
3 files changed, 23 insertions, 16 deletions
diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c
index 6caa38d68..088123ea2 100644
--- a/ospfd/ospf_network.c
+++ b/ospfd/ospf_network.c
@@ -132,18 +132,16 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *p, ifindex_t ifindex)
{
u_char val;
int ret, len;
-
- val = 0;
- len = sizeof (val);
-
+
/* Prevent receiving self-origined multicast packets. */
- ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, len);
+ ret = setsockopt_ipv4_multicast_loop (top->fd, 0);
if (ret < 0)
zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0) for fd %d: %s",
top->fd, safe_strerror(errno));
/* Explicitly set multicast ttl to 1 -- endo. */
val = 1;
+ len = sizeof (val);
ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, len);
if (ret < 0)
zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s",
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index b7ef24409..72ce5586f 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -2772,6 +2772,7 @@ ospf_read (struct thread *thread)
struct ospf_header *ospfh;
u_int16_t length;
struct interface *ifp;
+ struct connected *c;
/* first of all get interface pointer. */
ospf = THREAD_ARG (thread);
@@ -2790,13 +2791,16 @@ ospf_read (struct thread *thread)
/* Note that sockopt_iphdrincl_swab_systoh was called in ospf_recv_packet. */
if (ifp == NULL)
- /* Handle cases where the platform does not support retrieving the ifindex,
- and also platforms (such as Solaris 8) that claim to support ifindex
- retrieval but do not. */
- ifp = if_lookup_address ((void *)&iph->ip_src, AF_INET);
-
- if (ifp == NULL)
- return 0;
+ {
+ /* Handle cases where the platform does not support retrieving the ifindex,
+ and also platforms (such as Solaris 8) that claim to support ifindex
+ retrieval but do not. */
+ c = if_lookup_address ((void *)&iph->ip_src, AF_INET);
+ if (c)
+ ifp = c->ifp;
+ if (ifp == NULL)
+ return 0;
+ }
/* IP Header dump. */
if (IS_DEBUG_OSPF_PACKET(0, RECV))
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 8662eb425..bc013a83e 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4393,10 +4393,15 @@ show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
/* Show Router Dead interval timer. */
if (use_json)
{
- struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
- unsigned long time_store = 0;
- time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
- json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+ if (nbr->t_inactivity)
+ {
+ struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
+ unsigned long time_store = 0;
+ time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
+ json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+ }
+ else
+ json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", -1);
}
else
vty_out (vty, " Dead timer due in %s%s",