Skip to content

Commit 2553282

Browse files
Rémi Denis-Courmontdavem330
authored andcommitted
Phonet: modules auto-loading support
Signed-off-by: Rémi Denis-Courmont <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7afb9dc commit 2553282

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

net/phonet/af_phonet.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
6464
}
6565

6666
pnp = phonet_proto_get(protocol);
67+
#ifdef CONFIG_KMOD
68+
if (pnp == NULL &&
69+
request_module("net-pf-%d-proto-%d", PF_PHONET, protocol) == 0)
70+
pnp = phonet_proto_get(protocol);
71+
#endif
6772
if (pnp == NULL)
6873
return -EPROTONOSUPPORT;
6974
if (sock->type != pnp->sock_type) {
@@ -94,7 +99,7 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol)
9499
}
95100

96101
static struct net_proto_family phonet_proto_family = {
97-
.family = AF_PHONET,
102+
.family = PF_PHONET,
98103
.create = pn_socket_create,
99104
.owner = THIS_MODULE,
100105
};
@@ -447,7 +452,7 @@ static int __init phonet_init(void)
447452

448453
err:
449454
phonet_sysctl_exit();
450-
sock_unregister(AF_PHONET);
455+
sock_unregister(PF_PHONET);
451456
dev_remove_pack(&phonet_packet_type);
452457
phonet_device_exit();
453458
return err;
@@ -457,7 +462,7 @@ static void __exit phonet_exit(void)
457462
{
458463
isi_unregister();
459464
phonet_sysctl_exit();
460-
sock_unregister(AF_PHONET);
465+
sock_unregister(PF_PHONET);
461466
dev_remove_pack(&phonet_packet_type);
462467
phonet_device_exit();
463468
}
@@ -466,3 +471,4 @@ module_init(phonet_init);
466471
module_exit(phonet_exit);
467472
MODULE_DESCRIPTION("Phonet protocol stack for Linux");
468473
MODULE_LICENSE("GPL");
474+
MODULE_ALIAS_NETPROTO(PF_PHONET);

0 commit comments

Comments
 (0)