openbsd-ports/net/netatalk/patches/patch-etcatalkd-multicastc

108 lines
2.5 KiB
Plaintext

--- etc/atalkd/multicast.c.orig Tue Oct 28 09:24:47 1997
+++ etc/atalkd/multicast.c Wed Nov 10 15:49:19 1999
@@ -10,14 +10,17 @@
#include <sys/sockio.h>
#include <net/if.h>
#include <syslog.h>
+#include <string.h>
#include "zip.h"
-u_char ethermulti[ 6 ] = {
+extern int ifconfig();
+
+u_int8_t ethermulti[ 6 ] = {
0x09, 0x00, 0x07, 0xff, 0xff, 0xff,
};
-u_char ethermultitab[ 253 ][ 6 ] = {
+u_int8_t ethermultitab[ 253 ][ 6 ] = {
{ 0x09, 0x00, 0x07, 0x00, 0x00, 0x00, },
{ 0x09, 0x00, 0x07, 0x00, 0x00, 0x01, },
{ 0x09, 0x00, 0x07, 0x00, 0x00, 0x02, },
@@ -273,11 +276,11 @@
{ 0x09, 0x00, 0x07, 0x00, 0x00, 0xfc, },
};
-u_char tokenmulti[ 6 ] = {
+u_int8_t tokenmulti[ 6 ] = {
0xc0, 0x00, 0x40, 0x00, 0x00, 0x00,
};
-u_char tokenmultitab[ 19 ][ 6 ] = {
+u_int8_t tokenmultitab[ 19 ][ 6 ] = {
{ 0xc0, 0x00, 0x00, 0x00, 0x08, 0x00, },
{ 0xc0, 0x00, 0x00, 0x00, 0x10, 0x00, },
{ 0xc0, 0x00, 0x00, 0x00, 0x20, 0x00, },
@@ -300,17 +303,18 @@
};
/* configure given multicast for named interface */
+int
addmulti( name, data )
char *name;
- u_char *data;
+ u_int8_t *data;
{
struct sockaddr sa;
- bzero( &sa, sizeof( struct sockaddr ));
+ memset( &sa, 0, sizeof( struct sockaddr ));
if ( data == NULL ) {
- bcopy( ethermulti, sa.sa_data, sizeof( ethermulti ));
+ memcpy( sa.sa_data, ethermulti, sizeof( ethermulti ));
} else {
- bcopy( data, sa.sa_data, sizeof( ethermulti ));
+ memcpy( sa.sa_data, data, sizeof( ethermulti ));
}
if ( ifconfig( name, SIOCADDMULTI, &sa )) {
return( -1 );
@@ -318,13 +322,13 @@
return( 0 );
}
- u_short
+ u_int16_t
atalk_cksum( data, len )
- u_char *data;
+ u_int8_t *data;
int len;
{
- u_char *end;
- u_long cksum = 0;
+ u_int8_t *end;
+ u_int32_t cksum = 0;
for ( end = data + len; data < end; data++ ) {
cksum = ( cksum + *data ) << 1;
@@ -338,7 +342,7 @@
cksum = 0x0000ffff;
}
- return( (u_short)cksum );
+ return( (u_int16_t)cksum );
}
/*
@@ -347,14 +351,14 @@
* ethernet, tokenring, or FDDI? (Of course, FDDI and Ethernet look just
* alike.)
*/
- u_char *
+ u_int8_t *
zone_mcast( name, len )
- char *name;
- u_char len;
+ u_int8_t *name;
+ u_int8_t len;
{
- extern u_char _diacasemap[];
- u_char uname[ 32 ];
- u_short cksum;
+ extern u_int8_t _diacasemap[];
+ u_int8_t uname[ 32 ];
+ u_int16_t cksum;
int i;
for ( i = 0; i < len; i++ ) {