Skip to content

Commit

Permalink
l2tp: Fix error creating L2TP tunnels
Browse files Browse the repository at this point in the history
A previous commit (33f72e6) added notification via netlink for tunnels
when created/modified/deleted. If the notification returned an error,
this error was returned from the tunnel function. If there were no
listeners, the error code ESRCH was returned, even though having no
listeners is not an error. Other calls to this and other similar
notification functions either ignore the error code, or filter ESRCH.
This patch checks for ESRCH and does not flag this as an error.

Reviewed-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Mark Tomlinson authored and David S. Miller committed Feb 17, 2016
1 parent d148bbd commit 853effc
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions net/l2tp/l2tp_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,13 @@ static int l2tp_tunnel_notify(struct genl_family *family,
ret = l2tp_nl_tunnel_send(msg, info->snd_portid, info->snd_seq,
NLM_F_ACK, tunnel, cmd);

if (ret >= 0)
return genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
if (ret >= 0) {
ret = genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
/* We don't care if no one is listening */
if (ret == -ESRCH)
ret = 0;
return ret;
}

nlmsg_free(msg);

Expand All @@ -147,8 +152,13 @@ static int l2tp_session_notify(struct genl_family *family,
ret = l2tp_nl_session_send(msg, info->snd_portid, info->snd_seq,
NLM_F_ACK, session, cmd);

if (ret >= 0)
return genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
if (ret >= 0) {
ret = genlmsg_multicast_allns(family, msg, 0, 0, GFP_ATOMIC);
/* We don't care if no one is listening */
if (ret == -ESRCH)
ret = 0;
return ret;
}

nlmsg_free(msg);

Expand Down

0 comments on commit 853effc

Please sign in to comment.