lce: fix up for kernel sockaddr changes
Also add support to bind to clusters by name. Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
931c335680
commit
adc06cfd50
|
@ -262,7 +262,7 @@ static struct dect_ops ops = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
#if 0
|
||||
//dect_lce_group_ring(dh, 0xf);
|
||||
dect_open_call(dh, &ipuis[PHONE1]);
|
||||
|
|
|
@ -11,7 +11,7 @@ void pexit(const char *str)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
void dect_common_init(struct dect_ops *ops)
|
||||
void dect_common_init(struct dect_ops *ops, const char *cluster)
|
||||
{
|
||||
dect_debug_init();
|
||||
dect_dummy_ops_init(ops);
|
||||
|
@ -23,7 +23,7 @@ void dect_common_init(struct dect_ops *ops)
|
|||
if (dh == NULL)
|
||||
pexit("dect_alloc_handle");
|
||||
|
||||
if (dect_init(dh) < 0)
|
||||
if (dect_init(dh, cluster) < 0)
|
||||
pexit("dect_init");
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ extern void dect_event_ops_cleanup(void);
|
|||
extern void dect_dummy_ops_init(struct dect_ops *ops);
|
||||
extern void dect_debug_init(void);
|
||||
|
||||
extern void dect_common_init(struct dect_ops *ops);
|
||||
extern void dect_common_init(struct dect_ops *ops, const char *cluster);
|
||||
extern void dect_common_cleanup(struct dect_handle *dh);
|
||||
|
||||
extern int dect_write_uak(const struct dect_ipui *ipui,
|
||||
|
|
|
@ -9,7 +9,7 @@ static struct dect_ops ops;
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
dect_lce_group_ring(dh, 0);
|
||||
dect_event_loop();
|
||||
|
|
|
@ -100,13 +100,14 @@ int main(int argc, char **argv)
|
|||
uint8_t slot;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s rx-slot tx-slot tx-carrier\n", argv[0]);
|
||||
printf("Usage: %s cluster rx-slot tx-slot tx-carrier\n",
|
||||
argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
slot = atoi(argv[1]);
|
||||
dect_build_msg(&msg, atoi(argv[2]), atoi(argv[3]));
|
||||
slot = atoi(argv[2]);
|
||||
dect_build_msg(&msg, atoi(argv[3]), atoi(argv[4]));
|
||||
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
dfd = dect_raw_socket(dh);
|
||||
if (dfd == NULL)
|
||||
|
|
|
@ -219,7 +219,7 @@ int main(int argc, char **argv)
|
|||
if (rand_fd < 0)
|
||||
exit(1);
|
||||
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
dect_event_loop();
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ int main(int argc, char **argv)
|
|||
if (rand_fd < 0)
|
||||
exit(1);
|
||||
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
mme = dect_mm_endpoint_alloc(dh, &ipui);
|
||||
if (mme == NULL)
|
||||
|
|
|
@ -179,7 +179,7 @@ int main(int argc, char **argv)
|
|||
if (rand_fd < 0)
|
||||
exit(1);
|
||||
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
mme = dect_mm_endpoint_alloc(dh, &ipui);
|
||||
if (mme == NULL)
|
||||
|
|
|
@ -63,7 +63,7 @@ static struct dect_ops ops = {
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
dect_common_init(&ops);
|
||||
dect_common_init(&ops, argv[1]);
|
||||
|
||||
dect_invoke_ss(dh, &ipui);
|
||||
dect_event_loop();
|
||||
|
|
|
@ -139,7 +139,7 @@ struct dect_ops {
|
|||
extern struct dect_handle *dect_alloc_handle(struct dect_ops *ops);
|
||||
extern void dect_close_handle(struct dect_handle *dh);
|
||||
|
||||
extern int dect_init(struct dect_handle *dh);
|
||||
extern int dect_init(struct dect_handle *dh, const char *cluster);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _LIBDECT_NETLINK_H
|
||||
#define _LIBDECT_NETLINK_H
|
||||
|
||||
extern int dect_netlink_init(struct dect_handle *dh);
|
||||
extern int dect_netlink_init(struct dect_handle *dh, const char *cluster);
|
||||
extern void dect_netlink_exit(struct dect_handle *dh);
|
||||
|
||||
#endif /* _LIBDECT_NETLINK_H */
|
||||
|
|
1
src/cc.c
1
src/cc.c
|
@ -409,6 +409,7 @@ static int dect_call_connect_uplane(const struct dect_handle *dh,
|
|||
goto err1;
|
||||
|
||||
dect_transaction_get_ulei(&addr, &call->transaction);
|
||||
addr.dect_index = dh->index;
|
||||
if (connect(call->lu_sap->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0)
|
||||
goto err2;
|
||||
|
||||
|
|
|
@ -557,6 +557,7 @@ static struct dect_data_link *dect_ddl_establish(struct dect_handle *dh,
|
|||
goto err2;
|
||||
|
||||
ddl->dlei.dect_family = AF_DECT;
|
||||
ddl->dlei.dect_index = dh->index;
|
||||
ddl->dlei.dect_ari = dect_build_ari(&dh->pari) >> 24;
|
||||
ddl->dlei.dect_pmid = 0xe98a1;
|
||||
ddl->dlei.dect_lln = 1;
|
||||
|
@ -1050,6 +1051,7 @@ int dect_lce_init(struct dect_handle *dh)
|
|||
|
||||
memset(&s_addr, 0, sizeof(s_addr));
|
||||
s_addr.dect_family = AF_DECT;
|
||||
s_addr.dect_index = dh->index;
|
||||
s_addr.dect_lln = 1;
|
||||
s_addr.dect_sapi = 0;
|
||||
|
||||
|
|
|
@ -35,11 +35,14 @@ struct dect_handle *dect_alloc_handle(struct dect_ops *ops)
|
|||
}
|
||||
EXPORT_SYMBOL(dect_alloc_handle);
|
||||
|
||||
int dect_init(struct dect_handle *dh)
|
||||
int dect_init(struct dect_handle *dh, const char *cluster)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = dect_netlink_init(dh);
|
||||
if (cluster == NULL)
|
||||
cluster = "cluster0";
|
||||
|
||||
err = dect_netlink_init(dh, cluster);
|
||||
if (err < 0)
|
||||
goto err1;
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ static int dect_netlink_event_rcv(struct nl_msg *msg, void *arg)
|
|||
return dect_netlink_msg_rcv(msg, &handler);
|
||||
}
|
||||
|
||||
int dect_netlink_init(struct dect_handle *dh)
|
||||
int dect_netlink_init(struct dect_handle *dh, const char *cluster)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
@ -281,7 +281,7 @@ int dect_netlink_init(struct dect_handle *dh)
|
|||
if (dect_register_fd(dh, dh->nlfd, DECT_FD_READ))
|
||||
goto err3;
|
||||
|
||||
err = dect_netlink_get_cluster(dh, "cluster0");
|
||||
err = dect_netlink_get_cluster(dh, cluster);
|
||||
if (err < 0)
|
||||
goto err4;
|
||||
|
||||
|
|
Reference in New Issue