Made socket() accept an udp or tcp protocol number
This commit is contained in:
parent
f67ccc7333
commit
9bc5da4276
@ -5,6 +5,7 @@
|
|||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
#include <net/netlib.h>
|
#include <net/netlib.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ int socket(int domain, int type, int protocol)
|
|||||||
static int _tcp_socket(int protocol)
|
static int _tcp_socket(int protocol)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
if (protocol != 0)
|
if (protocol != 0 && protocol != IPPROTO_TCP)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr, "socket(tcp): bad protocol %d\n", protocol);
|
fprintf(stderr, "socket(tcp): bad protocol %d\n", protocol);
|
||||||
@ -58,7 +59,7 @@ static int _udp_socket(int protocol)
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (protocol != 0)
|
if (protocol != 0 && protocol != IPPROTO_UDP)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
fprintf(stderr, "socket(udp): bad protocol %d\n", protocol);
|
fprintf(stderr, "socket(udp): bad protocol %d\n", protocol);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user