From 3dba513f4cb1c5a23796b97e02e461cd631ee7da Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 2 May 2008 02:26:58 +0000 Subject: [PATCH] This fixes the crashes when calling {g,s}etsockopt() on an AF_LINK socket. Not sure, if there are any cases where there is a next protocol, though. Please review. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25287 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/network/stack/link.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/network/stack/link.cpp b/src/add-ons/kernel/network/stack/link.cpp index 85096cba0f..dd0e8e87a8 100644 --- a/src/add-ons/kernel/network/stack/link.cpp +++ b/src/add-ons/kernel/network/stack/link.cpp @@ -323,8 +323,13 @@ status_t link_getsockopt(net_protocol *protocol, int level, int option, void *value, int *length) { - return protocol->next->module->getsockopt(protocol, level, option, - value, length); + if (protocol->next != NULL) { + return protocol->next->module->getsockopt(protocol, level, option, + value, length); + } + + return gNetSocketModule.get_option(protocol->socket, level, option, value, + length); } @@ -332,7 +337,12 @@ status_t link_setsockopt(net_protocol *protocol, int level, int option, const void *value, int length) { - return protocol->next->module->setsockopt(protocol, level, option, + if (protocol->next != NULL) { + return protocol->next->module->setsockopt(protocol, level, option, + value, length); + } + + return gNetSocketModule.set_option(protocol->socket, level, option, value, length); }