route.h
001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021: #ifndef _NET_ROUTE_H
022: #define _NET_ROUTE_H 1
023:
024: #include <features.h>
025: #include <sys/socket.h>
026: #include <sys/types.h>
027: #include <netinet/in.h>
028: #include <bits/wordsize.h>
029:
030:
031:
032: struct rtentry
033: {
034: unsigned long int rt_pad1;
035: struct sockaddr rt_dst;
036: struct sockaddr rt_gateway;
037: struct sockaddr rt_genmask;
038: unsigned short int rt_flags;
039: short int rt_pad2;
040: unsigned long int rt_pad3;
041: unsigned char rt_tos;
042: unsigned char rt_class;
043: #if __WORDSIZE == 64
044: short int rt_pad4[3];
045: #else
046: short int rt_pad4;
047: #endif
048: short int rt_metric;
049: char *rt_dev;
050: unsigned long int rt_mtu;
051: unsigned long int rt_window;
052: unsigned short int rt_irtt;
053: };
054:
055: #define rt_mss rt_mtu
056:
057:
058: struct in6_rtmsg
059: {
060: struct in6_addr rtmsg_dst;
061: struct in6_addr rtmsg_src;
062: struct in6_addr rtmsg_gateway;
063: u_int32_t rtmsg_type;
064: u_int16_t rtmsg_dst_len;
065: u_int16_t rtmsg_src_len;
066: u_int32_t rtmsg_metric;
067: unsigned long int rtmsg_info;
068: u_int32_t rtmsg_flags;
069: int rtmsg_ifindex;
070: };
071:
072:
073: #define RTF_UP 0x0001
074: #define RTF_GATEWAY 0x0002
075:
076: #define RTF_HOST 0x0004
077: #define RTF_REINSTATE 0x0008
078: #define RTF_DYNAMIC 0x0010
079: #define RTF_MODIFIED 0x0020
080: #define RTF_MTU 0x0040
081: #define RTF_MSS RTF_MTU
082: #define RTF_WINDOW 0x0080
083: #define RTF_IRTT 0x0100
084: #define RTF_REJECT 0x0200
085: #define RTF_STATIC 0x0400
086: #define RTF_XRESOLVE 0x0800
087: #define RTF_NOFORWARD 0x1000
088: #define RTF_THROW 0x2000
089: #define RTF_NOPMTUDISC 0x4000
090:
091:
092: #define RTF_DEFAULT 0x00010000
093: #define RTF_ALLONLINK 0x00020000
094: #define RTF_ADDRCONF 0x00040000
095:
096: #define RTF_LINKRT 0x00100000
097: #define RTF_NONEXTHOP 0x00200000
098:
099: #define RTF_CACHE 0x01000000
100: #define RTF_FLOW 0x02000000
101: #define RTF_POLICY 0x04000000
102:
103: #define RTCF_VALVE 0x00200000
104: #define RTCF_MASQ 0x00400000
105: #define RTCF_NAT 0x00800000
106: #define RTCF_DOREDIRECT 0x01000000
107: #define RTCF_LOG 0x02000000
108: #define RTCF_DIRECTSRC 0x04000000
109:
110: #define RTF_LOCAL 0x80000000
111: #define RTF_INTERFACE 0x40000000
112: #define RTF_MULTICAST 0x20000000
113: #define RTF_BROADCAST 0x10000000
114: #define RTF_NAT 0x08000000
115:
116: #define RTF_ADDRCLASSMASK 0xF8000000
117: #define RT_ADDRCLASS(flags) ((__u_int32_t) flags >> 23)
118:
119: #define RT_TOS(tos) ((tos) & IPTOS_TOS_MASK)
120:
121: #define RT_LOCALADDR(flags) ((flags & RTF_ADDRCLASSMASK) \
122: == (RTF_LOCAL|RTF_INTERFACE))
123:
124: #define RT_CLASS_UNSPEC 0
125: #define RT_CLASS_DEFAULT 253
126:
127: #define RT_CLASS_MAIN 254
128: #define RT_CLASS_LOCAL 255
129: #define RT_CLASS_MAX 255
130:
131:
132: #define RTMSG_ACK NLMSG_ACK
133: #define RTMSG_OVERRUN NLMSG_OVERRUN
134:
135: #define RTMSG_NEWDEVICE 0x11
136: #define RTMSG_DELDEVICE 0x12
137: #define RTMSG_NEWROUTE 0x21
138: #define RTMSG_DELROUTE 0x22
139: #define RTMSG_NEWRULE 0x31
140: #define RTMSG_DELRULE 0x32
141: #define RTMSG_CONTROL 0x40
142:
143: #define RTMSG_AR_FAILED 0x51
144:
145: #endif
146:
© Andrew Scott 2006 -
2025,
All Rights Reserved