Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
02baf1c0
Commit
02baf1c0
authored
Jan 02, 2008
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add net->ipv4.
parent
c6feeaed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
16 deletions
+19
-16
babel.c
babel.c
+15
-12
babel.h
babel.h
+1
-1
message.c
message.c
+3
-3
No files found.
babel.c
View file @
02baf1c0
...
@@ -52,7 +52,7 @@ THE SOFTWARE.
...
@@ -52,7 +52,7 @@ THE SOFTWARE.
struct
timeval
now
;
struct
timeval
now
;
unsigned
char
myid
[
16
];
unsigned
char
myid
[
16
];
unsigned
char
*
myipv4
=
NULL
;
unsigned
char
do_ipv4
=
0
;
int
debug
=
0
;
int
debug
=
0
;
static
int
maxmtu
;
static
int
maxmtu
;
...
@@ -193,12 +193,7 @@ main(int argc, char **argv)
...
@@ -193,12 +193,7 @@ main(int argc, char **argv)
SHIFTE
();
SHIFTE
();
debug
=
atoi
(
*
arg
);
debug
=
atoi
(
*
arg
);
}
else
if
(
strcmp
(
*
arg
,
"-4"
)
==
0
)
{
}
else
if
(
strcmp
(
*
arg
,
"-4"
)
==
0
)
{
SHIFTE
();
do_ipv4
=
1
;
myipv4
=
malloc
(
16
);
if
(
myipv4
==
NULL
)
goto
syntax
;
rc
=
parse_address
(
*
arg
,
myipv4
);
if
(
rc
<
0
)
goto
syntax
;
if
(
!
v4mapped
(
myipv4
))
goto
syntax
;
}
else
{
}
else
{
goto
syntax
;
goto
syntax
;
}
}
...
@@ -681,11 +676,7 @@ dump_tables(FILE *out)
...
@@ -681,11 +676,7 @@ dump_tables(FILE *out)
fprintf
(
out
,
"
\n
"
);
fprintf
(
out
,
"
\n
"
);
fprintf
(
out
,
"My id %s%s%s seqno %d
\n
"
,
fprintf
(
out
,
"My id %s seqno %d
\n
"
,
format_address
(
myid
),
myseqno
);
format_address
(
myid
),
myipv4
?
" IPv4 "
:
""
,
myipv4
?
format_address
(
myipv4
)
:
""
,
myseqno
);
for
(
i
=
0
;
i
<
numneighs
;
i
++
)
{
for
(
i
=
0
;
i
<
numneighs
;
i
++
)
{
if
(
neighs
[
i
].
id
[
0
]
==
0xFF
)
if
(
neighs
[
i
].
id
[
0
]
==
0xFF
)
...
@@ -742,6 +733,8 @@ struct network *
...
@@ -742,6 +733,8 @@ struct network *
add_network
(
char
*
ifname
,
int
ifindex
,
int
mtu
,
int
wired
,
unsigned
int
cost
)
add_network
(
char
*
ifname
,
int
ifindex
,
int
mtu
,
int
wired
,
unsigned
int
cost
)
{
{
void
*
p
;
void
*
p
;
char
ipv4
[
4
];
int
rc
;
if
(
numnets
>=
MAXNETS
)
{
if
(
numnets
>=
MAXNETS
)
{
fprintf
(
stderr
,
"Too many networks.
\n
"
);
fprintf
(
stderr
,
"Too many networks.
\n
"
);
...
@@ -750,6 +743,16 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
...
@@ -750,6 +743,16 @@ add_network(char *ifname, int ifindex, int mtu, int wired, unsigned int cost)
memset
(
nets
+
numnets
,
0
,
sizeof
(
struct
network
));
memset
(
nets
+
numnets
,
0
,
sizeof
(
struct
network
));
nets
[
numnets
].
ifindex
=
ifindex
;
nets
[
numnets
].
ifindex
=
ifindex
;
nets
[
numnets
].
ipv4
=
NULL
;
if
(
do_ipv4
)
{
rc
=
kernel_interface_ipv4
(
ifname
,
ifindex
,
ipv4
);
if
(
rc
>=
0
)
{
nets
[
numnets
].
ipv4
=
malloc
(
4
);
if
(
nets
[
numnets
].
ipv4
)
memcpy
(
nets
[
numnets
].
ipv4
,
ipv4
,
4
);
}
}
nets
[
numnets
].
wired
=
wired
;
nets
[
numnets
].
wired
=
wired
;
nets
[
numnets
].
cost
=
cost
;
nets
[
numnets
].
cost
=
cost
;
nets
[
numnets
].
activity_time
=
now
.
tv_sec
;
nets
[
numnets
].
activity_time
=
now
.
tv_sec
;
...
...
babel.h
View file @
02baf1c0
...
@@ -69,6 +69,7 @@ struct network {
...
@@ -69,6 +69,7 @@ struct network {
int
update_time
;
int
update_time
;
int
ihu_time
;
int
ihu_time
;
char
ifname
[
IF_NAMESIZE
];
char
ifname
[
IF_NAMESIZE
];
unsigned
char
*
ipv4
;
int
buffered
;
int
buffered
;
struct
timeval
flush_time
;
struct
timeval
flush_time
;
int
bufsize
;
int
bufsize
;
...
@@ -87,7 +88,6 @@ extern int debug;
...
@@ -87,7 +88,6 @@ extern int debug;
extern
int
reboot_time
;
extern
int
reboot_time
;
extern
unsigned
char
myid
[
16
];
extern
unsigned
char
myid
[
16
];
extern
unsigned
char
*
myipv4
;
extern
struct
network
nets
[
MAXNETS
];
extern
struct
network
nets
[
MAXNETS
];
extern
int
numnets
;
extern
int
numnets
;
...
...
message.c
View file @
02baf1c0
...
@@ -217,7 +217,7 @@ parse_packet(const unsigned char *from, struct network *net,
...
@@ -217,7 +217,7 @@ parse_packet(const unsigned char *from, struct network *net,
neigh
,
neigh
->
address
);
neigh
,
neigh
->
address
);
}
else
if
(
type
==
5
)
{
}
else
if
(
type
==
5
)
{
unsigned
char
p4
[
16
],
prefix
[
16
],
nh
[
16
];
unsigned
char
p4
[
16
],
prefix
[
16
],
nh
[
16
];
if
(
!
my
ipv4
)
if
(
!
net
->
ipv4
)
continue
;
continue
;
v4tov6
(
p4
,
message
+
20
);
v4tov6
(
p4
,
message
+
20
);
v4tov6
(
nh
,
message
+
16
);
v4tov6
(
nh
,
message
+
16
);
...
@@ -550,10 +550,10 @@ really_send_update(struct network *net,
...
@@ -550,10 +550,10 @@ really_send_update(struct network *net,
if
(
plen
>=
96
&&
v4mapped
(
prefix
))
{
if
(
plen
>=
96
&&
v4mapped
(
prefix
))
{
const
unsigned
char
*
sid
;
const
unsigned
char
*
sid
;
unsigned
char
v4route
[
16
];
unsigned
char
v4route
[
16
];
if
(
!
my
ipv4
)
if
(
!
net
->
ipv4
)
return
;
return
;
memset
(
v4route
,
0
,
8
);
memset
(
v4route
,
0
,
8
);
memcpy
(
v4route
+
8
,
myipv4
+
12
,
4
);
memcpy
(
v4route
+
8
,
net
->
ipv4
,
4
);
memcpy
(
v4route
+
12
,
prefix
+
12
,
4
);
memcpy
(
v4route
+
12
,
prefix
+
12
,
4
);
start_message
(
net
,
48
);
start_message
(
net
,
48
);
sid
=
message_source_id
(
net
);
sid
=
message_source_id
(
net
);
...
...
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