Deleted Added
full compact
ip_output.c (268450) ip_output.c (268479)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 16 unchanged lines hidden (view full) ---

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)ip_output.c 8.3 (Berkeley) 1/21/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 268450 2014-07-09 07:48:05Z glebius $");
33__FBSDID("$FreeBSD: head/sys/netinet/ip_output.c 268479 2014-07-10 03:10:56Z adrian $");
34
35#include "opt_inet.h"
36#include "opt_ipfw.h"
37#include "opt_ipsec.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_route.h"
41#include "opt_sctp.h"

--- 953 unchanged lines hidden (view full) ---

995 case IP_BINDANY:
996 if (sopt->sopt_td != NULL) {
997 error = priv_check(sopt->sopt_td,
998 PRIV_NETINET_BINDANY);
999 if (error)
1000 break;
1001 }
1002 /* FALLTHROUGH */
34
35#include "opt_inet.h"
36#include "opt_ipfw.h"
37#include "opt_ipsec.h"
38#include "opt_mbuf_stress_test.h"
39#include "opt_mpath.h"
40#include "opt_route.h"
41#include "opt_sctp.h"

--- 953 unchanged lines hidden (view full) ---

995 case IP_BINDANY:
996 if (sopt->sopt_td != NULL) {
997 error = priv_check(sopt->sopt_td,
998 PRIV_NETINET_BINDANY);
999 if (error)
1000 break;
1001 }
1002 /* FALLTHROUGH */
1003 case IP_BINDMULTI:
1004#ifdef RSS
1005 case IP_RSS_LISTEN_BUCKET:
1006#endif
1003 case IP_TOS:
1004 case IP_TTL:
1005 case IP_MINTTL:
1006 case IP_RECVOPTS:
1007 case IP_RECVRETOPTS:
1008 case IP_RECVDSTADDR:
1009 case IP_RECVTTL:
1010 case IP_RECVIF:

--- 26 unchanged lines hidden (view full) ---

1037 INP_WLOCK(inp); \
1038 if (optval) \
1039 inp->inp_flags |= bit; \
1040 else \
1041 inp->inp_flags &= ~bit; \
1042 INP_WUNLOCK(inp); \
1043} while (0)
1044
1007 case IP_TOS:
1008 case IP_TTL:
1009 case IP_MINTTL:
1010 case IP_RECVOPTS:
1011 case IP_RECVRETOPTS:
1012 case IP_RECVDSTADDR:
1013 case IP_RECVTTL:
1014 case IP_RECVIF:

--- 26 unchanged lines hidden (view full) ---

1041 INP_WLOCK(inp); \
1042 if (optval) \
1043 inp->inp_flags |= bit; \
1044 else \
1045 inp->inp_flags &= ~bit; \
1046 INP_WUNLOCK(inp); \
1047} while (0)
1048
1049#define OPTSET2(bit, val) do { \
1050 INP_WLOCK(inp); \
1051 if (val) \
1052 inp->inp_flags2 |= bit; \
1053 else \
1054 inp->inp_flags2 &= ~bit; \
1055 INP_WUNLOCK(inp); \
1056} while (0)
1057
1045 case IP_RECVOPTS:
1046 OPTSET(INP_RECVOPTS);
1047 break;
1048
1049 case IP_RECVRETOPTS:
1050 OPTSET(INP_RECVRETOPTS);
1051 break;
1052

--- 20 unchanged lines hidden (view full) ---

1073 OPTSET(INP_DONTFRAG);
1074 break;
1075 case IP_BINDANY:
1076 OPTSET(INP_BINDANY);
1077 break;
1078 case IP_RECVTOS:
1079 OPTSET(INP_RECVTOS);
1080 break;
1058 case IP_RECVOPTS:
1059 OPTSET(INP_RECVOPTS);
1060 break;
1061
1062 case IP_RECVRETOPTS:
1063 OPTSET(INP_RECVRETOPTS);
1064 break;
1065

--- 20 unchanged lines hidden (view full) ---

1086 OPTSET(INP_DONTFRAG);
1087 break;
1088 case IP_BINDANY:
1089 OPTSET(INP_BINDANY);
1090 break;
1091 case IP_RECVTOS:
1092 OPTSET(INP_RECVTOS);
1093 break;
1094 case IP_BINDMULTI:
1095 OPTSET2(INP_BINDMULTI, optval);
1096 break;
1097#ifdef RSS
1098 case IP_RSS_LISTEN_BUCKET:
1099 if ((optval >= 0) &&
1100 (optval < rss_getnumbuckets())) {
1101 inp->inp_rss_listen_bucket = optval;
1102 OPTSET2(INP_RSS_BUCKET_SET, 1);
1103 } else {
1104 error = EINVAL;
1105 }
1106 break;
1107#endif
1081 }
1082 break;
1083#undef OPTSET
1108 }
1109 break;
1110#undef OPTSET
1111#undef OPTSET2
1084
1085 /*
1086 * Multicast socket options are processed by the in_mcast
1087 * module.
1088 */
1089 case IP_MULTICAST_IF:
1090 case IP_MULTICAST_VIF:
1091 case IP_MULTICAST_TTL:

--- 91 unchanged lines hidden (view full) ---

1183 case IP_RECVTTL:
1184 case IP_RECVIF:
1185 case IP_PORTRANGE:
1186 case IP_FAITH:
1187 case IP_ONESBCAST:
1188 case IP_DONTFRAG:
1189 case IP_BINDANY:
1190 case IP_RECVTOS:
1112
1113 /*
1114 * Multicast socket options are processed by the in_mcast
1115 * module.
1116 */
1117 case IP_MULTICAST_IF:
1118 case IP_MULTICAST_VIF:
1119 case IP_MULTICAST_TTL:

--- 91 unchanged lines hidden (view full) ---

1211 case IP_RECVTTL:
1212 case IP_RECVIF:
1213 case IP_PORTRANGE:
1214 case IP_FAITH:
1215 case IP_ONESBCAST:
1216 case IP_DONTFRAG:
1217 case IP_BINDANY:
1218 case IP_RECVTOS:
1219 case IP_BINDMULTI:
1191 case IP_FLOWID:
1192 case IP_FLOWTYPE:
1220 case IP_FLOWID:
1221 case IP_FLOWTYPE:
1222#ifdef RSS
1223 case IP_RSSBUCKETID:
1224#endif
1193 switch (sopt->sopt_name) {
1194
1195 case IP_TOS:
1196 optval = inp->inp_ip_tos;
1197 break;
1198
1199 case IP_TTL:
1200 optval = inp->inp_ip_ttl;
1201 break;
1202
1203 case IP_MINTTL:
1204 optval = inp->inp_ip_minttl;
1205 break;
1206
1207#define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0)
1225 switch (sopt->sopt_name) {
1226
1227 case IP_TOS:
1228 optval = inp->inp_ip_tos;
1229 break;
1230
1231 case IP_TTL:
1232 optval = inp->inp_ip_ttl;
1233 break;
1234
1235 case IP_MINTTL:
1236 optval = inp->inp_ip_minttl;
1237 break;
1238
1239#define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0)
1240#define OPTBIT2(bit) (inp->inp_flags2 & bit ? 1 : 0)
1208
1209 case IP_RECVOPTS:
1210 optval = OPTBIT(INP_RECVOPTS);
1211 break;
1212
1213 case IP_RECVRETOPTS:
1214 optval = OPTBIT(INP_RECVRETOPTS);
1215 break;

--- 47 unchanged lines hidden (view full) ---

1263 inp->inp_flowtype,
1264 &rss_bucket);
1265 if (retval == 0)
1266 optval = rss_bucket;
1267 else
1268 error = EINVAL;
1269 break;
1270#endif
1241
1242 case IP_RECVOPTS:
1243 optval = OPTBIT(INP_RECVOPTS);
1244 break;
1245
1246 case IP_RECVRETOPTS:
1247 optval = OPTBIT(INP_RECVRETOPTS);
1248 break;

--- 47 unchanged lines hidden (view full) ---

1296 inp->inp_flowtype,
1297 &rss_bucket);
1298 if (retval == 0)
1299 optval = rss_bucket;
1300 else
1301 error = EINVAL;
1302 break;
1303#endif
1304 case IP_BINDMULTI:
1305 optval = OPTBIT2(INP_BINDMULTI);
1306 break;
1271 }
1272 error = sooptcopyout(sopt, &optval, sizeof optval);
1273 break;
1274
1275 /*
1276 * Multicast socket options are processed by the in_mcast
1277 * module.
1278 */

--- 84 unchanged lines hidden ---
1307 }
1308 error = sooptcopyout(sopt, &optval, sizeof optval);
1309 break;
1310
1311 /*
1312 * Multicast socket options are processed by the in_mcast
1313 * module.
1314 */

--- 84 unchanged lines hidden ---