user/5392: ospfd, unaligned access at startup, breaks sparc64

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

user/5392: ospfd, unaligned access at startup, breaks sparc64

sthen
>Number:         5392
>Category:       user
>Synopsis:       ospfd, unaligned access at startup, breaks sparc64
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    bugs
>State:          open
>Quarter:        
>Keywords:      
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 23 23:50:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     sthen
>Release:        snapshots since mid-november
>Organization:
net
>Environment:
       
        System      : OpenBSD 4.1
        Architecture: OpenBSD.sparc64
        Machine     : sparc64
>Description:

usr.sbin/ospfd/kroute.c 1.35 introduced an unaligned access
breaking ospfd on sparc64.

>How-To-Repeat:

$ ssh [hidden email] ospfd

>Fix:

fixes this and a typo while there. Has been running for 48h on
one of my Netras.

I sent this to Claudio but didn't hear anything back so I guess
he may have been too busy, I thought I'd sendbug in case somebody
else might like to pick it up.

(using bcopy, memcpy does not work for this, a gcc -O bug I think).

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospfd/kroute.c,v
retrieving revision 1.40
diff -u -p -r1.40 kroute.c
--- kroute.c 1 Feb 2007 12:51:01 -0000 1.40
+++ kroute.c 21 Feb 2007 23:18:40 -0000
@@ -987,7 +987,7 @@ fetchifs(int ifindex)
  kif->k.flags = ifm->ifm_flags;
  kif->k.link_state = ifm->ifm_data.ifi_link_state;
  kif->k.media_type = ifm->ifm_data.ifi_type;
- kif->k.baudrate = ifm->ifm_data.ifi_baudrate;
+ bcopy(&ifm->ifm_data.ifi_baudrate, &kif->k.baudrate, sizeof(kif->k.baudrate));
  kif->k.mtu = ifm->ifm_data.ifi_mtu;
  kif->k.nh_reachable = (kif->k.flags & IFF_UP) &&
     (LINK_STATE_IS_UP(ifm->ifm_data.ifi_link_state) ||
@@ -1012,7 +1012,7 @@ fetchifs(int ifindex)
  case RTM_NEWADDR:
  ifam = (struct ifa_msghdr *)rtm;
  if (kif && ifam->ifam_index != kif->k.ifindex)
- fatalx("fetchifs: bad interafce table");
+ fatalx("fetchifs: bad interface table");
  if (kif == NULL || (ifam->ifam_addrs &
     (RTA_NETMASK | RTA_IFA | RTA_BRD)) == 0)
  break;


>Release-Note:
>Audit-Trail:
>Unformatted: