ip_options.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /*
  2. * INET An implementation of the TCP/IP protocol suite for the LINUX
  3. * operating system. INET is implemented using the BSD Socket
  4. * interface as the means of communication with the user level.
  5. *
  6. * The options processing module for ip.c
  7. *
  8. * Authors: A.N.Kuznetsov
  9. *
  10. */
  11. #define pr_fmt(fmt) "IPv4: " fmt
  12. #include <linux/capability.h>
  13. #include <linux/module.h>
  14. #include <linux/slab.h>
  15. #include <linux/types.h>
  16. #include <asm/uaccess.h>
  17. #include <asm/unaligned.h>
  18. #include <linux/skbuff.h>
  19. #include <linux/ip.h>
  20. #include <linux/icmp.h>
  21. #include <linux/netdevice.h>
  22. #include <linux/rtnetlink.h>
  23. #include <net/sock.h>
  24. #include <net/ip.h>
  25. #include <net/icmp.h>
  26. #include <net/route.h>
  27. #include <net/cipso_ipv4.h>
  28. /*
  29. * Write options to IP header, record destination address to
  30. * source route option, address of outgoing interface
  31. * (we should already know it, so that this function is allowed be
  32. * called only after routing decision) and timestamp,
  33. * if we originate this datagram.
  34. *
  35. * daddr is real destination address, next hop is recorded in IP header.
  36. * saddr is address of outgoing interface.
  37. */
  38. void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
  39. __be32 daddr, struct rtable *rt, int is_frag)
  40. {
  41. unsigned char *iph = skb_network_header(skb);
  42. memcpy(&(IPCB(skb)->opt), opt, sizeof(struct ip_options));
  43. memcpy(iph+sizeof(struct iphdr), opt->__data, opt->optlen);
  44. opt = &(IPCB(skb)->opt);
  45. if (opt->srr)
  46. memcpy(iph+opt->srr+iph[opt->srr+1]-4, &daddr, 4);
  47. if (!is_frag) {
  48. if (opt->rr_needaddr)
  49. ip_rt_get_source(iph+opt->rr+iph[opt->rr+2]-5, skb, rt);
  50. if (opt->ts_needaddr)
  51. ip_rt_get_source(iph+opt->ts+iph[opt->ts+2]-9, skb, rt);
  52. if (opt->ts_needtime) {
  53. struct timespec tv;
  54. __be32 midtime;
  55. getnstimeofday(&tv);
  56. midtime = htonl((tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC);
  57. memcpy(iph+opt->ts+iph[opt->ts+2]-5, &midtime, 4);
  58. }
  59. return;
  60. }
  61. if (opt->rr) {
  62. memset(iph+opt->rr, IPOPT_NOP, iph[opt->rr+1]);
  63. opt->rr = 0;
  64. opt->rr_needaddr = 0;
  65. }
  66. if (opt->ts) {
  67. memset(iph+opt->ts, IPOPT_NOP, iph[opt->ts+1]);
  68. opt->ts = 0;
  69. opt->ts_needaddr = opt->ts_needtime = 0;
  70. }
  71. }
  72. /*
  73. * Provided (sopt, skb) points to received options,
  74. * build in dopt compiled option set appropriate for answering.
  75. * i.e. invert SRR option, copy anothers,
  76. * and grab room in RR/TS options.
  77. *
  78. * NOTE: dopt cannot point to skb.
  79. */
  80. int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb)
  81. {
  82. const struct ip_options *sopt;
  83. unsigned char *sptr, *dptr;
  84. int soffset, doffset;
  85. int optlen;
  86. __be32 daddr;
  87. memset(dopt, 0, sizeof(struct ip_options));
  88. sopt = &(IPCB(skb)->opt);
  89. if (sopt->optlen == 0)
  90. return 0;
  91. sptr = skb_network_header(skb);
  92. dptr = dopt->__data;
  93. daddr = skb_rtable(skb)->rt_spec_dst;
  94. if (sopt->rr) {
  95. optlen = sptr[sopt->rr+1];
  96. soffset = sptr[sopt->rr+2];
  97. dopt->rr = dopt->optlen + sizeof(struct iphdr);
  98. memcpy(dptr, sptr+sopt->rr, optlen);
  99. if (sopt->rr_needaddr && soffset <= optlen) {
  100. if (soffset + 3 > optlen)
  101. return -EINVAL;
  102. dptr[2] = soffset + 4;
  103. dopt->rr_needaddr = 1;
  104. }
  105. dptr += optlen;
  106. dopt->optlen += optlen;
  107. }
  108. if (sopt->ts) {
  109. optlen = sptr[sopt->ts+1];
  110. soffset = sptr[sopt->ts+2];
  111. dopt->ts = dopt->optlen + sizeof(struct iphdr);
  112. memcpy(dptr, sptr+sopt->ts, optlen);
  113. if (soffset <= optlen) {
  114. if (sopt->ts_needaddr) {
  115. if (soffset + 3 > optlen)
  116. return -EINVAL;
  117. dopt->ts_needaddr = 1;
  118. soffset += 4;
  119. }
  120. if (sopt->ts_needtime) {
  121. if (soffset + 3 > optlen)
  122. return -EINVAL;
  123. if ((dptr[3]&0xF) != IPOPT_TS_PRESPEC) {
  124. dopt->ts_needtime = 1;
  125. soffset += 4;
  126. } else {
  127. dopt->ts_needtime = 0;
  128. if (soffset + 7 <= optlen) {
  129. __be32 addr;
  130. memcpy(&addr, dptr+soffset-1, 4);
  131. if (inet_addr_type(dev_net(skb_dst(skb)->dev), addr) != RTN_UNICAST) {
  132. dopt->ts_needtime = 1;
  133. soffset += 8;
  134. }
  135. }
  136. }
  137. }
  138. dptr[2] = soffset;
  139. }
  140. dptr += optlen;
  141. dopt->optlen += optlen;
  142. }
  143. if (sopt->srr) {
  144. unsigned char *start = sptr+sopt->srr;
  145. __be32 faddr;
  146. optlen = start[1];
  147. soffset = start[2];
  148. doffset = 0;
  149. if (soffset > optlen)
  150. soffset = optlen + 1;
  151. soffset -= 4;
  152. if (soffset > 3) {
  153. memcpy(&faddr, &start[soffset-1], 4);
  154. for (soffset -= 4, doffset = 4; soffset > 3; soffset -= 4, doffset += 4)
  155. memcpy(&dptr[doffset-1], &start[soffset-1], 4);
  156. /*
  157. * RFC1812 requires to fix illegal source routes.
  158. */
  159. if (memcmp(&ip_hdr(skb)->saddr,
  160. &start[soffset + 3], 4) == 0)
  161. doffset -= 4;
  162. }
  163. if (doffset > 3) {
  164. memcpy(&start[doffset-1], &daddr, 4);
  165. dopt->faddr = faddr;
  166. dptr[0] = start[0];
  167. dptr[1] = doffset+3;
  168. dptr[2] = 4;
  169. dptr += doffset+3;
  170. dopt->srr = dopt->optlen + sizeof(struct iphdr);
  171. dopt->optlen += doffset+3;
  172. dopt->is_strictroute = sopt->is_strictroute;
  173. }
  174. }
  175. if (sopt->cipso) {
  176. optlen = sptr[sopt->cipso+1];
  177. dopt->cipso = dopt->optlen+sizeof(struct iphdr);
  178. memcpy(dptr, sptr+sopt->cipso, optlen);
  179. dptr += optlen;
  180. dopt->optlen += optlen;
  181. }
  182. while (dopt->optlen & 3) {
  183. *dptr++ = IPOPT_END;
  184. dopt->optlen++;
  185. }
  186. return 0;
  187. }
  188. /*
  189. * Options "fragmenting", just fill options not
  190. * allowed in fragments with NOOPs.
  191. * Simple and stupid 8), but the most efficient way.
  192. */
  193. void ip_options_fragment(struct sk_buff *skb)
  194. {
  195. unsigned char *optptr = skb_network_header(skb) + sizeof(struct iphdr);
  196. struct ip_options *opt = &(IPCB(skb)->opt);
  197. int l = opt->optlen;
  198. int optlen;
  199. while (l > 0) {
  200. switch (*optptr) {
  201. case IPOPT_END:
  202. return;
  203. case IPOPT_NOOP:
  204. l--;
  205. optptr++;
  206. continue;
  207. }
  208. optlen = optptr[1];
  209. if (optlen < 2 || optlen > l)
  210. return;
  211. if (!IPOPT_COPIED(*optptr))
  212. memset(optptr, IPOPT_NOOP, optlen);
  213. l -= optlen;
  214. optptr += optlen;
  215. }
  216. opt->ts = 0;
  217. opt->rr = 0;
  218. opt->rr_needaddr = 0;
  219. opt->ts_needaddr = 0;
  220. opt->ts_needtime = 0;
  221. }
  222. /*
  223. * Verify options and fill pointers in struct options.
  224. * Caller should clear *opt, and set opt->data.
  225. * If opt == NULL, then skb->data should point to IP header.
  226. */
  227. int ip_options_compile(struct net *net,
  228. struct ip_options *opt, struct sk_buff *skb)
  229. {
  230. int l;
  231. unsigned char *iph;
  232. unsigned char *optptr;
  233. int optlen;
  234. unsigned char *pp_ptr = NULL;
  235. struct rtable *rt = NULL;
  236. if (skb != NULL) {
  237. rt = skb_rtable(skb);
  238. optptr = (unsigned char *)&(ip_hdr(skb)[1]);
  239. } else
  240. optptr = opt->__data;
  241. iph = optptr - sizeof(struct iphdr);
  242. for (l = opt->optlen; l > 0; ) {
  243. switch (*optptr) {
  244. case IPOPT_END:
  245. for (optptr++, l--; l > 0; optptr++, l--) {
  246. if (*optptr != IPOPT_END) {
  247. *optptr = IPOPT_END;
  248. opt->is_changed = 1;
  249. }
  250. }
  251. goto eol;
  252. case IPOPT_NOOP:
  253. l--;
  254. optptr++;
  255. continue;
  256. }
  257. if (unlikely(l < 2)) {
  258. pp_ptr = optptr;
  259. goto error;
  260. }
  261. optlen = optptr[1];
  262. if (optlen < 2 || optlen > l) {
  263. pp_ptr = optptr;
  264. goto error;
  265. }
  266. switch (*optptr) {
  267. case IPOPT_SSRR:
  268. case IPOPT_LSRR:
  269. if (optlen < 3) {
  270. pp_ptr = optptr + 1;
  271. goto error;
  272. }
  273. if (optptr[2] < 4) {
  274. pp_ptr = optptr + 2;
  275. goto error;
  276. }
  277. /* NB: cf RFC-1812 5.2.4.1 */
  278. if (opt->srr) {
  279. pp_ptr = optptr;
  280. goto error;
  281. }
  282. if (!skb) {
  283. if (optptr[2] != 4 || optlen < 7 || ((optlen-3) & 3)) {
  284. pp_ptr = optptr + 1;
  285. goto error;
  286. }
  287. memcpy(&opt->faddr, &optptr[3], 4);
  288. if (optlen > 7)
  289. memmove(&optptr[3], &optptr[7], optlen-7);
  290. }
  291. opt->is_strictroute = (optptr[0] == IPOPT_SSRR);
  292. opt->srr = optptr - iph;
  293. break;
  294. case IPOPT_RR:
  295. if (opt->rr) {
  296. pp_ptr = optptr;
  297. goto error;
  298. }
  299. if (optlen < 3) {
  300. pp_ptr = optptr + 1;
  301. goto error;
  302. }
  303. if (optptr[2] < 4) {
  304. pp_ptr = optptr + 2;
  305. goto error;
  306. }
  307. if (optptr[2] <= optlen) {
  308. if (optptr[2]+3 > optlen) {
  309. pp_ptr = optptr + 2;
  310. goto error;
  311. }
  312. if (rt) {
  313. memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
  314. opt->is_changed = 1;
  315. }
  316. optptr[2] += 4;
  317. opt->rr_needaddr = 1;
  318. }
  319. opt->rr = optptr - iph;
  320. break;
  321. case IPOPT_TIMESTAMP:
  322. if (opt->ts) {
  323. pp_ptr = optptr;
  324. goto error;
  325. }
  326. if (optlen < 4) {
  327. pp_ptr = optptr + 1;
  328. goto error;
  329. }
  330. if (optptr[2] < 5) {
  331. pp_ptr = optptr + 2;
  332. goto error;
  333. }
  334. if (optptr[2] <= optlen) {
  335. unsigned char *timeptr = NULL;
  336. if (optptr[2]+3 > optptr[1]) {
  337. pp_ptr = optptr + 2;
  338. goto error;
  339. }
  340. switch (optptr[3]&0xF) {
  341. case IPOPT_TS_TSONLY:
  342. if (skb)
  343. timeptr = &optptr[optptr[2]-1];
  344. opt->ts_needtime = 1;
  345. optptr[2] += 4;
  346. break;
  347. case IPOPT_TS_TSANDADDR:
  348. if (optptr[2]+7 > optptr[1]) {
  349. pp_ptr = optptr + 2;
  350. goto error;
  351. }
  352. if (rt) {
  353. memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
  354. timeptr = &optptr[optptr[2]+3];
  355. }
  356. opt->ts_needaddr = 1;
  357. opt->ts_needtime = 1;
  358. optptr[2] += 8;
  359. break;
  360. case IPOPT_TS_PRESPEC:
  361. if (optptr[2]+7 > optptr[1]) {
  362. pp_ptr = optptr + 2;
  363. goto error;
  364. }
  365. {
  366. __be32 addr;
  367. memcpy(&addr, &optptr[optptr[2]-1], 4);
  368. if (inet_addr_type(net, addr) == RTN_UNICAST)
  369. break;
  370. if (skb)
  371. timeptr = &optptr[optptr[2]+3];
  372. }
  373. opt->ts_needtime = 1;
  374. optptr[2] += 8;
  375. break;
  376. default:
  377. if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
  378. pp_ptr = optptr + 3;
  379. goto error;
  380. }
  381. break;
  382. }
  383. if (timeptr) {
  384. struct timespec tv;
  385. u32 midtime;
  386. getnstimeofday(&tv);
  387. midtime = (tv.tv_sec % 86400) * MSEC_PER_SEC + tv.tv_nsec / NSEC_PER_MSEC;
  388. put_unaligned_be32(midtime, timeptr);
  389. opt->is_changed = 1;
  390. }
  391. } else {
  392. unsigned int overflow = optptr[3]>>4;
  393. if (overflow == 15) {
  394. pp_ptr = optptr + 3;
  395. goto error;
  396. }
  397. if (skb) {
  398. optptr[3] = (optptr[3]&0xF)|((overflow+1)<<4);
  399. opt->is_changed = 1;
  400. }
  401. }
  402. opt->ts = optptr - iph;
  403. break;
  404. case IPOPT_RA:
  405. if (optlen < 4) {
  406. pp_ptr = optptr + 1;
  407. goto error;
  408. }
  409. if (optptr[2] == 0 && optptr[3] == 0)
  410. opt->router_alert = optptr - iph;
  411. break;
  412. case IPOPT_CIPSO:
  413. if ((!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) || opt->cipso) {
  414. pp_ptr = optptr;
  415. goto error;
  416. }
  417. opt->cipso = optptr - iph;
  418. if (cipso_v4_validate(skb, &optptr)) {
  419. pp_ptr = optptr;
  420. goto error;
  421. }
  422. break;
  423. case IPOPT_SEC:
  424. case IPOPT_SID:
  425. default:
  426. if (!skb && !ns_capable(net->user_ns, CAP_NET_RAW)) {
  427. pp_ptr = optptr;
  428. goto error;
  429. }
  430. break;
  431. }
  432. l -= optlen;
  433. optptr += optlen;
  434. }
  435. eol:
  436. if (!pp_ptr)
  437. return 0;
  438. error:
  439. if (skb) {
  440. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
  441. }
  442. return -EINVAL;
  443. }
  444. EXPORT_SYMBOL(ip_options_compile);
  445. /*
  446. * Undo all the changes done by ip_options_compile().
  447. */
  448. void ip_options_undo(struct ip_options *opt)
  449. {
  450. if (opt->srr) {
  451. unsigned char *optptr = opt->__data+opt->srr-sizeof(struct iphdr);
  452. memmove(optptr+7, optptr+3, optptr[1]-7);
  453. memcpy(optptr+3, &opt->faddr, 4);
  454. }
  455. if (opt->rr_needaddr) {
  456. unsigned char *optptr = opt->__data+opt->rr-sizeof(struct iphdr);
  457. optptr[2] -= 4;
  458. memset(&optptr[optptr[2]-1], 0, 4);
  459. }
  460. if (opt->ts) {
  461. unsigned char *optptr = opt->__data+opt->ts-sizeof(struct iphdr);
  462. if (opt->ts_needtime) {
  463. optptr[2] -= 4;
  464. memset(&optptr[optptr[2]-1], 0, 4);
  465. if ((optptr[3]&0xF) == IPOPT_TS_PRESPEC)
  466. optptr[2] -= 4;
  467. }
  468. if (opt->ts_needaddr) {
  469. optptr[2] -= 4;
  470. memset(&optptr[optptr[2]-1], 0, 4);
  471. }
  472. }
  473. }
  474. static struct ip_options_rcu *ip_options_get_alloc(const int optlen)
  475. {
  476. return kzalloc(sizeof(struct ip_options_rcu) + ((optlen + 3) & ~3),
  477. GFP_KERNEL);
  478. }
  479. static int ip_options_get_finish(struct net *net, struct ip_options_rcu **optp,
  480. struct ip_options_rcu *opt, int optlen)
  481. {
  482. while (optlen & 3)
  483. opt->opt.__data[optlen++] = IPOPT_END;
  484. opt->opt.optlen = optlen;
  485. if (optlen && ip_options_compile(net, &opt->opt, NULL)) {
  486. kfree(opt);
  487. return -EINVAL;
  488. }
  489. kfree(*optp);
  490. *optp = opt;
  491. return 0;
  492. }
  493. int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
  494. unsigned char __user *data, int optlen)
  495. {
  496. struct ip_options_rcu *opt = ip_options_get_alloc(optlen);
  497. if (!opt)
  498. return -ENOMEM;
  499. if (optlen && copy_from_user(opt->opt.__data, data, optlen)) {
  500. kfree(opt);
  501. return -EFAULT;
  502. }
  503. return ip_options_get_finish(net, optp, opt, optlen);
  504. }
  505. int ip_options_get(struct net *net, struct ip_options_rcu **optp,
  506. unsigned char *data, int optlen)
  507. {
  508. struct ip_options_rcu *opt = ip_options_get_alloc(optlen);
  509. if (!opt)
  510. return -ENOMEM;
  511. if (optlen)
  512. memcpy(opt->opt.__data, data, optlen);
  513. return ip_options_get_finish(net, optp, opt, optlen);
  514. }
  515. void ip_forward_options(struct sk_buff *skb)
  516. {
  517. struct ip_options *opt = &(IPCB(skb)->opt);
  518. unsigned char *optptr;
  519. struct rtable *rt = skb_rtable(skb);
  520. unsigned char *raw = skb_network_header(skb);
  521. if (opt->rr_needaddr) {
  522. optptr = (unsigned char *)raw + opt->rr;
  523. ip_rt_get_source(&optptr[optptr[2]-5], skb, rt);
  524. opt->is_changed = 1;
  525. }
  526. if (opt->srr_is_hit) {
  527. int srrptr, srrspace;
  528. optptr = raw + opt->srr;
  529. for ( srrptr = optptr[2], srrspace = optptr[1];
  530. srrptr <= srrspace;
  531. srrptr += 4
  532. ) {
  533. if (srrptr + 3 > srrspace)
  534. break;
  535. if (memcmp(&opt->nexthop, &optptr[srrptr-1], 4) == 0)
  536. break;
  537. }
  538. if (srrptr + 3 <= srrspace) {
  539. opt->is_changed = 1;
  540. ip_hdr(skb)->daddr = opt->nexthop;
  541. ip_rt_get_source(&optptr[srrptr-1], skb, rt);
  542. optptr[2] = srrptr+4;
  543. } else {
  544. net_crit_ratelimited("%s(): Argh! Destination lost!\n",
  545. __func__);
  546. }
  547. if (opt->ts_needaddr) {
  548. optptr = raw + opt->ts;
  549. ip_rt_get_source(&optptr[optptr[2]-9], skb, rt);
  550. opt->is_changed = 1;
  551. }
  552. }
  553. if (opt->is_changed) {
  554. opt->is_changed = 0;
  555. ip_send_check(ip_hdr(skb));
  556. }
  557. }
  558. int ip_options_rcv_srr(struct sk_buff *skb)
  559. {
  560. struct ip_options *opt = &(IPCB(skb)->opt);
  561. int srrspace, srrptr;
  562. __be32 nexthop;
  563. struct iphdr *iph = ip_hdr(skb);
  564. unsigned char *optptr = skb_network_header(skb) + opt->srr;
  565. struct rtable *rt = skb_rtable(skb);
  566. struct rtable *rt2;
  567. unsigned long orefdst;
  568. int err;
  569. if (!rt)
  570. return 0;
  571. if (skb->pkt_type != PACKET_HOST)
  572. return -EINVAL;
  573. if (rt->rt_type == RTN_UNICAST) {
  574. if (!opt->is_strictroute)
  575. return 0;
  576. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl(16<<24));
  577. return -EINVAL;
  578. }
  579. if (rt->rt_type != RTN_LOCAL)
  580. return -EINVAL;
  581. for (srrptr = optptr[2], srrspace = optptr[1]; srrptr <= srrspace; srrptr += 4) {
  582. if (srrptr + 3 > srrspace) {
  583. icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((opt->srr+2)<<24));
  584. return -EINVAL;
  585. }
  586. memcpy(&nexthop, &optptr[srrptr-1], 4);
  587. orefdst = skb->_skb_refdst;
  588. skb_dst_set(skb, NULL);
  589. err = ip_route_input(skb, nexthop, iph->saddr, iph->tos, skb->dev);
  590. rt2 = skb_rtable(skb);
  591. if (err || (rt2->rt_type != RTN_UNICAST && rt2->rt_type != RTN_LOCAL)) {
  592. skb_dst_drop(skb);
  593. skb->_skb_refdst = orefdst;
  594. return -EINVAL;
  595. }
  596. refdst_drop(orefdst);
  597. if (rt2->rt_type != RTN_LOCAL)
  598. break;
  599. /* Superfast 8) loopback forward */
  600. iph->daddr = nexthop;
  601. opt->is_changed = 1;
  602. }
  603. if (srrptr <= srrspace) {
  604. opt->srr_is_hit = 1;
  605. opt->nexthop = nexthop;
  606. opt->is_changed = 1;
  607. }
  608. return 0;
  609. }
  610. EXPORT_SYMBOL(ip_options_rcv_srr);