Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
slapos
Commits
0e633e88
Commit
0e633e88
authored
Feb 05, 2013
by
Jondy Zhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch babeld for supporting Cygwin.
parent
696b2f2a
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
2578 additions
and
4 deletions
+2578
-4
component/babeld/Makefile
component/babeld/Makefile
+4
-4
component/babeld/cyginet.c
component/babeld/cyginet.c
+2403
-0
component/babeld/cyginet.h
component/babeld/cyginet.h
+169
-0
component/babeld/kernel.c
component/babeld/kernel.c
+2
-0
No files found.
component/babeld/Makefile
View file @
0e633e88
...
...
@@ -6,13 +6,13 @@ DEFINES = $(PLATFORM_DEFINES)
CFLAGS
=
$(CDEBUGFLAGS)
$(DEFINES)
$(EXTRA_DEFINES)
LDLIBS
=
-lrt
LDLIBS
=
-lrt
-liphlpapi
-lws2_32
-lwlanapi
-lole32
-lsetupapi
SRCS
=
babeld.c net.c kernel.c util.c interface.c source.c neighbour.c
\
route.c xroute.c message.c resend.c configuration.c local.c
route.c xroute.c message.c resend.c configuration.c local.c
cyginet.c
OBJS
=
babeld.o net.o kernel.o util.o interface.o source.o neighbour.o
\
route.o xroute.o message.o resend.o configuration.o local.o
route.o xroute.o message.o resend.o configuration.o local.o
cyginet.o
babeld
:
$(OBJS)
$(CC)
$(CFLAGS)
$(LDFLAGS)
-o
babeld
$(OBJS)
$(LDLIBS)
...
...
@@ -48,4 +48,4 @@ uninstall:
clean
:
-
rm
-f
babeld babeld.html
*
.o
*
~ core TAGS gmon.out
kernel.o
:
kernel_netlink.c kernel_socket.c
kernel.o
:
kernel_netlink.c kernel_socket.c
kernel_cygwin.c
component/babeld/cyginet.c
0 → 100644
View file @
0e633e88
This diff is collapsed.
Click to expand it.
component/babeld/cyginet.h
0 → 100755
View file @
0e633e88
/*
Reference List in the MSDN.
NDIS 6.0 Interfaces for Window Vista later
http://msdn.microsoft.com/en-us/library/windows/hardware/ff565740(v=vs.85).aspx
NDIS Versions in Network Drivers (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff567893(v=vs.85).aspx
For Windows XP, NDIS 5.0
http://msdn.microsoft.com/en-us/library/windows/hardware/ff565849(v=vs.85).aspx
NDIS General-use Interfaces (NDIS 5.1) (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff556983(v=vs.85).aspx
Routing Protocol Interface Functions (Windows)
http://msdn.microsoft.com/en-us/library/windows/desktop/aa446772(v=vs.85).aspx
Networking (Windows)
http://msdn.microsoft.com/en-us/library/windows/desktop/ee663286(v=vs.85).aspx
NDIS Protocol Drivers (NDIS 5.1) (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff557149(v=vs.85).aspx
Winsock IOCTLs (Windows)
http://msdn.microsoft.com/zh-cn/library/windows/desktop/bb736550(v=vs.85).aspx
Creating a Basic IP Helper Application (Windows)
http://msdn.microsoft.com/zh-cn/library/windows/desktop/aa365872(v=vs.85).aspx
Network Awareness in Windows XP
http://msdn.microsoft.com/en-us/library/ms700657(v=vs.85).aspx
System-Defined Device Setup Classes (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff553419(v=vs.85).aspx
Device Information Sets (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff541247(v=vs.85).aspx
Accessing Device Instance SPDRP_Xxx Properties (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff537737(v=vs.85).aspx
IOCTL_NDIS_QUERY_GLOBAL_STATS (Windows Drivers)
http://msdn.microsoft.com/en-us/library/windows/hardware/ff548975(v=vs.85).aspx
IPv6 RFCs and Standards Working Groups
http://www.ipv6now.com.au/RFC.php
*/
#ifndef __CYGIFNET_H__
#define __CYGIFNET_H__
#ifndef IN_LOOPBACK
#define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000)
#endif
/* Missing defines in the Cygwin */
#define RTM_ADD 0x1
/* Add Route */
#define RTM_DELETE 0x2
/* Delete Route */
#define RTM_CHANGE 0x3
/* Change Metrics or flags */
#define RTM_GET 0x4
/* Report Metrics */
/*
* Structure of a Link-Level sockaddr:
*/
struct
sockaddr_dl
{
u_char
sdl_len
;
/* Total length of sockaddr */
u_char
sdl_family
;
/* AF_LINK */
u_short
sdl_index
;
/* if != 0, system given index for interface */
u_char
sdl_type
;
/* interface type */
u_char
sdl_nlen
;
/* interface name length, no trailing 0 reqd. */
u_char
sdl_alen
;
/* link level address length */
u_char
sdl_slen
;
/* link layer selector length */
char
sdl_data
[
46
];
/* minimum work area, can be larger;
contains both if name and ll address */
};
#if defined(INSIDE_CYGINET)
/* Copy from babeld/kernel.h */
#define RTPROT_BABEL_LOCAL -2
#define KERNEL_INFINITY 0xFFFF
struct
kernel_route
{
unsigned
char
prefix
[
16
];
int
plen
;
int
metric
;
unsigned
int
ifindex
;
int
proto
;
unsigned
char
gw
[
16
];
};
/* End of Copy */
struct
ifaddrs
{
struct
ifaddrs
*
ifa_next
;
char
*
ifa_name
;
unsigned
int
ifa_flags
;
struct
sockaddr
*
ifa_addr
;
struct
sockaddr
*
ifa_netmask
;
struct
sockaddr
*
ifa_dstaddr
;
void
*
ifa_data
;
};
struct
if_nameindex
{
unsigned
if_index
;
char
*
if_name
;
};
typedef
struct
_LIBWINET_INTERFACE
{
DWORD
IfType
;
IF_OPER_STATUS
OperStatus
;
DWORD
Mtu
;
SOCKADDR
Address
;
}
LIBWINET_INTERFACE
,
*
PLIBWINET_INTERFACE
;
extern
unsigned
if_nametoindex
(
const
char
*
);
extern
char
*
if_indextoname
(
unsigned
,
char
*
);
extern
struct
if_nameindex
*
if_nameindex
(
void
);
extern
void
if_freenameindex
(
struct
if_nameindex
*
);
extern
const
char
*
inet_ntop
(
int
,
const
void
*
,
char
*
,
socklen_t
);
extern
int
inet_pton
(
int
,
const
char
*
,
void
*
);
extern
int
getifaddrs
(
struct
ifaddrs
**
);
extern
void
freeifaddrs
(
struct
ifaddrs
*
);
#define MALLOC(x) HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,x)
#define FREE(p) \
if
(
NULL
!=
p
)
{
HeapFree
(
GetProcessHeap
(),
0
,
p
);
p
=
NULL
;}
#define CLOSESOCKET(s) \
if
(
INVALID_SOCKET
!=
s
)
{
closesocket
(
s
);
s
=
INVALID_SOCKET
;}
#define CLOSESOCKEVENT(h) \
if
(
WSA_INVALID_EVENT
!=
h
)
{
WSACloseEvent
(
h
);
h
=
WSA_INVALID_EVENT
;}
#define SOCKETERR(e) \
{
\
printf
(
"%s:%s failed: %d [%s@%d]
\n
"
,
\
__FUNCTION__
,
\
e
,
\
WSAGetLastError
(),
\
__FILE__
,
\
__LINE__
\
);
\
}
#endif
/* INSIDE_CYGINET */
/* Export functions from cyginet */
int
cyginet_startup
();
void
cyginet_cleanup
();
int
cyginet_start_monitor_route_changes
(
int
);
int
cyginet_stop_monitor_route_changes
();
int
cyginet_set_ipv6_forwards
(
int
);
int
cyginet_set_icmp6_redirect_accept
(
int
);
int
cyginet_interface_sdl
(
struct
sockaddr_dl
*
,
char
*
);
int
cyginet_interface_wireless
(
const
char
*
,
int
);
int
cyginet_interface_mtu
(
const
char
*
,
int
);
int
cyginet_interface_operational
(
const
char
*
,
int
);
int
cyginet_interface_ipv4
(
const
char
*
,
int
,
unsigned
char
*
);
int
cyginet_dump_route_table
(
struct
kernel_route
*
,
int
);
int
cyginet_loopback_index
(
int
);
int
cyginet_add_route_entry
(
const
struct
sockaddr
*
,
unsigned
short
,
const
struct
sockaddr
*
,
int
,
unsigned
int
);
int
cyginet_delete_route_entry
(
const
struct
sockaddr
*
,
unsigned
short
,
const
struct
sockaddr
*
,
int
,
unsigned
int
);
int
cyginet_update_route_entry
(
const
struct
sockaddr
*
,
unsigned
short
,
const
struct
sockaddr
*
,
int
,
unsigned
int
);
#endif
/* __CYGIFNET_H__ */
component/babeld/kernel.c
View file @
0e633e88
...
...
@@ -28,6 +28,8 @@ THE SOFTWARE.
#ifdef __linux
#include "kernel_netlink.c"
#elif defined(__CYGWIN__)
#include "kernel_cygwin.c"
#else
#include "kernel_socket.c"
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment