Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
29e4329d
Commit
29e4329d
authored
Nov 12, 2001
by
Bernd Eckenfels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added EUI64 Hardware Address Family
Daniel Stodden <stodden@in.tum.de>
parent
68ca19b0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
174 additions
and
2 deletions
+174
-2
config.in
config.in
+2
-0
lib/Makefile
lib/Makefile
+1
-1
lib/eui64.c
lib/eui64.c
+155
-0
lib/hw.c
lib/hw.c
+9
-1
lib/net-features.h
lib/net-features.h
+7
-0
No files found.
config.in
View file @
29e4329d
...
...
@@ -82,6 +82,8 @@ bool 'Ash hardware support' HAVE_HWASH n
bool '(Cisco)-HDLC/LAPB support' HAVE_HWHDLCLAPB n
bool 'IrDA support' HAVE_HWIRDA y
bool 'Econet hardware support' HAVE_HWEC n
bool 'Generic EUI-64 hardware support' HAVE_HWEUI64 n
*
*
* Other Features.
...
...
lib/Makefile
View file @
29e4329d
...
...
@@ -16,7 +16,7 @@
#
HWOBJS
=
hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o
HWOBJS
=
hw.o loopback.o slip.o ether.o ax25.o ppp.o arcnet.o tr.o tunnel.o frame.o sit.o rose.o ash.o fddi.o hippi.o hdlclapb.o strip.o irda.o ec_hw.o x25.o
eui64.o
AFOBJS
=
unix.o inet.o inet6.o ax25.o ipx.o ddp.o ipx.o netrom.o af.o rose.o econet.o x25.o
AFGROBJS
=
inet_gr.o inet6_gr.o ipx_gr.o ddp_gr.o netrom_gr.o ax25_gr.o rose_gr.o getroute.o x25_gr.o
AFSROBJS
=
inet_sr.o inet6_sr.o netrom_sr.o ipx_sr.o setroute.o x25_sr.o
...
...
lib/eui64.c
0 → 100644
View file @
29e4329d
/*
* lib/eui64.c This file contains support for generic EUI-64 hw addressing
*
* Version: $Id: eui64.c,v 1.1 2001/11/12 02:12:05 ecki Exp $
*
* Author: Daniel Stodden <stodden@in.tum.de>
* Copyright 2001 Daniel Stodden
*
* blueprinted from ether.c
* Copyright 1993 MicroWalt Corporation
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*/
#include "config.h"
#if HAVE_HWEUI64
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if_arp.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
#include "net-support.h"
#include "pathnames.h"
#include "intl.h"
/*
* EUI-64 constants
*/
#define EUI64_ALEN 8
#ifndef ARPHRD_EUI64
#define ARPHRD_EUI64 27
#warning "ARPHRD_EUI64 not defined in <net/if_arp.h>. Using private value 27"
#endif
struct
hwtype
eui64_hwtype
;
/* Display an EUI-64 address in readable format. */
static
char
*
pr_eui64
(
unsigned
char
*
ptr
)
{
static
char
buff
[
64
];
snprintf
(
buff
,
sizeof
(
buff
),
"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X"
,
(
ptr
[
0
]
&
0377
),
(
ptr
[
1
]
&
0377
),
(
ptr
[
2
]
&
0377
),
(
ptr
[
3
]
&
0377
),
(
ptr
[
4
]
&
0377
),
(
ptr
[
5
]
&
0377
),
(
ptr
[
6
]
&
0377
),
(
ptr
[
7
]
&
0377
)
);
return
(
buff
);
}
/* Start the PPP encapsulation on the file descriptor. */
static
int
in_eui64
(
char
*
bufp
,
struct
sockaddr
*
sap
)
{
unsigned
char
*
ptr
;
char
c
,
*
orig
;
int
i
;
unsigned
val
;
sap
->
sa_family
=
eui64_hwtype
.
type
;
ptr
=
sap
->
sa_data
;
i
=
0
;
orig
=
bufp
;
while
((
*
bufp
!=
'\0'
)
&&
(
i
<
EUI64_ALEN
))
{
val
=
0
;
c
=
*
bufp
++
;
if
(
isdigit
(
c
))
val
=
c
-
'0'
;
else
if
(
c
>=
'a'
&&
c
<=
'f'
)
val
=
c
-
'a'
+
10
;
else
if
(
c
>=
'A'
&&
c
<=
'F'
)
val
=
c
-
'A'
+
10
;
else
{
#ifdef DEBUG
fprintf
(
stderr
,
_
(
"in_eui64(%s): invalid eui64 address!
\n
"
),
orig
);
#endif
errno
=
EINVAL
;
return
(
-
1
);
}
val
<<=
4
;
c
=
*
bufp
;
if
(
isdigit
(
c
))
val
|=
c
-
'0'
;
else
if
(
c
>=
'a'
&&
c
<=
'f'
)
val
|=
c
-
'a'
+
10
;
else
if
(
c
>=
'A'
&&
c
<=
'F'
)
val
|=
c
-
'A'
+
10
;
else
if
(
c
==
':'
||
c
==
0
)
val
>>=
4
;
else
{
#ifdef DEBUG
fprintf
(
stderr
,
_
(
"in_eui64(%s): invalid eui64 address!
\n
"
),
orig
);
#endif
errno
=
EINVAL
;
return
(
-
1
);
}
if
(
c
!=
0
)
bufp
++
;
*
ptr
++
=
(
unsigned
char
)
(
val
&
0377
);
i
++
;
/* We might get a semicolon here - not required. */
if
(
*
bufp
==
':'
)
{
if
(
i
==
EUI64_ALEN
)
{
#ifdef DEBUG
fprintf
(
stderr
,
_
(
"in_eui64(%s): trailing : ignored!
\n
"
),
orig
)
#endif
;
/* nothing */
}
bufp
++
;
}
}
/* That's it. Any trailing junk? */
if
((
i
==
EUI64_ALEN
)
&&
(
*
bufp
!=
'\0'
))
{
#ifdef DEBUG
fprintf
(
stderr
,
_
(
"in_eui64(%s): trailing junk!
\n
"
),
orig
);
errno
=
EINVAL
;
return
(
-
1
);
#endif
}
#ifdef DEBUG
fprintf
(
stderr
,
"in_eui64(%s): %s
\n
"
,
orig
,
pr_eui64
(
sap
->
sa_data
));
#endif
return
(
0
);
}
struct
hwtype
eui64_hwtype
=
{
"eui64"
,
NULL
,
/*"EUI-64 addressing", */
ARPHRD_EUI64
,
EUI64_ALEN
,
pr_eui64
,
in_eui64
,
NULL
,
0
};
#endif
/* HAVE_EUI64 */
lib/hw.c
View file @
29e4329d
...
...
@@ -2,7 +2,7 @@
* lib/hw.c This file contains the top-level part of the hardware
* support functions module.
*
* Version: $Id: hw.c,v 1.1
7 2000/05/20 13:38:10 pb
Exp $
* Version: $Id: hw.c,v 1.1
8 2001/11/12 02:12:05 ecki
Exp $
*
* Maintainer: Bernd 'eckes' Eckenfels, <net-tools@lina.inka.de>
*
...
...
@@ -73,6 +73,8 @@ extern struct hwtype irda_hwtype;
extern
struct
hwtype
ec_hwtype
;
extern
struct
hwtype
eui64_hwtype
;
static
struct
hwtype
*
hwtypes
[]
=
{
...
...
@@ -143,6 +145,9 @@ static struct hwtype *hwtypes[] =
#endif
#if HAVE_HWX25
&
x25_hwtype
,
#endif
#if HAVE_HWEUI64
&
eui64_hwtype
,
#endif
&
unspec_hwtype
,
NULL
...
...
@@ -216,6 +221,9 @@ void hwinit()
#endif
#if HAVE_HWEC
ec_hwtype
.
title
=
_
(
"Econet"
);
#endif
#if HAVE_HWEUI64
eui64_hwtype
.
title
=
_
(
"Generic EUI-64"
);
#endif
sVhwinit
=
1
;
}
...
...
lib/net-features.h
View file @
29e4329d
...
...
@@ -295,6 +295,13 @@ static char *Features =
"-"
#endif
"HDLC/LAPB "
#if HAVE_HWEUI64
"+"
#else
"-"
#endif
"EUI64 "
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment