Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software for White Rabbit PTP Core
Manage
Activity
Members
Labels
Plan
Issues
39
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Software for White Rabbit PTP Core
Commits
78d3f280
Commit
78d3f280
authored
9 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
lib/ipv4: bootp requests once a second, no count-based
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
7bab5d84
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/ipv4.c
+8
-7
8 additions, 7 deletions
lib/ipv4.c
with
8 additions
and
7 deletions
lib/ipv4.c
+
8
−
7
View file @
78d3f280
...
...
@@ -53,7 +53,7 @@ void ipv4_init(void)
}
static
int
bootp_retry
=
0
;
static
int
bootp_ti
mer
=
0
;
static
u
int
32_t
bootp_ti
cs
;
void
ipv4_poll
(
void
)
{
...
...
@@ -61,6 +61,10 @@ void ipv4_poll(void)
wr_sockaddr_t
addr
;
int
len
;
if
(
!
bootp_tics
)
bootp_tics
=
timer_get_tics
()
-
1
;
if
((
len
=
ptpd_netif_recvfrom
(
ipv4_socket
,
&
addr
,
buf
,
sizeof
(
buf
),
0
))
>
0
)
{
if
(
needIP
)
...
...
@@ -70,16 +74,15 @@ void ipv4_poll(void)
ptpd_netif_sendto
(
ipv4_socket
,
&
addr
,
buf
,
len
,
0
);
}
if
(
needIP
&&
bootp_timer
==
0
)
{
if
(
needIP
&&
time_after
(
timer_get_tics
(),
bootp_tics
)
)
{
len
=
send_bootp
(
buf
,
++
bootp_retry
);
memset
(
addr
.
mac
,
0xFF
,
6
);
addr
.
ethertype
=
htons
(
0x0800
);
/* IPv4 */
ptpd_netif_sendto
(
ipv4_socket
,
&
addr
,
buf
,
len
,
0
);
bootp_tics
=
timer_get_tics
()
+
TICS_PER_SECOND
;
}
if
(
needIP
&&
++
bootp_timer
==
100000
)
bootp_timer
=
0
;
}
void
getIP
(
unsigned
char
*
IP
)
...
...
@@ -100,8 +103,6 @@ void setIP(unsigned char *IP)
*
eb_ip
=
ip
;
needIP
=
(
ip
==
0
);
if
(
!
needIP
)
{
if
(
!
needIP
)
bootp_retry
=
0
;
bootp_timer
=
0
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment