Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
eb89f037
Commit
eb89f037
authored
Oct 26, 2016
by
Alessandro Rubini
Committed by
Adam Wujek
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: fix IP addresses for pdelay (unix, wrs)
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
a9373c90
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
17 deletions
+13
-17
pp-instance.h
include/ppsi/pp-instance.h
+1
-1
wr-api.h
proto-ext-whiterabbit/wr-api.h
+2
-1
sim-socket.c
time-sim/sim-socket.c
+1
-1
unix-socket.c
time-unix/unix-socket.c
+8
-12
wrs-socket.c
time-wrs/wrs-socket.c
+1
-2
No files found.
include/ppsi/pp-instance.h
View file @
eb89f037
...
...
@@ -143,7 +143,7 @@ struct pp_instance {
/* The net_path used to be allocated separately, but there's no need */
struct
pp_channel
ch
[
__NR_PP_NP
];
/* general and event ch */
Integer32
mcast_addr
;
/* only ipv4/udp */
Integer32
mcast_addr
[
2
];
/* only ipv4/udp */
int
tx_offset
,
rx_offset
;
/* ptp payload vs send/recv */
unsigned
char
peer
[
6
];
/* Our peer's MAC address */
uint16_t
peer_vid
;
/* Our peer's VID (for PROTO_VLAN) */
...
...
proto-ext-whiterabbit/wr-api.h
View file @
eb89f037
...
...
@@ -12,7 +12,8 @@
#include <ppsi/lib.h>
#include "wr-constants.h"
#define WRS_PPSI_SHMEM_VERSION 16
/* Many changes since the last incease */
#define WRS_PPSI_SHMEM_VERSION 17
/* Changed definition of field mcast_addr of
* struct pp_instance */
/*
* This structure is used as extension-specific data in the DSPort
...
...
time-sim/sim-socket.c
View file @
eb89f037
...
...
@@ -183,7 +183,7 @@ static int sim_net_send(struct pp_instance *ppi, void *pkt, int len,
PP_SLAVE_GEN_PORT
:
PP_SLAVE_EVT_PORT
);
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
;
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
[
0
]
;
if
(
t
)
ppi
->
t_ops
->
get
(
ppi
,
t
);
...
...
time-unix/unix-socket.c
View file @
eb89f037
...
...
@@ -190,7 +190,6 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
[
PP_NP_GEN
]
=
PP_GEN_PORT
,
[
PP_NP_EVT
]
=
PP_EVT_PORT
,
};
/* FIXME: udp address for sendto */
static
const
uint8_t
macaddr
[
2
][
ETH_ALEN
]
=
{
[
PP_E2E_MECH
]
=
PP_MCAST_MACADDRESS
,
[
PP_P2P_MECH
]
=
PP_PDELAY_MACADDRESS
,
...
...
@@ -252,9 +251,7 @@ static int unix_net_send(struct pp_instance *ppi, void *pkt, int len,
case
PPSI_PROTO_UDP
:
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
udpport
[
chtype
]);
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
;
/* FIXME: differentiate pldeay mac address */
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
[
is_pdelay
];
if
(
t
)
ppi
->
t_ops
->
get
(
ppi
,
t
);
...
...
@@ -418,7 +415,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
context
=
addr_str
;
errno
=
EINVAL
;
if
(
!
inet_aton
(
addr_str
,
&
net_addr
))
goto
err_out
;
ppi
->
mcast_addr
=
net_addr
.
s_addr
;
ppi
->
mcast_addr
[
PP_E2E_MECH
]
=
net_addr
.
s_addr
;
/* multicast sends only on specified interface */
imr
.
imr_multiaddr
.
s_addr
=
net_addr
.
s_addr
;
...
...
@@ -435,8 +432,6 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
&
imr
,
sizeof
(
struct
ip_mreq
))
<
0
)
goto
err_out
;
#if 0 /* FIXME: UDP pdelay is not working due to address inflation */
/* Init Peer multicast IP address */
memcpy
(
addr_str
,
PP_PDELAY_DOMAIN_ADDRESS
,
INET_ADDRSTRLEN
);
...
...
@@ -444,7 +439,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
errno
=
EINVAL
;
if
(
!
inet_aton
(
addr_str
,
&
net_addr
))
goto
err_out
;
ppi->mcast_addr = net_addr.s_addr;
ppi
->
mcast_addr
[
PP_P2P_MECH
]
=
net_addr
.
s_addr
;
imr
.
imr_multiaddr
.
s_addr
=
net_addr
.
s_addr
;
/* join multicast group (for receiving) on specified interface */
...
...
@@ -452,7 +447,6 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
if
(
setsockopt
(
sock
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
&
imr
,
sizeof
(
struct
ip_mreq
))
<
0
)
goto
err_out
;
#endif
/* End of General multicast Ip address init */
...
...
@@ -566,16 +560,18 @@ static int unix_net_exit(struct pp_instance *ppi)
continue
;
/* Close General Multicast */
imr
.
imr_multiaddr
.
s_addr
=
ppi
->
mcast_addr
;
imr
.
imr_interface
.
s_addr
=
htonl
(
INADDR_ANY
);
imr
.
imr_multiaddr
.
s_addr
=
ppi
->
mcast_addr
[
0
];
setsockopt
(
fd
,
IPPROTO_IP
,
IP_DROP_MEMBERSHIP
,
&
imr
,
sizeof
(
struct
ip_mreq
));
imr
.
imr_multiaddr
.
s_addr
=
ppi
->
mcast_addr
[
1
];
setsockopt
(
fd
,
IPPROTO_IP
,
IP_DROP_MEMBERSHIP
,
&
imr
,
sizeof
(
struct
ip_mreq
));
close
(
fd
);
ppi
->
ch
[
i
].
fd
=
-
1
;
}
ppi
->
mcast_addr
=
0
;
ppi
->
mcast_addr
[
0
]
=
ppi
->
mcast_addr
[
1
]
=
0
;
return
0
;
default:
...
...
time-wrs/wrs-socket.c
View file @
eb89f037
...
...
@@ -461,7 +461,6 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,
[
PP_NP_GEN
]
=
PP_GEN_PORT
,
[
PP_NP_EVT
]
=
PP_EVT_PORT
,
};
/* FIXME: udp address for sendto */
static
const
uint8_t
macaddr
[
2
][
ETH_ALEN
]
=
{
[
PP_E2E_MECH
]
=
PP_MCAST_MACADDRESS
,
[
PP_P2P_MECH
]
=
PP_PDELAY_MACADDRESS
,
...
...
@@ -549,7 +548,7 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,
fd
=
ppi
->
ch
[
chtype
].
fd
;
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
udpport
[
chtype
]);
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
;
addr
.
sin_addr
.
s_addr
=
ppi
->
mcast_addr
[
is_pdelay
]
;
if
(
drop
)
addr
.
sin_port
=
3200
;
ret
=
sendto
(
fd
,
pkt
,
len
,
0
,
(
struct
sockaddr
*
)
&
addr
,
...
...
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