diff options
author | ajs <ajs> | 2004-12-30 15:11:19 +0000 |
---|---|---|
committer | ajs <ajs> | 2004-12-30 15:11:19 +0000 |
commit | 3dc56b5bd3fa2aacc427505feaa9cd1366e7ebe8 (patch) | |
tree | a1c9855ec0d2a918f31c444c3d0d4228fedb0f50 | |
parent | cc49eb5a5f970b7405762d3f8a2def179e0022b4 (diff) |
2004-12-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_network.c: Improve all setsockopt error messages to give detailed
information on the arguments.
-rw-r--r-- | ospfd/ChangeLog | 5 | ||||
-rw-r--r-- | ospfd/ospf_network.c | 36 |
2 files changed, 28 insertions, 13 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index 6686bdc0..c7075623 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,8 @@ +2004-12-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * ospf_network.c: Improve all setsockopt error messages to give detailed + information on the arguments. + 2004-12-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * ospf_packet.c: (ospf_db_desc) Reduce severity of "Negotiation done" diff --git a/ospfd/ospf_network.c b/ospfd/ospf_network.c index a8d51681..035993e2 100644 --- a/ospfd/ospf_network.c +++ b/ospfd/ospf_network.c @@ -55,8 +55,10 @@ ospf_if_add_allspfrouters (struct ospf *top, struct prefix *p, p->u.prefix4, htonl (OSPF_ALLSPFROUTERS), ifindex); if (ret < 0) - zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (AllSPFRouters): %s", - safe_strerror (errno)); + zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllSPFRouters): %s; perhaps a kernel limit " + "on # of multicast group memberships has been exceeded?", + top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); else zlog_info ("interface %s join AllSPFRouters Multicast group.", inet_ntoa (p->u.prefix4)); @@ -74,8 +76,9 @@ ospf_if_drop_allspfrouters (struct ospf *top, struct prefix *p, p->u.prefix4, htonl (OSPF_ALLSPFROUTERS), ifindex); if (ret < 0) - zlog_warn("can't setsockopt IP_DROP_MEMBERSHIP (AllSPFRouters): %s", - safe_strerror (errno)); + zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllSPFRouters): %s", + top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); else zlog_info ("interface %s leave AllSPFRouters Multicast group.", inet_ntoa (p->u.prefix4)); @@ -94,8 +97,10 @@ ospf_if_add_alldrouters (struct ospf *top, struct prefix *p, unsigned int p->u.prefix4, htonl (OSPF_ALLDROUTERS), ifindex); if (ret < 0) - zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (AllDRouters): %s", - safe_strerror (errno)); + zlog_warn ("can't setsockopt IP_ADD_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllDRouters): %s; perhaps a kernel limit " + "on # of multicast group memberships has been exceeded?", + top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); else zlog_info ("interface %s join AllDRouters Multicast group.", inet_ntoa (p->u.prefix4)); @@ -113,8 +118,9 @@ ospf_if_drop_alldrouters (struct ospf *top, struct prefix *p, unsigned int p->u.prefix4, htonl (OSPF_ALLDROUTERS), ifindex); if (ret < 0) - zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (AllDRouters): %s", - safe_strerror (errno)); + zlog_warn ("can't setsockopt IP_DROP_MEMBERSHIP (fd %d, addr %s, " + "ifindex %u, AllDRouters): %s", + top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); else zlog_info ("interface %s leave AllDRouters Multicast group.", inet_ntoa (p->u.prefix4)); @@ -134,18 +140,22 @@ ospf_if_ipmulticast (struct ospf *top, struct prefix *p, unsigned int ifindex) /* Prevent receiving self-origined multicast packets. */ ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_LOOP, (void *)&val, len); if (ret < 0) - zlog_warn ("can't setsockopt IP_MULTICAST_LOOP(0): %s", safe_strerror (errno)); + 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; ret = setsockopt (top->fd, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&val, len); if (ret < 0) - zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1): %s", safe_strerror (errno)); + zlog_warn ("can't setsockopt IP_MULTICAST_TTL(1) for fd %d: %s", + top->fd, safe_strerror (errno)); ret = setsockopt_multicast_ipv4 (top->fd, IP_MULTICAST_IF, p->u.prefix4, 0, ifindex); if (ret < 0) - zlog_warn ("can't setsockopt IP_MULTICAST_IF: %s", safe_strerror (errno)); + zlog_warn("can't setsockopt IP_MULTICAST_IF(fd %d, addr %s, " + "ifindex %u): %s", + top->fd, inet_ntoa(p->u.prefix4), ifindex, safe_strerror(errno)); return ret; } @@ -182,7 +192,7 @@ ospf_sock_init (void) if ( ospfd_privs.change (ZPRIVS_LOWER) ) zlog_err ("ospf_sock_init: could not lower privs, %s", safe_strerror (errno) ); - zlog_warn ("Can't set IP_HDRINCL option"); + zlog_warn ("Can't set IP_HDRINCL option for fd %d",ospf_sock); } #elif defined (IPTOS_PREC_INTERNETCONTROL) #warning "IP_HDRINCL not available on this system" @@ -208,7 +218,7 @@ ospf_sock_init (void) ret = setsockopt_ifindex (AF_INET, ospf_sock, 1); if (ret < 0) - zlog_warn ("Can't set pktinfo option"); + zlog_warn ("Can't set pktinfo option for fd %d", ospf_sock); if (ospfd_privs.change (ZPRIVS_LOWER)) { |