Lines Matching +full:ip +full:- +full:addr

5  * SPDX-License-Identifier: Apache-2.0
25 return ppp_fsm_input(&ctx->ipcp.fsm, PPP_IPCP, pkt); in ipcp_handle()
34 struct in_addr *addr) in ipcp_add_address() argument
36 net_pkt_write_u8(pkt, 1 + 1 + sizeof(addr->s_addr)); in ipcp_add_address()
37 return net_pkt_write(pkt, &addr->s_addr, sizeof(addr->s_addr)); in ipcp_add_address()
42 return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.address); in ipcp_add_ip_address()
47 return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns1_address); in ipcp_add_dns1()
52 return ipcp_add_address(ctx, pkt, &ctx->ipcp.my_options.dns2_address); in ipcp_add_dns2()
56 struct in_addr *addr) in ipcp_ack_check_address() argument
62 return -EINVAL; in ipcp_ack_check_address()
70 if (memcmp(&ack_addr, addr, sizeof(ack_addr)) != 0) { in ipcp_ack_check_address()
71 return -EINVAL; in ipcp_ack_check_address()
81 &ctx->ipcp.my_options.address); in ipcp_ack_ip_address()
88 &ctx->ipcp.my_options.dns1_address); in ipcp_ack_dns1()
95 &ctx->ipcp.my_options.dns2_address); in ipcp_ack_dns2()
99 struct in_addr *addr) in ipcp_nak_override_address() argument
101 if (oplen != sizeof(*addr)) { in ipcp_nak_override_address()
102 return -EINVAL; in ipcp_nak_override_address()
105 return net_pkt_read(pkt, addr, sizeof(*addr)); in ipcp_nak_override_address()
112 &ctx->ipcp.my_options.address); in ipcp_nak_ip_address()
119 &ctx->ipcp.my_options.dns1_address); in ipcp_nak_dns1()
126 &ctx->ipcp.my_options.dns2_address); in ipcp_nak_dns2()
147 struct in_addr addr; member
157 ret = net_pkt_read(pkt, &data->addr, sizeof(data->addr)); in ipcp_dns_address_parse()
160 return -EMSGSIZE; in ipcp_dns_address_parse()
164 if (data->addr.s_addr == INADDR_ANY) { in ipcp_dns_address_parse()
165 NET_DBG("[IPCP] zeroes rcvd as %s addr, sending NAK with our %s addr", in ipcp_dns_address_parse()
167 return -EINVAL; in ipcp_dns_address_parse()
170 data->addr_present = true; in ipcp_dns_address_parse()
182 ret = net_pkt_read(pkt, &data->addr, sizeof(data->addr)); in ipcp_ip_address_parse()
185 return -EMSGSIZE; in ipcp_ip_address_parse()
189 /* Request is zeros? Give our IP address in ConfNak */ in ipcp_ip_address_parse()
190 if (data->addr.s_addr == INADDR_ANY) { in ipcp_ip_address_parse()
191 NET_DBG("[IPCP] zeroes rcvd as %s addr, sending NAK with our %s addr", in ipcp_ip_address_parse()
192 "IP", "IP"); in ipcp_ip_address_parse()
193 return -EINVAL; in ipcp_ip_address_parse()
200 addr_str = net_addr_ntop(AF_INET, &data->addr, dst, in ipcp_ip_address_parse()
207 data->addr_present = true; in ipcp_ip_address_parse()
292 fsm->name, fsm, "peer "); in ipcp_config_info_req()
300 * - check that the IP address can be accepted in ipcp_config_info_req()
303 memcpy(&ctx->ipcp.peer_options.address, &data.addr, sizeof(data.addr)); in ipcp_config_info_req()
318 .sin_addr = ctx->ipcp.my_options.dns1_address in ipcp_set_dns_servers()
323 .sin_addr = ctx->ipcp.my_options.dns2_address in ipcp_set_dns_servers()
363 if (!ctx->ipcp.my_options.address.s_addr) { in ipcp_config_info_nack()
364 return -EINVAL; in ipcp_config_info_nack()
374 ppp_fsm_lower_down(&ctx->ipcp.fsm); in ipcp_lower_down()
379 ppp_fsm_lower_up(&ctx->ipcp.fsm); in ipcp_lower_up()
384 ppp_fsm_open(&ctx->ipcp.fsm); in ipcp_open()
389 ppp_fsm_close(&ctx->ipcp.fsm, reason); in ipcp_close()
396 struct net_if_addr *addr; in ipcp_up() local
400 if (ctx->is_ipcp_up) { in ipcp_up()
404 addr_str = net_addr_ntop(AF_INET, &ctx->ipcp.my_options.address, in ipcp_up()
407 addr = net_if_ipv4_addr_add(ctx->iface, in ipcp_up()
408 &ctx->ipcp.my_options.address, in ipcp_up()
411 if (addr == NULL) { in ipcp_up()
412 NET_ERR("Could not set IP address %s", addr_str); in ipcp_up()
419 ctx->is_ipcp_up = true; in ipcp_up()
421 NET_DBG("[%s/%p] Current state %s (%d)", fsm->name, fsm, in ipcp_up()
422 ppp_state_str(fsm->state), fsm->state); in ipcp_up()
431 if (ctx->ipcp.my_options.address.s_addr) { in ipcp_down()
433 ctx->iface, &ctx->ipcp.my_options.address); in ipcp_down()
435 memset(&ctx->ipcp.my_options.address, 0, in ipcp_down()
436 sizeof(ctx->ipcp.my_options.address)); in ipcp_down()
437 memset(&ctx->ipcp.my_options.dns1_address, 0, in ipcp_down()
438 sizeof(ctx->ipcp.my_options.dns1_address)); in ipcp_down()
439 memset(&ctx->ipcp.my_options.dns2_address, 0, in ipcp_down()
440 sizeof(ctx->ipcp.my_options.dns2_address)); in ipcp_down()
442 if (!ctx->is_ipcp_up) { in ipcp_down()
446 ctx->is_ipcp_up = false; in ipcp_down()
456 if (!ctx->is_ipcp_open) { in ipcp_finished()
460 ctx->is_ipcp_open = false; in ipcp_finished()
473 &ctx->ipcp.fsm); in ipcp_init()
475 memset(&ctx->ipcp.fsm, 0, sizeof(ctx->ipcp.fsm)); in ipcp_init()
477 ppp_fsm_init(&ctx->ipcp.fsm, PPP_IPCP); in ipcp_init()
479 ppp_fsm_name_set(&ctx->ipcp.fsm, ppp_proto2str(PPP_IPCP)); in ipcp_init()
481 ctx->ipcp.fsm.my_options.info = ipcp_my_options; in ipcp_init()
482 ctx->ipcp.fsm.my_options.data = ctx->ipcp.my_options_data; in ipcp_init()
483 ctx->ipcp.fsm.my_options.count = ARRAY_SIZE(ipcp_my_options); in ipcp_init()
485 ctx->ipcp.fsm.cb.up = ipcp_up; in ipcp_init()
486 ctx->ipcp.fsm.cb.down = ipcp_down; in ipcp_init()
487 ctx->ipcp.fsm.cb.finished = ipcp_finished; in ipcp_init()
488 ctx->ipcp.fsm.cb.proto_reject = ipcp_proto_reject; in ipcp_init()
489 ctx->ipcp.fsm.cb.config_info_add = ipcp_config_info_add; in ipcp_init()
490 ctx->ipcp.fsm.cb.config_info_req = ipcp_config_info_req; in ipcp_init()
491 ctx->ipcp.fsm.cb.config_info_nack = ipcp_config_info_nack; in ipcp_init()
492 ctx->ipcp.fsm.cb.config_info_rej = ppp_my_options_parse_conf_rej; in ipcp_init()